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/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/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 |
?> |
?> |