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 f9c8b9726d9ba962e1530f1bc6166b4a40f38df0

Fixed pushes and error reporting by git transport
Author: Catalin(ux) M. BOIE
Author date (UTC): 2015-04-19 21:49
Committer name: Catalin(ux) M. BOIE
Committer date (UTC): 2015-04-19 21:49
Parent(s): 481d2e0c17ee8ce3b255b6f672e1d5f6a75484b5
Signing key:
Tree: 4855bd629e8d743ceee0551dd108cd9f9da4eaa5
File Lines added Lines deleted
TODO 0 10
hooks/post-receive 4 1
hooks/pre-receive 3 1
hooks/update 3 0
inc/git.inc.php 77 23
inc/log.inc.php 1 1
inc/repo.inc.php 1 0
inc/user/repo-page.php 7 1
scripts/cache.sh 2 0
scripts/events.php 2 2
scripts/remote.php 4 5
File TODO changed (mode: 100644) (index d83e4d4..e7d7c91)
1 1 == Where I stopped last time == == Where I stopped last time ==
2 2 [ ] Add "Spread the word!" on website. [ ] Add "Spread the word!" on website.
3 3
4 [ ] Daca creez repo, nu-mi creaza dir-ul (de fapt, nu marcheaza in cache ca l-a
5 creat din cauza event-ului care nu poate sa se conecteze la cache:
6 broken pipe. Foarte ciudat. De ce nu ar putea trimite?
7 Probabil socket-ul nu mai e deschis pentru ca cache-ul s-a restartat?
8 Unde se intimpla asta?!
9 [ ] Remove any err- files at first install.
10 Se pare ca trebuie sa testez daca exista tabela 'state' in cron.php.
11 Poate nu numai aici. Si sa stochez informatia asta in cache.
12 [ ] I can do a select before write to be sure socket is open.
13 If I get an error signal from select, reopen the socket.
14 4 [ ] Run unit testing. [ ] Run unit testing.
15 5 [ ] SPF? mail-ul ajunge in spam! [ ] SPF? mail-ul ajunge in spam!
16 6 [ ] Upload kvm image to downloads.rocketgit.com. Sign it? sha256 it? [ ] Upload kvm image to downloads.rocketgit.com. Sign it? sha256 it?
File hooks/post-receive changed (mode: 100755) (index fee983f..59929df)
... ... while (($set = fgets($f))) {
55 55 $old_rev = @rg_git_rev($x[0]); $old_rev = @rg_git_rev($x[0]);
56 56 $new_rev = @rg_git_rev($x[1]); $new_rev = @rg_git_rev($x[1]);
57 57 $refname = @rg_git_reference($x[2]); $refname = @rg_git_reference($x[2]);
58 rg_log("refname=$refname old_rev=$old_rev new_rev=$new_rev.");
58 if ($refname === FALSE)
59 rg_git_fatal('Invalid reference: ' . rg_git_error() . '!');
59 60
60 61 if (empty($refname) || empty($old_rev) || empty($new_rev)) if (empty($refname) || empty($old_rev) || empty($new_rev))
61 62 rg_git_fatal("Invalid parameters [$old_rev $new_rev $refname]!"); rg_git_fatal("Invalid parameters [$old_rev $new_rev $refname]!");
63
64 rg_log("refname=$refname old_rev=$old_rev new_rev=$new_rev.");
62 65 } }
63 66 fclose($f); fclose($f);
64 67
File hooks/pre-receive changed (mode: 100755) (index 8e0397a..b6830c8)
... ... while (($set = fgets($f))) {
50 50 $old_rev = @rg_git_rev($x[0]); $old_rev = @rg_git_rev($x[0]);
51 51 $new_rev = @rg_git_rev($x[1]); $new_rev = @rg_git_rev($x[1]);
52 52 $refname = @rg_git_reference($x[2]); $refname = @rg_git_reference($x[2]);
53 if ($refname === FALSE)
54 rg_git_fatal('Invalid reference: ' . rg_git_error() . '!');
55
53 56 rg_log("refname=$refname old_rev=$old_rev new_rev=$new_rev."); rg_log("refname=$refname old_rev=$old_rev new_rev=$new_rev.");
54 57
55 58 if (empty($refname) || empty($old_rev) || empty($new_rev)) if (empty($refname) || empty($old_rev) || empty($new_rev))
56 59 rg_git_fatal("Invalid parameters [$old_rev $new_rev $refname]!"); rg_git_fatal("Invalid parameters [$old_rev $new_rev $refname]!");
57
58 60 } }
59 61 fclose($f); fclose($f);
60 62
File hooks/update changed (mode: 100755) (index c195f30..0bf5fb8)
... ... umask(0022);
51 51
52 52
53 53 $a['refname'] = rg_git_reference($_SERVER['argv'][1]); $a['refname'] = rg_git_reference($_SERVER['argv'][1]);
54 if ($a['refname'] === FALSE)
55 rg_git_fatal('Invalid reference: ' . rg_git_error() . '!');
56
54 57 $a['old_rev'] = rg_git_rev(@$_SERVER['argv'][2]); $a['old_rev'] = rg_git_rev(@$_SERVER['argv'][2]);
55 58 $a['new_rev'] = rg_git_rev(@$_SERVER['argv'][3]); $a['new_rev'] = rg_git_rev(@$_SERVER['argv'][3]);
56 59 rg_log("refname=" . $a['refname'] . " old_rev=" . $a['old_rev'] rg_log("refname=" . $a['refname'] . " old_rev=" . $a['old_rev']
File inc/git.inc.php changed (mode: 100644) (index ac532c0..c63f455)
... ... function rg_git_fatal($msg)
30 30 echo "RocketGit: $line\n"; echo "RocketGit: $line\n";
31 31 } }
32 32 echo "==========\n"; echo "==========\n";
33 flush();
33 34 exit(1); exit(1);
34 35 } }
35 36
 
... ... function rg_git_rev($rev)
258 259 */ */
259 260 function rg_git_reference($refname) function rg_git_reference($refname)
260 261 { {
261 $pattern = "[a-zA-Z0-9^~\/_]*";
262 // We do not accept '..' chars
263 if (preg_match('/\.\./', $refname) !== 0) {
264 rg_git_set_error('we do not accept \'..\' inside the ref name');
265 return FALSE;
266 }
267
268 // We do not accept '/.' chars
269 if (preg_match('/\/\./', $refname) !== 0) {
270 rg_git_set_error('we do not accept \'/.\' inside the ref name');
271 return FALSE;
272 }
273
274 // We do not accept '\\' chars
275 if (preg_match('/\\\\/', $refname) !== 0) {
276 rg_git_set_error('we do not accept \'\\\\\' inside the ref name');
277 return FALSE;
278 }
279
280 // We do not accept ending '.lock' chars
281 if (preg_match('/(.lock|\/|\.)$/', $refname) !== 0) {
282 rg_git_set_error('we do not accept a ref name ending in .lock'
283 . ' or slash or dot');
284 return FALSE;
285 }
286
287 $pattern = "[-a-zA-Z0-9\/_.]*";
262 288 $r = preg_match('/^' . $pattern . '$/uD', $refname); $r = preg_match('/^' . $pattern . '$/uD', $refname);
263 289 if ($r === FALSE) { if ($r === FALSE) {
264 290 rg_internal_error("preg_match failed!"); rg_internal_error("preg_match failed!");
 
... ... function rg_git_reference($refname)
266 292 } }
267 293 if ($r !== 1) { if ($r !== 1) {
268 294 $chars = preg_replace('/' . $pattern . '/', '', $refname); $chars = preg_replace('/' . $pattern . '/', '', $refname);
269 rg_log("git_reference: ref [$refname] contains invalid chars ($chars) (r=$r)");
270 return "";
295 rg_git_set_error('we do not accept [' . $chars
296 . '] inside a ref name');
297 return FALSE;
271 298 } }
272 299
273 300 return $refname; return $refname;
 
... ... function rg_git_merge_base($old, $new)
358 385 return $ret; return $ret;
359 386 } }
360 387
361 // TODO: Unit testing
362 388 /* /*
363 389 * Safely update a reference - used to update main namespace from other ns * Safely update a reference - used to update main namespace from other ns
364 390 * If @new is empty, we assume a delete * If @new is empty, we assume a delete
391 * TODO: Unit testing
365 392 */ */
366 393 function rg_git_update_ref($ref, $old, $new, $reason) function rg_git_update_ref($ref, $old, $new, $reason)
367 394 { {
 
... ... function rg_git_update_tag($db, $a)
1047 1074 rg_git_fatal($a['refname'] . "\nNo rights to" rg_git_fatal($a['refname'] . "\nNo rights to"
1048 1075 . " create an annotated tag."); . " create an annotated tag.");
1049 1076 $history['history_category'] = REPO_CAT_GIT_ATAG_CREATE; $history['history_category'] = REPO_CAT_GIT_ATAG_CREATE;
1050 $history['history_message'] = 'Annotated tag ' . $a['refname'] . ' created (' . $a['new_rev'] . ').';
1051 rg_repo_history_insert($db, $history);
1077 $history['history_message'] = 'Annotated tag '
1078 . $a['refname'] . ' created (' . $a['new_rev'] . ')';
1052 1079 } else if (strcmp($a['new_rev'], $rg_git_zero) == 0) { // delete } else if (strcmp($a['new_rev'], $rg_git_zero) == 0) { // delete
1053 1080 rg_log("delete ann tag"); rg_log("delete ann tag");
1054 1081 $x['needed_rights'] = 'n'; $x['needed_rights'] = 'n';
 
... ... function rg_git_update_tag($db, $a)
1056 1083 rg_git_fatal($a['refname'] . "\nNo rights to" rg_git_fatal($a['refname'] . "\nNo rights to"
1057 1084 . " delete an annotated tag."); . " delete an annotated tag.");
1058 1085 $history['history_category'] = REPO_CAT_GIT_ATAG_DELETE; $history['history_category'] = REPO_CAT_GIT_ATAG_DELETE;
1059 $history['history_message'] = 'Annotated tag ' . $a['refname'] . ' deleted (' . $a['old_rev'] . ').';
1060 rg_repo_history_insert($db, $history);
1086 $history['history_message'] = 'Annotated tag '
1087 . $a['refname'] . ' deleted"
1088 . " (' . $a['old_rev'] . ')';
1061 1089 } else { // change } else { // change
1062 1090 rg_log("This seems it cannot happen in recent git."); rg_log("This seems it cannot happen in recent git.");
1063 1091 $x['needed_rights'] = 'S'; $x['needed_rights'] = 'S';
 
... ... function rg_git_update_tag($db, $a)
1065 1093 rg_git_fatal($a['refname'] . "\nNo rights to" rg_git_fatal($a['refname'] . "\nNo rights to"
1066 1094 . " change an annotated tag."); . " change an annotated tag.");
1067 1095 $history['history_category'] = REPO_CAT_GIT_ATAG_UPDATE; $history['history_category'] = REPO_CAT_GIT_ATAG_UPDATE;
1068 $history['history_message'] = 'Annotated tag ' . $a['refname'] . ' updated from ' . $a['old_rev'] . ' to ' . $a['new_rev'] . '.';
1069 rg_repo_history_insert($db, $history);
1096 $history['history_message'] = 'Annotated tag '
1097 . $a['refname'] . ' updated from '
1098 . $a['old_rev'] . ' to ' . $a['new_rev'];
1070 1099 } }
1071 1100 } else { // Un-annotated } else { // Un-annotated
1072 1101 if (strcmp($a['old_rev'], $rg_git_zero) == 0) { // create if (strcmp($a['old_rev'], $rg_git_zero) == 0) { // create
 
... ... function rg_git_update_tag($db, $a)
1075 1104 rg_git_fatal($a['refname'] . "\nNo rights to" rg_git_fatal($a['refname'] . "\nNo rights to"
1076 1105 . " create an un-annotated tag."); . " create an un-annotated tag.");
1077 1106 $history['history_category'] = REPO_CAT_GIT_UTAG_CREATE; $history['history_category'] = REPO_CAT_GIT_UTAG_CREATE;
1078 $history['history_message'] = 'Un-annotated tag ' . $a['refname'] . ' created (' . $a['new_rev'] . ').';
1079 rg_repo_history_insert($db, $history);
1107 $history['history_message'] = 'Un-annotated tag '
1108 . $a['refname'] . ' created'
1109 . ' (' . $a['new_rev'] . ')';
1080 1110 } else if (strcmp($a['new_rev'], $rg_git_zero) == 0) { // delete } else if (strcmp($a['new_rev'], $rg_git_zero) == 0) { // delete
1081 1111 $x['needed_rights'] = 'u'; $x['needed_rights'] = 'u';
1082 1112 if (rg_rights_allow($db, $x) !== TRUE) if (rg_rights_allow($db, $x) !== TRUE)
1083 1113 rg_git_fatal($a['refname'] . "\nNo rights to" rg_git_fatal($a['refname'] . "\nNo rights to"
1084 1114 . " delete an un-annotated tag."); . " delete an un-annotated tag.");
1085 1115 $history['history_category'] = REPO_CAT_GIT_UTAG_DELETE; $history['history_category'] = REPO_CAT_GIT_UTAG_DELETE;
1086 $history['history_message'] = 'Un-annotated tag ' . $a['refname'] . ' deleted (' . $a['old_rev'] . ').';
1087 rg_repo_history_insert($db, $history);
1116 $history['history_message'] = 'Un-annotated tag '
1117 . $a['refname'] . ' deleted'
1118 . ' (' . $a['old_rev'] . ')';
1088 1119 } else { // change } else { // change
1089 1120 $x['needed_rights'] = 'U'; $x['needed_rights'] = 'U';
1090 1121 if (rg_rights_allow($db, $x) !== TRUE) if (rg_rights_allow($db, $x) !== TRUE)
1091 1122 rg_git_fatal($a['refname'] . "\nNo rights to" rg_git_fatal($a['refname'] . "\nNo rights to"
1092 1123 . " change an un-annotated tag."); . " change an un-annotated tag.");
1093 1124 $history['history_category'] = REPO_CAT_GIT_UTAG_UPDATE; $history['history_category'] = REPO_CAT_GIT_UTAG_UPDATE;
1094 $history['history_message'] = 'Annotated tag ' . $a['refname'] . ' updated from ' . $a['old_rev'] . ' to ' . $a['new_rev'] . '.';
1095 rg_repo_history_insert($db, $history);
1125 $history['history_message'] = 'Annotated tag '
1126 . $a['refname'] . ' updated from '
1127 . $a['old_rev'] . ' to ' . $a['new_rev'];
1096 1128 } }
1097 1129 } }
1098 1130
 
... ... function rg_git_update_tag($db, $a)
1100 1132 // Not clear when we do not have a namespace. // Not clear when we do not have a namespace.
1101 1133 if (!empty($a['namespace'])) { if (!empty($a['namespace'])) {
1102 1134 // Update the main namespace // Update the main namespace
1135 $reason = $a['login_username'] . ' pushed tag ' . $a['refname'];
1103 1136 $r = rg_git_update_ref($a['refname'], $a['old_rev'], $r = rg_git_update_ref($a['refname'], $a['old_rev'],
1104 $a['new_rev'], "reason");
1137 $a['new_rev'], $reason);
1105 1138 if ($r !== TRUE) { if ($r !== TRUE) {
1106 1139 rg_git_fatal($a['refname'] . "\nCannot update ref (" rg_git_fatal($a['refname'] . "\nCannot update ref ("
1107 1140 . rg_git_error() . ")"); . rg_git_error() . ")");
 
... ... function rg_git_update_tag($db, $a)
1110 1143 // We can clean now the tmp namespace - TODO // We can clean now the tmp namespace - TODO
1111 1144 } }
1112 1145
1146 rg_repo_history_insert($db, $history);
1147
1113 1148 rg_log_exit(); rg_log_exit();
1114 1149 rg_prof_end("git_update_tag"); rg_prof_end("git_update_tag");
1115 1150 } }
 
... ... function rg_git_update_branch($db, $a)
1145 1180 rg_git_fatal($a['refname'] . "\nNo rights to delete" rg_git_fatal($a['refname'] . "\nNo rights to delete"
1146 1181 . " a branch."); . " a branch.");
1147 1182 $history['history_category'] = REPO_CAT_GIT_BRANCH_DELETE; $history['history_category'] = REPO_CAT_GIT_BRANCH_DELETE;
1148 $history['history_message'] = 'Reference ' . $a['refname'] . ' deleted.';
1183 $history['history_message'] = 'Reference ' . $a['refname']
1184 . ' deleted';
1149 1185 rg_repo_history_insert($db, $history); rg_repo_history_insert($db, $history);
1150 1186 return; return;
1151 1187 } }
 
... ... function rg_git_update_branch($db, $a)
1243 1279 $mr = "refs/mr/" $mr = "refs/mr/"
1244 1280 . preg_replace('/refs\/heads\//', '', $a['refname']) . preg_replace('/refs\/heads\//', '', $a['refname'])
1245 1281 . "_" . preg_replace('/rg_/', '', $a['namespace']); . "_" . preg_replace('/rg_/', '', $a['namespace']);
1246 $r = rg_git_update_ref($mr, "", $a['new_rev'], "mr");
1282 $reason = $a['login_username'] . ' pushed a merge request'
1283 . ' for ref ' . $a['refname']
1284 . ' into namespace ' . $a['namespace'];
1285 $r = rg_git_update_ref($mr, "", $a['new_rev'], $reason);
1247 1286 if ($r !== TRUE) { if ($r !== TRUE) {
1248 1287 rg_log("Cannot update-ref: " . rg_git_error()); rg_log("Cannot update-ref: " . rg_git_error());
1249 1288 rg_git_fatal($a['refname'] . ": Cannot set refs/mr/." rg_git_fatal($a['refname'] . ": Cannot set refs/mr/."
1250 1289 . " Try again later."); . " Try again later.");
1251 1290 } }
1291 // TODO: here or inside below function we should record
1292 // a hisotry event that an anon push was done.
1252 1293 $r = rg_mr_queue_add($a['repo_id'], $a['namespace'], $r = rg_mr_queue_add($a['repo_id'], $a['namespace'],
1253 1294 $a['old_rev'], $a['new_rev'], $a['refname'], $a['ip']); $a['old_rev'], $a['new_rev'], $a['refname'], $a['ip']);
1254 1295 if ($r !== TRUE) if ($r !== TRUE)
 
... ... function rg_git_update_branch($db, $a)
1256 1297 $_x = array(); $_x = array();
1257 1298 $msg = rg_template("msg/push_merge_request.txt", $_x); $msg = rg_template("msg/push_merge_request.txt", $_x);
1258 1299 rg_git_info($a['refname'] . "\n" . $msg); rg_git_info($a['refname'] . "\n" . $msg);
1300
1301 $history['history_category'] = REPO_CAT_GIT_BRANCH_ANON_PUSH;
1302 $history['history_message'] = 'Anonymous push to ref '
1303 . $a['refname'];
1304
1305 // TODO: we shoult notify by e-mail that a merge request is
1306 // waiting.
1259 1307 } else { } else {
1260 1308 rg_log("We are allowed to push."); rg_log("We are allowed to push.");
1261 1309
 
... ... function rg_git_update_branch($db, $a)
1263 1311 // Not clear when we do not have a namespace. // Not clear when we do not have a namespace.
1264 1312 if (!empty($a['namespace'])) { if (!empty($a['namespace'])) {
1265 1313 // Update the main namespace // Update the main namespace
1314 $reason = $a['login_username']
1315 . ' pushed ref ' . $a['refname'];
1266 1316 $r = rg_git_update_ref($a['refname'], $a['old_rev'], $r = rg_git_update_ref($a['refname'], $a['old_rev'],
1267 $a['new_rev'], "push");
1317 $a['new_rev'], $reason);
1268 1318 if ($r !== TRUE) { if ($r !== TRUE) {
1269 1319 rg_git_fatal($a['refname'] . "\nCannot update ref (" rg_git_fatal($a['refname'] . "\nCannot update ref ("
1270 1320 . rg_git_error() . ")"); . rg_git_error() . ")");
 
... ... function rg_git_update_branch($db, $a)
1275 1325
1276 1326 if (strcmp($a['old_rev'], $rg_git_zero) == 0) { if (strcmp($a['old_rev'], $rg_git_zero) == 0) {
1277 1327 $history['history_category'] = REPO_CAT_GIT_BRANCH_CREATE; $history['history_category'] = REPO_CAT_GIT_BRANCH_CREATE;
1278 $history['history_message'] = 'Reference ' . $a['refname'] . ' created.';
1328 $history['history_message'] = 'Reference '
1329 . $a['refname'] . ' created'
1330 . ' (' . $a['new_rev'] . ')';
1279 1331 } else { } else {
1280 1332 $history['history_category'] = REPO_CAT_GIT_BRANCH_UPDATE; $history['history_category'] = REPO_CAT_GIT_BRANCH_UPDATE;
1281 $history['history_message'] = 'Reference ' . $a['refname'] . ' updated from ' . $a['old_rev'] . ' to ' . $a['new_rev'] . '.';
1333 $history['history_message'] = 'Reference '
1334 . $a['refname'] . ' updated from '
1335 . $a['old_rev'] . ' to ' . $a['new_rev'];
1282 1336 } }
1283 rg_repo_history_insert($db, $history);
1284 1337 } }
1338 rg_repo_history_insert($db, $history);
1285 1339
1286 1340 rg_prof_end("git_update_branch"); rg_prof_end("git_update_branch");
1287 1341 } }
File inc/log.inc.php changed (mode: 100644) (index dbf1c3d..81a7308)
... ... function rg_log_cron()
187 187 // Do not send less than 1 per 4 hours // Do not send less than 1 per 4 hours
188 188 $last_ts = 0; $last_ts = 0;
189 189 if (file_exists($rg_state_dir . "/log_cron_last")) if (file_exists($rg_state_dir . "/log_cron_last"))
190 $last_ts = filemtime($rg_state_dir . "/log_cron_last");
190 $last_ts = @filemtime($rg_state_dir . "/log_cron_last");
191 191
192 192 if ($last_ts + 4 * 3600 > time()) if ($last_ts + 4 * 3600 > time())
193 193 return 0; return 0;
File inc/repo.inc.php changed (mode: 100644) (index 86256f4..b47487b)
... ... define('REPO_CAT_GIT_UTAG_UPDATE', 32);
213 213 define('REPO_CAT_GIT_BRANCH_DELETE', 40); define('REPO_CAT_GIT_BRANCH_DELETE', 40);
214 214 define('REPO_CAT_GIT_BRANCH_UPDATE', 41); define('REPO_CAT_GIT_BRANCH_UPDATE', 41);
215 215 define('REPO_CAT_GIT_BRANCH_CREATE', 42); define('REPO_CAT_GIT_BRANCH_CREATE', 42);
216 define('REPO_CAT_GIT_BRANCH_ANON_PUSH', 43);
216 217
217 218 $rg_repo_error = ""; $rg_repo_error = "";
218 219
File inc/user/repo-page.php changed (mode: 100644) (index 74d6709..b2b7553)
... ... if (strcmp($_subop, "history") == 0) {
192 192 //rg_log("DEBUG: log: type=$type"); //rg_log("DEBUG: log: type=$type");
193 193 if (strcmp($type, "commit") == 0) { if (strcmp($type, "commit") == 0) {
194 194 $commit = rg_git_reference($paras[0]); $commit = rg_git_reference($paras[0]);
195 // TODO: check error code
195 if ($commit === FALSE) {
196 rg_internal_error("Invalid commit"
197 . " [" . $paras[0] . "]."
198 . " Make it empty.");
199 // TODO: give an error on the page?!
200 $commit = "";
201 }
196 202 rg_log("Show diff for commit [$commit]"); rg_log("Show diff for commit [$commit]");
197 203
198 204 if (strstr($commit, "..")) { if (strstr($commit, "..")) {
File scripts/cache.sh changed (mode: 100755) (index f82e0c3..8665c64)
... ... while [ 1 ]; do
19 19 # in case of errors, we will wait, to not go into an infinite loop # in case of errors, we will wait, to not go into an infinite loop
20 20 if [ "${?}" != "0" ]; then if [ "${?}" != "0" ]; then
21 21 sleep 10 sleep 10
22 else
23 sleep 1
22 24 fi fi
23 25 done done
24 26
File scripts/events.php changed (mode: 100644) (index ab82f6a..aeaa0a4)
... ... if ($r === FALSE) {
87 87 } }
88 88 */ */
89 89
90 $original_mtime = filemtime(__FILE__);
90 $original_mtime = @filemtime(__FILE__);
91 91 $notify_list = array(); $notify_list = array();
92 92 do { do {
93 93 // Check our mtime so we can upgrade the software and this script // Check our mtime so we can upgrade the software and this script
94 94 // will restart. // will restart.
95 95 clearstatcache(); clearstatcache();
96 $mtime = filemtime(__FILE__);
96 $mtime = @filemtime(__FILE__);
97 97 rg_log("mtime=$mtime, original_mtime=$original_mtime"); rg_log("mtime=$mtime, original_mtime=$original_mtime");
98 98 if ($mtime != $original_mtime) { if ($mtime != $original_mtime) {
99 99 rg_log("File changed. Exiting..."); rg_log("File changed. Exiting...");
File scripts/remote.php changed (mode: 100644) (index 0899abf..6ed30f1)
... ... function info($str)
31 31 // ssh // ssh
32 32 fwrite(STDERR, $str2); fwrite(STDERR, $str2);
33 33 } else { } else {
34 // git - seems is not working
35 /*
36 $len = 4 + 1 + strlen($str2);
37 echo sprintf("%04x", $len) . "\2" . $str2;
38 */
34 // git - seems is not working as ssh
35 $str2 = "\n" . $str2;
36 $len = 4 + strlen($str2);
37 echo sprintf("%04x", $len) . $str2;
39 38 } }
40 39 } }
41 40
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