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 cb68f1921782a503675c592dc7484aa26b8815b6

Cosmetic
Author: Catalin(ux) M. BOIE
Author date (UTC): 2017-03-26 09:37
Committer name: Catalin(ux) M. BOIE
Committer date (UTC): 2017-03-26 09:37
Parent(s): 17d8eb4b4592dd96e62a8da74d87d3d3b26aeb86
Signing key:
Tree: 9c882de62f11956a1482e6cbf34c39c1b59c02bd
File Lines added Lines deleted
hooks/post-receive 1 1
hooks/pre-receive 1 1
hooks/update 0 2
tests/common.php 1 0
tests/state.php 32 6
File hooks/post-receive changed (mode: 100755) (index e39549b..9856d15)
5 5 // post-receive hook // post-receive hook
6 6 // TODO: This hook can be run for marking repo dirty. // TODO: This hook can be run for marking repo dirty.
7 7 // It is executed once, input is the list of SUCCESSFULLY updated ref. // It is executed once, input is the list of SUCCESSFULLY updated ref.
8 // The error code is ignored.
8 // The exit code is ignored.
9 9 // Useful to send mails. // Useful to send mails.
10 10 // Warn: new_ref may not point to ref because of concurrent updates. // Warn: new_ref may not point to ref because of concurrent updates.
11 11 // TODO: Re-check man githooks and git-receive-pack! // TODO: Re-check man githooks and git-receive-pack!
File hooks/pre-receive changed (mode: 100755) (index fa6a704..322b781)
4 4 // //
5 5 // pre-receive hook // pre-receive hook
6 6 // Only logs ip and user // Only logs ip and user
7 //
7 // It can block the receiving.
8 8
9 9 error_reporting(E_ALL); error_reporting(E_ALL);
10 10 ini_set("track_errors", "On"); ini_set("track_errors", "On");
File hooks/update changed (mode: 100755) (index 375d036..d138e39)
6 6 // Inspired by update.sample in git package // Inspired by update.sample in git package
7 7 // It is executed before each ref is updated. // It is executed before each ref is updated.
8 8 // //
9 // TODO: what do we receive when a tag will be created?
10 //
11 9
12 10 error_reporting(E_ALL); error_reporting(E_ALL);
13 11 ini_set("track_errors", "On"); ini_set("track_errors", "On");
File tests/common.php changed (mode: 100644) (index 017697b..38e7549)
... ... if ($r !== TRUE) {
36 36 } }
37 37
38 38 rg_log("common.php finished"); rg_log("common.php finished");
39 rg_log('');
39 40
40 41 ?> ?>
File tests/state.php changed (mode: 100644) (index f60b6f5..79add54)
... ... rg_log_set_file("state.log");
15 15 require_once("common.php"); require_once("common.php");
16 16
17 17 $rg_sql_debug = 1; $rg_sql_debug = 1;
18 $rg_cache_debug = TRUE;
18 19
19 // check return for an invalid state
20 $r = rg_state_get($db, "asdsdsdf");
20 $k = 'key-' . time();
21
22 rg_log('');
23 rg_log_enter('Checking return for an non-existing key...');
24 $r = rg_state_get($db, $k);
21 25 if ($r !== "") { if ($r !== "") {
22 26 rg_log("Cannot get '' (but '$r') for an unknown key!"); rg_log("Cannot get '' (but '$r') for an unknown key!");
23 27 exit(1); exit(1);
24 28 } }
29 rg_log_exit();
30
31
32 rg_log('');
33 rg_log_enter('Setting key to "bau"...');
34 $r = rg_state_set($db, $k, "bau");
35 if ($r !== TRUE) {
36 rg_log("Cannot get a TRUE for setting 'a' to 'bau' ($r)!");
37 exit(1);
38 }
39 rg_log_exit();
40
25 41
26 $r = rg_state_set($db, "a", "bau");
42 rg_log('');
43 rg_log_enter('Setting key to "bau" (again)...');
44 $r = rg_state_set($db, $k, "bau");
27 45 if ($r !== TRUE) { if ($r !== TRUE) {
28 46 rg_log("Cannot get a TRUE for setting 'a' to 'bau' ($r)!"); rg_log("Cannot get a TRUE for setting 'a' to 'bau' ($r)!");
29 47 exit(1); exit(1);
30 48 } }
49 rg_log_exit();
31 50
32 $r = rg_state_set($db, "a", "cucu");
51
52 rg_log('');
53 rg_log_enter('Overwriting var with "cucu"...');
54 $r = rg_state_set($db, $k, "cucu");
33 55 if ($r !== TRUE) { if ($r !== TRUE) {
34 56 rg_log("Cannot get a TRUE for setting 'a' to 'cucu' ($r)!"); rg_log("Cannot get a TRUE for setting 'a' to 'cucu' ($r)!");
35 57 exit(1); exit(1);
36 58 } }
59 rg_log_exit();
60
37 61
38 $r = rg_state_get($db, "a");
62 rg_log('');
63 rg_log_enter('Checking if state is correctly now...');
64 $r = rg_state_get($db, $k);
39 65 if (strcmp($r, "cucu") != 0) { if (strcmp($r, "cucu") != 0) {
40 66 rg_log("Cannot get correct state ('$r' != 'cucu')!"); rg_log("Cannot get correct state ('$r' != 'cucu')!");
41 67 exit(1); exit(1);
42 68 } }
69 rg_log_exit();
43 70
44 rg_sql_close($db);
45 71
46 72 rg_log("OK!"); rg_log("OK!");
47 73 ?> ?>
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