xaizek / rocketgit (License: AGPLv3+) (since 2018-12-09)
Light and fast Git hosting solution suitable to serve both as a hub or as a personal code storage with its tickets, pull requests, API and much more.
Commit 36b3f9c8c8fc1b80216c1db944a631437f91e4c7

Add "repo_create" Web-API call
Creates a new repository.

Can be used to automatically mirror set of repositories.
Author: xaizek
Author date (UTC): 2018-12-08 22:45
Committer name: xaizek
Committer date (UTC): 2018-12-08 22:45
Parent(s): c211539a256253302b2e9dac7d7f0f07dcdc59be
Signing key: 99DC5E4DB05F6BE2
Tree: 2f2268bee802f81e327c3aa33a5ce106f6565903
File Lines added Lines deleted
inc/repo.inc.php 31 0
root/themes/default/doc/api.html 43 0
File inc/repo.inc.php changed (mode: 100644) (index 087edcb..9fe0034)
... ... function rg_repo_api($db, $a)
2281 2281 rg_sql_free_result($res); rg_sql_free_result($res);
2282 2282 break; break;
2283 2283 } }
2284 if (strcmp($cmd, 'repo_create') == 0) {
2285 if (!isset($a['name'])) {
2286 $ret['error'] = '"name" field is required';
2287 break;
2288 }
2289 if ($ri !== FALSE && $ri['exists'] == 1) {
2290 $ret['error'] = 'repository with such name '
2291 . 'already exists';
2292 break;
2293 }
2294
2295 $ri = rg_repo_get_default_info();
2296 $ri['uid'] = $a['cui']['uid'];
2297 $ri['name'] = $a['name'];
2298 if (isset($a['description'])) {
2299 $ri['description'] = $a['description'];
2300 }
2301 if (isset($a['license'])) {
2302 $ri['license'] = $a['license'];
2303 }
2304 if (isset($a['template'])) {
2305 $ri['template'] = $a['template'];
2306 }
2307 rg_repo_cosmetic($db, $ri);
2308
2309 if (rg_repo_edit($db, $a['cui'], $ri) === FALSE) {
2310 $ret['error'] = 'failed to create repository';
2311 }
2312 $ret = $ri;
2313 break;
2314 }
2284 2315
2285 2316 // From this point below, we have a repo // From this point below, we have a repo
2286 2317
File root/themes/default/doc/api.html changed (mode: 100644) (index 273f05e..506b461)
10 10 <a href="#user_wh_list">user_wh_list</a><br /> <a href="#user_wh_list">user_wh_list</a><br />
11 11 <a href="#repo_bug_info">repo_bug_info</a><br /> <a href="#repo_bug_info">repo_bug_info</a><br />
12 12 <a href="#repo_bug_list">repo_bug_list</a><br /> <a href="#repo_bug_list">repo_bug_list</a><br />
13 <a href="#repo_create">repo_create</a><br />
13 14 <a href="#repo_list">repo_list</a><br /> <a href="#repo_list">repo_list</a><br />
14 15 <a href="#repo_info">repo_info</a><br /> <a href="#repo_info">repo_info</a><br />
15 16 <a href="#repo_pr_list">repo_pr_list</a><br /> <a href="#repo_pr_list">repo_pr_list</a><br />
 
... ... $ ssh rocketgit@rocketgit.com api repo_bug_list name=repo1
221 222 </div> </div>
222 223 <br /> <br />
223 224
225 <a name="repo_create"><b>repo_create</b></a><br />
226 <b>Description</b>: Creates a new repository<br />
227 <b>Parameters</b>: name, [description], [license], [template]<br />
228 Example:
229 <div class="term">
230 $ curl --user put_here_your_username:this_is_your_api_key \
231 --data '{"cmd": "repo_create", "name": "repo1", "license": "AGPLv3+"}' \
232 @@base_url@@/op/api
233 $ ssh rocketgit@rocketgit.com api repo_create name=repo1 license=AGPLv3+
234 {
235 "repo_id": "769",
236 "name": "repo1",
237 "uid": "846",
238 "itime": "1447874006",
239 "disk_quota_mb": null,
240 "max_commit_size": "0",
241 "master": "0",
242 "description": "",
243 "git_dir_done": "0",
244 "deleted": "0",
245 "disk_used_mb": "0",
246 "public": "1",
247 "last_bug_id": "1",
248 "license": "AGPLv3+",
249 "template": "OS type(s) and version(s)?\n\nApplication version(s) affected?\n\nSteps to reproduce?",
250 "last_mr_id": "0",
251 "ok": 1,
252 "exists": 1,
253 "HTML:description_nlbr": "",
254 "HTML:itime_nice": "2015-11-18",
255 "owner": "bla",
256 "url_user": "\/user\/bla",
257 "url_repo": "\/user\/bla\/repo1",
258 "clone_url_ssh": "ssh:\/\/rocketgit@rocketgit.com\/user\/bla\/repo1",
259 "clone_url_git": "git:\/\/rocketgit.com\/user\/bla\/repo1",
260 "clone_url_http": "http:\/\/rocketgit.com\/user\/bla\/repo1",
261 "master_name": "-",
262 "disk_used": "0B"
263 }
264 </div>
265 <br />
266
224 267 <a name="repo_list"><b>repo_list</b></a><br /> <a name="repo_list"><b>repo_list</b></a><br />
225 268 <b>Parameters</b>: none<br /> <b>Parameters</b>: none<br />
226 269 Example: Example:
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/rocketgit

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/rocketgit

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master