List of commits:
Subject Hash Author Date (UTC)
Cosmetic 548c8a909c994ef528c9910c625e6afb88beeead Catalin(ux) M. BOIE 2022-02-16 18:44:12
.deb support 722ca672abf6f28109e35f3573dca7e367d3b51a Catalin(ux) M. BOIE 2022-02-16 18:39:19
compare: added rpm/deb lines 1356fb5c8e5d82356776561af4a2dcaec0d19c14 Catalin(ux) M. BOIE 2022-02-16 07:30:06
debian folder updates 45e86104b565e508c514804910cfda87a3c1239c Catalin(ux) M. BOIE 2022-02-16 07:26:09
Fix rate limit for IPv6 336d34f7eaac356688ba5c251f027aff947ce9e4 Catalin(ux) M. BOIE 2022-02-09 14:39:28
Forgot to remove a function after moving it b6fd0700cf5dde953acb0d4584a48cb404a69ab2 Catalin(ux) M. BOIE 2021-11-17 19:27:04
Prepare correctly for rgfs (missed some places) 38d255af17a72fd9f92a8c37d4fddc8f2caf023b Catalin(ux) M. BOIE 2021-11-17 18:05:01
TODO/cosmetic d4968bc1d9c8bbe3c4aba2479f3694a7a3863d0f Catalin(ux) M. BOIE 2021-11-17 18:04:36
More debug help 74f45188bffd7630d0c08648433749a3ef23c9af Catalin(ux) M. BOIE 2021-11-15 17:34:58
worker: Fixed a stupid bug leading to wrong distro upgrade command d9bc215557cd9a6f30dbc90434dc3aba46e39979 Catalin(ux) M. BOIE 2021-11-14 16:16:43
Silence an 'unpack' exception when we do not have enough bytes. add562b15d94501a0585001db526b241c251b6e6 Catalin(ux) M. BOIE 2021-11-14 11:25:01
Run struct and fixes under the same lock d046942317c73351473a18eb833318aec3f4d907 Catalin(ux) M. BOIE 2021-11-14 08:18:05
spec file small updates 7aef02df6ed5f6ce4d39cd2a926a79bcdc1a3c5a Catalin(ux) M. BOIE 2021-11-14 06:33:35
Typo b0087441b4d637c7bf6ed64b6c243ad2ec8f1493 Catalin(ux) M. BOIE 2021-11-14 06:15:00
spec: Added 'Replaces: rocketgit' to easy upgrade, fixed fixfiles c380f40fe86ddf70b99030a6f0be93d91137b909 Catalin(ux) M. BOIE 2021-11-14 06:14:25
Fixed non debug case of rg_debug_html 523f6784671e5f810b8435ad66ad21ea548219d8 Catalin(ux) M. BOIE 2021-11-14 05:58:37
Fix rate limit types 0de3ee35d0d0e46521d64a596232765fb5d618a3 Catalin(ux) M. BOIE 2021-11-14 05:58:03
commented request_slowlog_timeout 505877b567807e11f25695de58725f316f10043e Catalin(ux) M. BOIE 2021-11-13 17:32:46
systemctl git.socket rethinking 3c71e58760f6abc69db661098840c277d4fc13fb Catalin(ux) M. BOIE 2021-11-13 17:25:52
PHP FALSE verus NULL correction 42f8bc560a0ec2203f0974e203e6c33ec26aa983 Catalin(ux) M. BOIE 2021-11-13 16:31:33
Commit 548c8a909c994ef528c9910c625e6afb88beeead - Cosmetic
Author: Catalin(ux) M. BOIE
Author date (UTC): 2022-02-16 18:44
Committer name: Catalin(ux) M. BOIE
Committer date (UTC): 2022-02-16 18:44
Parent(s): 722ca672abf6f28109e35f3573dca7e367d3b51a
Signer:
Signing key:
Signing status: N
Tree: 9ca43d3b49cf20b8fa475c28c36e228cd4d4c3db
File Lines added Lines deleted
History.txt 1 1
TODO 80 6
duilder 17 11
inc/admin.inc.php 2 2
inc/conn.inc.php 3 1
inc/events.inc.php 3 3
inc/plan.inc.php 0 1
inc/ratelimit.inc.php 2 2
inc/sql.inc.php 2 2
inc/state.inc.php 1 1
inc/totp.inc.php 1 1
inc/user.inc.php 3 1
inc/util.inc.php 149 33
root/index.php 6 8
root/themes/default/doc/demo/demos/ci-1/add_hook/main.html 23 5
scripts/builder.php 1 0
tests/by_http.php 15 15
tests/git.php 2 2
tests/git2.php 10 10
tests/git2_helper.sh 2 2
tests/git_big_push.php 4 5
tests/git_log1.expected 20 40
tests/git_log1.sh 1 1
tests/hook_update.sh 17 17
tests/http.inc.php 1 1
tests/http_settings.php 1 1
tests/mr.inc.php 1 1
tests/pr_anon.php 8 8
tests/source.php 10 9
tests/wh_cloud.git.sh 2 0
tests/wh_lambda.git.sh 17 0
tests/wh_lambda.php 3 3
File History.txt changed (mode: 100644) (index 554f955..6145f0a)
9 9 2016-02-24 - First unknown (to me) user created an account on rocketgit.com. 2016-02-24 - First unknown (to me) user created an account on rocketgit.com.
10 10 2016-04-04 - Announce RocketGit to RLUG (Romanian Linux User Group) (18:33) 2016-04-04 - Announce RocketGit to RLUG (Romanian Linux User Group) (18:33)
11 11 2018-06-04 - Microsoft buys GitHub 2018-06-04 - Microsoft buys GitHub
12 Some comments:
12 Some comment:
13 13 Rocketgit seems interesting. I saw it mentioned on kernel.org. Rocketgit seems interesting. I saw it mentioned on kernel.org.
14 14 The site is no-frills for sure it seems, although it is fast. It looks The site is no-frills for sure it seems, although it is fast. It looks
15 15 like it's got a lot of nice features, public or private repos, cloud like it's got a lot of nice features, public or private repos, cloud
File TODO changed (mode: 100644) (index 5fe4f3f..94c5865)
20 20 [ ] Enable disabled environments. [ ] Enable disabled environments.
21 21 [ ] [ ]
22 22
23 == next release ==
24 [ ] deb: keyring must be protected by download?! I think only the auth file, right?
25 [ ] test: gpg.php: does 3 selects from state table! Maybe cache is disabled?
26 [ ] echo "deb [signed-by=/usr/share/keyrings/rocketgit-priv1.gpg] https://rg.embedromix.ro:9003/op/pkgrepo/user/catab/priv1/stab/debian bullseye main" > /etc/apt/sources.list.d/rocketgit-priv1-stab.list
27 We need to add also username somewhere! Multiple users can have the same pkg repo!
28 FIXED - needs some testing!
29 [ ]
30
23 31 == Now == == Now ==
24 [ ] Release message:
25 ssh sk support
26 distro packages
27 More distributions and architectures added.
28 PHP 8
32 [ ] Full distro_info is sent when a job is sent to worker!
33 [ ] When I exec commands, seems there is always a 'sleep(1)' there.
34 Seen on VM stop, when making links to the image.
35 [ ] List also pkg repos where a user has access!
36 [ ] Show what wh will be run when pushing.
37 [ ] Allow a push to control environment for wh.
38 [ ] Add a wh for "delete repo"?
39 [ ] Allow individual package files to be downloaded.
40 [ ] Add info for deb/rpm + debug packages.
41 [ ] Seems pushing tags does not trigger a build!
42 [ ] Cloning by 'git'/'https' seems to not work (at least force_bind project):
43 warning: remote HEAD refers to nonexistent ref, unable to checkout.
44 [ ] Allow admins to set notifications (Matrix/Slack) for different operations.
45 [ ] Store rgfs traffic in job (maybe we need to charge it)?
46 [ ] Add cpu load/other stats per every block of output!
47 [ ] I am calling rg_env_info in several places, but I do not know if it is enabled or not.
48 [ ] On the main git repository page I should have a link to the pkg repo (if available).
49 [ ] User Packages page: tell the user that he needs to add a webhook.
50 Can we do it with a simple button press?
51 [ ] For conn type 'pkgrepo', repo_id is not set, at least for a repo keyring download!
52 [ ] We need to warn the users to be conservative with the project name
53 to be able to build packages for all distributions.
54 [ ] rpm: howto for installing debug packages for rpm.
55 [ ] Debian packages
56 [ ] list.json may contain sensitive information.
57 [ ] Probably I have to copy all fields from the control files.
58 == later ==
59 [ ] We can use also 'ssh://' for repositories!
60 [ ] Move stuff from 'build_one' to 'build' if is better.
61 [ ] .debc files may be generated before the copy per repo?
62 [ ] Why I need InRelease.json? I can load InRelease directly!
63 [ ] 'username'/'repo_id' files in '+pending' may be not needed - we have this info in the job.
64 [ ] 'apt' sends 'HTTP_IF_MODIFIED_SINCE' - use it!
65 [ ] Support diff files - one per day?
66 [ ] I should create checksums in the VM, not on the server. Trust?
67 [ ] Do look-up by hash? Any gain? [InRelease: Acquire-By-Hash: yes]
68 [ ] ubuntu: we may need other command to install debug packages (.ddeb).
69 What about source packages?
70 [ ] rgfs: we should not update meta on 'write' if was already stored.
71 Now we are rewriting the meta! Maybe having a 'create' is enough. We ignore 'write'.
29 72 [ ] [ ]
30 73
31 74 == hook update == hook update
 
60 103 Seems we are cloning the namespace, before knowing if the user can push! Seems we are cloning the namespace, before knowing if the user can push!
61 104
62 105 == FOR OTHER RELEASE == == FOR OTHER RELEASE ==
106 [ ] Comunicate the load of the workers (already done?) and choose a worker
107 based on load?
108 [ ] Add also the number of the packages to pkg_repos table.
109 [ ] For http hooks, add a header to allow people to report abuses.
110 Maybe directly a link which will lock the webhook and the
111 user ability to add more webhooks?
112 [ ] builder on rg2 keeps saying "0 workers" till restart. worker restart does not help.
113 A keepalive machanism should be implemented? Already is.
114 Let's see if it is fixed with an update.
115 [ ] Build jobs must not be retried if the fail is in user area.
116 [ ] job 1756: "Cannot execute"
117 [ ] An internal error occurred. Please try again later. @@if("@@errmsg@@" != ""){{Details: @@errmsg@@}}
118 [ ] On rocketgit.com, I had to do a index on repo_history.
119 There are indexes on repo_history_yyyy_mm, but not on the parent table, which has a lot of data!
120 I need to move that data!
121 Also, re-investigate CHECK to not search all partitions. We have CHECK!
122 Or, do incremental searches: if we already have 20 entries in the last repo_history_yyyy_mm,
123 do not search anymore. Also, a seq scan is used when the index is ok.
124 [ ] We should count also rate limit violations.
125 [ ] We may want to do ratelimit based on how much time a service was used, not by count!
126 Or, do by both!
127 [ ] pkg repo: should I show global ones in the user page?! I think not!
128 [ ] 'git push --set-upstream origin main' must be added to hints.
129 I need to see what variable to use for branch.
130 [ ] webhook: allow trigger by time.
131 [ ] Add possibility to "clean" the secrets, for some steps when we do not really trust?
132 [ ] perf: We should prepare the limit after we send the content to the user,
133 to not do a query before rendering any content.
134 [ ] When showing referer, show also the destination page.
135 [ ] Validate agains UTF-8 what is passed by the client and reject anything which is not ok.
136 [ ] repo page: add a link to the builds.
63 137 [ ] worker: allow any kind of package installation if the worker is of user type. [ ] worker: allow any kind of package installation if the worker is of user type.
64 138 [ ] Seems we install dependencies from spec file twice! [ ] Seems we install dependencies from spec file twice!
65 139 [ ] worker: should I tunnel rgfs over the worker connection? [ ] worker: should I tunnel rgfs over the worker connection?
 
... ... Seems we are cloning the namespace, before knowing if the user can push!
165 239 Maybe we should not allow renaming? Hm. Maybe we should not allow renaming? Hm.
166 240 [ ] Trigger a single build for global repos, not for every subrepo, like it is now. [ ] Trigger a single build for global repos, not for every subrepo, like it is now.
167 241 [ ] The match in 'meta' should be done by repo_id and not by strcmp. [ ] The match in 'meta' should be done by repo_id and not by strcmp.
168 [ ] 'howto' may be stored in distro_info, next to 'distro_pkg_type'?
242 [ ] 'howto' may be stored in distro_info, next to 'pkg_type'?
169 243 [ ] Why do I have things in 'pkg_repos/1/1/fedora/34/x86_64/os/+pending/catab'? [ ] Why do I have things in 'pkg_repos/1/1/fedora/34/x86_64/os/+pending/catab'?
170 244 [ ] repo pkg: hash password? [ ] repo pkg: hash password?
171 245 [ ] Do we need escaping for the link to the repo package? [ ] Do we need escaping for the link to the repo package?
File duilder changed (mode: 100755) (index 06fe006..e243861)
... ... fi
311 311
312 312
313 313 if [ ! -r duilder.conf ]; then if [ ! -r duilder.conf ]; then
314 echo "[*] You must build a duilder.conf file!"
315 exit 1
314 echo "[*] You do not have a duilder.conf file. Trying to continue."
315 else
316 source ${PWD}/duilder.conf 2>/dev/null
316 317 fi fi
317 318
318 source ${PWD}/duilder.conf
319 319
320 320 # fixes # fixes
321 321 if [ -z "${GIT_DEST}" ]; then if [ -z "${GIT_DEST}" ]; then
 
... ... if [ -z "${GIT_DEST}" ]; then
323 323 fi fi
324 324
325 325 if [ -z "${PRJ}" ]; then if [ -z "${PRJ}" ]; then
326 echo "ERROR: PRJ= parameter is missing."
327 exit 1
326 echo "WARN: PRJ= parameter is missing."
328 327 fi fi
329 328
330 329 if [ -z "${VER}" ]; then if [ -z "${VER}" ]; then
331 echo "ERROR: VER= parameter is missing."
332 exit 1
330 echo "WARN: VER= parameter is missing."
333 331 fi fi
334 332
335 333 if [ -z "${REV}" ]; then if [ -z "${REV}" ]; then
336 echo "ERROR: REV= parameter is missing."
337 exit 1
334 echo "WARN: REV= parameter is missing."
338 335 fi fi
339 336
340 337 # export variables - just in case a script cares # export variables - just in case a script cares
 
... ... else
545 542 echo "s#@NCURSES_FOUND@#1#g" >> tmp.sed echo "s#@NCURSES_FOUND@#1#g" >> tmp.sed
546 543 fi fi
547 544
548 if [ -n "${CC_SWITCHES}" ]; then
545 if [ "${CC_SWITCHES}" = "" ]; then
546 CC_SWITCHES="-O3 -fstack-reuse=all -flto -Wtrampolines -Wl,-z,noexecstack -Wl,-z,now -Wl,-z,relro -Wl,-O1 -Wl,-z,noexecstack -fPIE -pie -fstack-protector-all -Wcast-align -Wformat=2 -Wformat-security -fno-common -Wmissing-prototypes -Wmissing-declarations -Wstrict-overflow -Wstrict-prototypes -fno-guess-branch-probability -fbounds-check -Wl,-O3 -Wpadded -ftree-loop-distribution -ftree-vectorize -ftree-loop-if-convert -ftree-loop-im -ftree-parallelize-loops=4 -fcf-protection -fstack-clash-protection -Wimplicit-fallthrough -fanalyzer"
547 fi
548
549 if [ "1" = "1" ]; then
549 550 _CC_SWITCHES="" _CC_SWITCHES=""
550 551 echo "[*] Search for valid compiler flags..." echo "[*] Search for valid compiler flags..."
551 552 add="" add=""
552 553 for s in ${CC_SWITCHES}; do for s in ${CC_SWITCHES}; do
553 554 echo -n " [*] Testing switch [${s}]..." echo -n " [*] Testing switch [${s}]..."
555 case ${s} in
556 -Wformat-security) extra=" -Wformat" ;;
557 *) extra="" ;;
558 esac
554 559 set +e set +e
555 echo "int main(void) { return 0; }" | gcc ${s} -x c -pipe - -o /dev/null 2>/dev/null
560 echo "int main(void) { return 0; }" \
561 | gcc ${extra} ${s} -x c -pipe - -o /dev/null 2>>duilder.log
556 562 E=${?} E=${?}
557 563 set -e set -e
558 564 if [ "${E}" != "0" ]; then if [ "${E}" != "0" ]; then
File inc/admin.inc.php changed (mode: 100644) (index 7709d32..7265544)
... ... function rg_admin_mails_users_one($db, $ev)
81 81 { {
82 82 global $rg_admin_email, $rg_admin_name; global $rg_admin_email, $rg_admin_name;
83 83
84 rg_log_ml('admin_mails_users_one: ev: ' . print_r($ev, TRUE));
84 rg_log_debug('admin_mails_users_one: ev: ' . rg_array2string_short($ev));
85 85
86 86 $admin_name = '=?UTF-8?B?' $admin_name = '=?UTF-8?B?'
87 87 . base64_encode($rg_admin_name) . '?='; . base64_encode($rg_admin_name) . '?=';
 
... ... function rg_admin_mails_users($db, $ev)
111 111 { {
112 112 $ret = array(); $ret = array();
113 113
114 //rg_log_ml('admin_mails_users: ev: ' . print_r($ev, TRUE));
114 //rg_log_debug('admin_mails_users: ev: ' . rg_array2string_short($ev);
115 115
116 116 $sql = 'SELECT uid, username, email, disk_used_mb' $sql = 'SELECT uid, username, email, disk_used_mb'
117 117 . ', git_mb, artifacts_mb, realname' . ', git_mb, artifacts_mb, realname'
File inc/conn.inc.php changed (mode: 100644) (index 8dbb43f..d36d71f)
... ... function rg_conn_destroy($key)
50 50 rg_log($key . ': bytes_recv=' . $rg_conns[$key]['bytes_recv'] rg_log($key . ': bytes_recv=' . $rg_conns[$key]['bytes_recv']
51 51 . ' bytes_sent=' . $rg_conns[$key]['bytes_sent']); . ' bytes_sent=' . $rg_conns[$key]['bytes_sent']);
52 52
53 if ($rg_conns[$key]['exit_on_close'])
53 if ($rg_conns[$key]['exit_on_close']) {
54 rg_log($key . ': exit_on_close is set, so exit');
54 55 exit(1); exit(1);
56 }
55 57
56 58 if (isset($rg_conns[$key]['func_destroy'])) if (isset($rg_conns[$key]['func_destroy']))
57 59 $rg_conns[$key]['func_destroy']($key); $rg_conns[$key]['func_destroy']($key);
File inc/events.inc.php changed (mode: 100644) (index 411f82e..0ddfde0)
... ... function rg_event_add($db, $ev)
96 96
97 97 rg_prof_start('event_add'); rg_prof_start('event_add');
98 98 rg_log_enter('event_add category=' . $ev['category']); rg_log_enter('event_add category=' . $ev['category']);
99 //rg_log_debug('ev: ' . print_r($ev, TRUE));
99 //rg_log_debug('ev: ' . rg_array2string_short($ev));
100 100
101 101 if (!isset($ev['ui_login'])) if (!isset($ev['ui_login']))
102 102 $ev['ui_login'] = rg_ui_login(); $ev['ui_login'] = rg_ui_login();
 
... ... function rg_event_process($db, $ev_id, $event)
149 149 $rollback = FALSE; $rollback = FALSE;
150 150 do { do {
151 151 rg_debug_set($event['debug']); rg_debug_set($event['debug']);
152 rg_log_debug('ev: ' . print_r($event, TRUE));
152 rg_log_debug('ev: ' . rg_array2string_short($event));
153 153
154 154 if (isset($event['ui_login'])) if (isset($event['ui_login']))
155 155 rg_ui_login_set($event['ui_login']); rg_ui_login_set($event['ui_login']);
 
... ... function rg_event_process($db, $ev_id, $event)
168 168 $rollback = TRUE; $rollback = TRUE;
169 169
170 170 $f = $rg_event_split_functions[$category]; $f = $rg_event_split_functions[$category];
171 rg_log("Calling $f...");
171 rg_log_debug('Calling ' . $f . '...');
172 172 $evs = $f($db, $event); $evs = $f($db, $event);
173 173 if ($evs === FALSE) { if ($evs === FALSE) {
174 174 rg_event_set_error('Error in function [' rg_event_set_error('Error in function ['
File inc/plan.inc.php changed (mode: 100644) (index 585e964..6e7db52)
... ... function rg_plan_edit_high_level($db, &$rg)
382 382 return $ret; return $ret;
383 383 } }
384 384
385 ?>
File inc/ratelimit.inc.php changed (mode: 100644) (index aa332f8..4b41b5f)
12 12 */ */
13 13 function rg_rate_limit($db) function rg_rate_limit($db)
14 14 { {
15 rg_log_enter('rate_limit');
15 rg_prof_start('rate_limit');
16 16
17 17 $ret = -1; $ret = -1;
18 18 do { do {
 
... ... function rg_rate_limit($db)
60 60 $ret = $limit - $row['count']; $ret = $limit - $row['count'];
61 61 } while (0); } while (0);
62 62
63 rg_log_exit();
63 rg_prof_end('rate_limit');
64 64 return $ret; return $ret;
65 65 } }
File inc/sql.inc.php changed (mode: 100644) (index c2c209d..f35949c)
... ... function rg_sql_query_params_ignore($h, $sql, $params, $ignore, &$ignore_kicked)
290 290
291 291 if ($rg_sql_debug > 0) if ($rg_sql_debug > 0)
292 292 rg_log_enter('sql_query_params: sql=[' . $sql . ']' rg_log_enter('sql_query_params: sql=[' . $sql . ']'
293 . ' params=[' . rg_array2string($params) . ']'
293 . ' params=[' . rg_array2string_short($params) . ']'
294 294 . (empty($ignore) ? '' : ' ignore=' . implode(',', $ignore))); . (empty($ignore) ? '' : ' ignore=' . implode(',', $ignore)));
295 295
296 296 $ret = FALSE; $ret = FALSE;
 
... ... function rg_sql_query_params_ignore($h, $sql, $params, $ignore, &$ignore_kicked)
314 314 } }
315 315 } }
316 316 //rg_log("new sql: $sql"); //rg_log("new sql: $sql");
317 //rg_log("params2: " . rg_array2string($params2));
317 //rg_log("params2: " . rg_array2string_short($params2));
318 318
319 319 $start_ts = microtime(TRUE); $start_ts = microtime(TRUE);
320 320 $r = @pg_send_query_params($db, $sql, $params2); $r = @pg_send_query_params($db, $sql, $params2);
File inc/state.inc.php changed (mode: 100644) (index 3934dfe..3b14660)
... ... function rg_state_get($db, $var)
41 41 $ret = $r; $ret = $r;
42 42 break; break;
43 43 } }
44 // So, we get an error from the cache daemon.
44 // So, we got an error from the cache daemon.
45 45 // The only way is to go to database directly. // The only way is to go to database directly.
46 46
47 47 $params = array(); $params = array();
File inc/totp.inc.php changed (mode: 100644) (index b2ef532..61acea3)
... ... function rg_totp_sc_remove($db, $uid, $itime, $token)
935 935
936 936 $ret = FALSE; $ret = FALSE;
937 937 while (1) { while (1) {
938 $params = array('uid' => $uid ,
938 $params = array('uid' => $uid,
939 939 'itime' => $itime, 'itime' => $itime,
940 940 'token' => $token); 'token' => $token);
941 941 $sql = 'DELETE FROM scratch_codes' $sql = 'DELETE FROM scratch_codes'
File inc/user.inc.php changed (mode: 100644) (index bb99223..c6a9323)
... ... function rg_user_over_limit($db, $ui, &$max)
1872 1872 { {
1873 1873 $pi = rg_plan_info($db, $ui['plan_id']); $pi = rg_plan_info($db, $ui['plan_id']);
1874 1874 if ($pi['exists'] != 1) { if ($pi['exists'] != 1) {
1875 rg_internal_error("Invalid plan.");
1875 rg_internal_error('Invalid plan id ' . $ui['plan_id'] . '.');
1876 1876 return FALSE; return FALSE;
1877 1877 } }
1878 1878
 
... ... function rg_user_http_git($db, $rg, $paras)
2441 2441 header('Pragma: no-cache'); header('Pragma: no-cache');
2442 2442 header('Cache-Control: no-cache, max-age=0, must-revalidate'); header('Cache-Control: no-cache, max-age=0, must-revalidate');
2443 2443 header('Content-Type: text/plain'); header('Content-Type: text/plain');
2444 rg_debug() && header('X-RocketGit-skip-etag: 1');
2445 rg_debug() && header('X-RocketGit-skip-compression: 1');
2444 2446
2445 2447 // If user is valid, retry auth. // If user is valid, retry auth.
2446 2448 // If user is not valid, consider anonymous. // If user is not valid, consider anonymous.
File inc/util.inc.php changed (mode: 100644) (index 99ea0b9..eebb4ab)
... ... function rg_lock($file, $flags)
183 183 if (!isset($rg_lock_dir)) if (!isset($rg_lock_dir))
184 184 $rg_lock_dir = "/var/lib/rocketgit/locks"; $rg_lock_dir = "/var/lib/rocketgit/locks";
185 185
186 if (strncmp($file, '/', 1) == 0) // full path lock
187 $lock_file = $file;
188 else
189 $lock_file = $rg_lock_dir . '/' . $file;
190
186 191 // Double locking? // Double locking?
187 192 if (isset($_lock[$file])) { if (isset($_lock[$file])) {
188 rg_util_set_error('double locking error [' . $file . ']');
193 rg_util_set_error('double locking error [' . $lock_file . ']');
189 194 return FALSE; return FALSE;
190 195 } }
191 196
192 $f = @fopen($rg_lock_dir . "/" . $file, "w");
197 $f = @fopen($lock_file, "w");
193 198 if ($f === FALSE) { if ($f === FALSE) {
194 rg_util_set_error('cannot open lock [' . $file . ']: '
199 rg_util_set_error('cannot open lock [' . $lock_file . ']: '
195 200 . rg_php_err()); . rg_php_err());
196 201 return FALSE; return FALSE;
197 202 } }
 
... ... function rg_lock($file, $flags)
201 206 $x &= ~LOCK_NB; $x &= ~LOCK_NB;
202 207 if (!@flock($f, $x, $wouldblock)) { if (!@flock($f, $x, $wouldblock)) {
203 208 if ($wouldblock == 1) if ($wouldblock == 1)
204 rg_util_set_error('lock already locked [' . $file . ']');
209 rg_util_set_error('lock already locked [' . $lock_file . ']');
205 210 else else
206 rg_util_set_error('cannot lock [' . $file . ']: '
211 rg_util_set_error('cannot lock [' . $lock_file . ']: '
207 212 . rg_php_err()); . rg_php_err());
208 213 fclose($f); fclose($f);
209 214 return FALSE; return FALSE;
 
... ... function rg_lock($file, $flags)
212 217 fwrite($f, getmypid() . "\n"); fwrite($f, getmypid() . "\n");
213 218
214 219 $_lock[$file] = $f; $_lock[$file] = $f;
215 rg_log('Lock acquired [' . $file . ']');
220 rg_log_debug('Lock acquired [' . $file . ']');
216 221
217 222 return TRUE; return TRUE;
218 223 } }
 
... ... function rg_unlock($file)
233 238 } }
234 239
235 240 fclose($_lock[$file]); fclose($_lock[$file]);
236 rg_log('Lock unlocked [' . $file . ']');
241 rg_log_debug('Lock unlocked [' . $file . ']');
237 242 unset($_lock[$file]); unset($_lock[$file]);
238 243 } }
239 244
240 245 /* /*
241 * Returns information bout memory usage of the OS
246 * Returns information about memory usage of the OS
242 247 */ */
243 248 function rg_memory() function rg_memory()
244 249 { {
 
... ... function rg_template_table($dir, &$data, $more)
1150 1155 } }
1151 1156
1152 1157 if (!is_array($data) || empty($data)) { if (!is_array($data) || empty($data)) {
1153 $ret = rg_template($xdir . "/nodata.html", $more, TRUE /* xss */);
1158 $ret = rg_template($xdir . "/nodata.html", $more, TRUE /*xss*/);
1154 1159 rg_prof_end('template_table'); rg_prof_end('template_table');
1155 1160 return $ret; return $ret;
1156 1161 } }
 
... ... function rg_exec2_helper_gzip_in(&$info)
1292 1297 $do_exit = FALSE; $do_exit = FALSE;
1293 1298 do { do {
1294 1299 $rg_util_debug && $rg_util_debug &&
1295 rg_log(' calling inflate_add with buf[0-31]=' . substr($info['out_buf'], 0, 32) . (!empty($info['out_buf']) ? '' : ' and ZLIB_FINISH'));
1300 rg_log_debug(' calling inflate_add with buf[0-31]=' . substr($info['out_buf'], 0, 32) . (!empty($info['out_buf']) ? '' : ' and ZLIB_FINISH'));
1296 1301 if (!empty($info['out_buf'])) if (!empty($info['out_buf']))
1297 1302 $r = inflate_add($info['gzip_in_ctx'], $info['out_buf']); $r = inflate_add($info['gzip_in_ctx'], $info['out_buf']);
1298 1303 else else
 
... ... function rg_exec2_helper_gzip_in(&$info)
1319 1324 return FALSE; return FALSE;
1320 1325 } }
1321 1326 $rg_util_debug && $rg_util_debug &&
1322 rg_log(' gzip_in_bytes=' . $info['gzip_in_bytes'] . ' read_len=' . $rl);
1327 rg_log_debug(' gzip_in_bytes=' . $info['gzip_in_bytes'] . ' read_len=' . $rl);
1323 1328
1324 1329 $diff = $rl - $info['gzip_in_bytes']; $diff = $rl - $info['gzip_in_bytes'];
1325 1330 $info['gzip_in_bytes'] = $rl; $info['gzip_in_bytes'] = $rl;
 
... ... function rg_exec2_helper_gzip_in(&$info)
1330 1335 } else { } else {
1331 1336 unset($info['gzip_in_ctx']); unset($info['gzip_in_ctx']);
1332 1337 if ($s === FALSE) if ($s === FALSE)
1333 rg_log(' status is FALSE');
1338 rg_log_debug(' status is FALSE');
1334 1339 else if ($s === ZLIB_BUF_ERROR) else if ($s === ZLIB_BUF_ERROR)
1335 rg_log(' status is ZLIB_BUF_ERROR');
1340 rg_log_debug(' status is ZLIB_BUF_ERROR');
1336 1341 else else
1337 rg_log(' status is unknown [' . $s . ']');
1342 rg_log_debug(' status is unknown [' . $s . ']');
1338 1343 return FALSE; return FALSE;
1339 1344 } }
1340 1345
1341 1346 $rg_util_debug && $rg_util_debug &&
1342 rg_log(' decompression produced: [' . $r . '] out_buf=' . $info['out_buf']);
1347 rg_log_debug(' decompression produced: [' . $r . '] out_buf=' . $info['out_buf']);
1343 1348 } while (!$do_exit); } while (!$do_exit);
1344 1349
1345 1350 $info['out_buf_real'] .= $r; $info['out_buf_real'] .= $r;
 
... ... function rg_callback_hexa($matches)
1906 1911 /* /*
1907 1912 * Transforms an array into a string * Transforms an array into a string
1908 1913 */ */
1909 function rg_array2string($a)
1914 function rg_array2string_avoid($a, $avoid)
1910 1915 { {
1911 $what = array("/[^\pL\pN\pP\pS ]/uU");
1916 $what = array('/[^\pL\pN\pP\pS ]/uU');
1912 1917
1913 1918 if (!is_array($a)) if (!is_array($a))
1914 return preg_replace_callback($what, "rg_callback_hexa", $a);
1919 return preg_replace_callback($what, 'rg_callback_hexa', $a);
1915 1920
1916 1921 if (empty($a)) if (empty($a))
1917 return "";
1922 return '';
1918 1923
1919 $ret = "";
1920 $add = "";
1924 $ret = '';
1925 $add = '';
1921 1926 foreach ($a as $k => $v) { foreach ($a as $k => $v) {
1922 if (is_array($v))
1923 $s = rg_array2string($v);
1927 if (in_array($k, $avoid)) {
1928 $s = '-';
1929 } else if (is_array($v))
1930 $s = rg_array2string_short($v);
1924 1931 else if (is_resource($v)) else if (is_resource($v))
1925 1932 $s = 'RES'; $s = 'RES';
1926 1933 else else
1927 $s = preg_replace_callback($what, "rg_callback_hexa", $v);
1928 $ret .= $add . "$k=[$s]";
1929 $add = " ";
1934 $s = preg_replace_callback($what, 'rg_callback_hexa', $v);
1935
1936 $ret .= $add . $k . '=[' . $s . ']';
1937 $add = ' ';
1930 1938 } }
1931 1939
1932 1940 return $ret; return $ret;
1933 1941 } }
1934 1942
1943 function rg_array2string_short($a)
1944 {
1945 $f = array('gpg_pub_key', 'gpg_priv_key', 'rgfs_key', 'ssh_key',
1946 'key', 'last_output', 'client_ca_cert');
1947 return rg_array2string_avoid($a, $f);
1948 }
1949
1950 /*
1951 * Transforms an array into a string
1952 */
1953 function rg_array2string($a)
1954 {
1955 return rg_array2string_avoid($a, array());
1956 }
1957
1935 1958 /* /*
1936 1959 * Load files from a folder using a pattern for match * Load files from a folder using a pattern for match
1937 1960 */ */
 
... ... function rg_array_top($a, $nr)
2907 2930 } }
2908 2931
2909 2932 /* /*
2910 * Save a serialized array
2933 * Save a file (safe version)
2911 2934 */ */
2912 function rg_save($file, $a)
2935 function rg_save_plain($file, $a)
2913 2936 { {
2914 $r = @file_put_contents($file . '.tmp', rg_serialize($a));
2937 $r = @file_put_contents($file . '.tmp', $a);
2915 2938 if ($r === FALSE) { if ($r === FALSE) {
2916 2939 rg_internal_error('Cannot save file: ' . rg_php_err()); rg_internal_error('Cannot save file: ' . rg_php_err());
2917 2940 return FALSE; return FALSE;
 
... ... function rg_save($file, $a)
2927 2950 return TRUE; return TRUE;
2928 2951 } }
2929 2952
2953 /*
2954 * Save a serialized array
2955 */
2956 function rg_save($file, $a)
2957 {
2958 return rg_save_plain($file, rg_serialize($a));
2959 }
2960
2930 2961 /* /*
2931 2962 * Returns TRUE if we detect that the User-Agent seems a bot * Returns TRUE if we detect that the User-Agent seems a bot
2932 2963 */ */
 
... ... function rg_is_bot($ua)
2948 2979 if (strstr($ua, 'CCBot/')) return TRUE; if (strstr($ua, 'CCBot/')) return TRUE;
2949 2980 if (strstr($ua, ' CensysInspect/')) return TRUE; if (strstr($ua, ' CensysInspect/')) return TRUE;
2950 2981 if (strstr($ua, 'CISPA Webcrawler ')) return TRUE; if (strstr($ua, 'CISPA Webcrawler ')) return TRUE;
2951 if (strstr($ua, 'clark-Crowler2/')) return TRUE;
2982 if (strstr($ua, 'clark-crawler2/')) return TRUE;
2952 2983 if (strstr($ua, ' Cliqzbot/')) return TRUE; if (strstr($ua, ' Cliqzbot/')) return TRUE;
2953 2984 if (strstr($ua, ' coccocbot-web')) return TRUE; if (strstr($ua, ' coccocbot-web')) return TRUE;
2954 2985 if (strstr($ua, ' DataForSeoBot/')) return TRUE; if (strstr($ua, ' DataForSeoBot/')) return TRUE;
 
... ... function rg_dir_size($dir)
3280 3311 /* /*
3281 3312 * Creates all needed directories in a path to a file (NOT a dir) * Creates all needed directories in a path to a file (NOT a dir)
3282 3313 */ */
3283 function rg_create_dirs($path)
3314 function rg_create_dirs($path, $mode)
3284 3315 { {
3285 3316 $ret = array('ok' => 0); $ret = array('ok' => 0);
3286 3317 do { do {
 
... ... function rg_create_dirs($path)
3292 3323
3293 3324 if (strcmp($d, '.') != 0) { if (strcmp($d, '.') != 0) {
3294 3325 // Try to create the parent // Try to create the parent
3295 $ret = rg_create_dirs($d);
3326 $ret = rg_create_dirs($d, $mode);
3296 3327 if ($ret['ok'] != 1) if ($ret['ok'] != 1)
3297 3328 break; break;
3298 3329 } }
 
... ... function rg_create_dirs($path)
3303 3334 break; break;
3304 3335 } }
3305 3336
3306 $r = @mkdir($d, 0700);
3337 $r = @mkdir($d, $mode);
3307 3338 if ($r === FALSE) { if ($r === FALSE) {
3308 3339 $ret['errmsg'] = rg_php_err(); $ret['errmsg'] = rg_php_err();
3309 3340 break; break;
 
... ... function rg_debug_html_set($k, $v)
3352 3383 { {
3353 3384 global $rg_debug_html; global $rg_debug_html;
3354 3385
3386 if (rg_debug() == 0)
3387 return;
3388
3355 3389 //rg_log_debug('rg_debug_html_set called [' . $k . '] [' . rg_array2string($v) . ']'); //rg_log_debug('rg_debug_html_set called [' . $k . '] [' . rg_array2string($v) . ']');
3356 3390 $rg_debug_html[$k] = $v; $rg_debug_html[$k] = $v;
3357 3391 } }
 
... ... function rg_debug_html($junk)
3374 3408 return $ret; return $ret;
3375 3409 } }
3376 3410 rg_template_func('RG_DEBUG_HTML', 'rg_debug_html'); rg_template_func('RG_DEBUG_HTML', 'rg_debug_html');
3411
3412 /*
3413 * Loads a .sha256 hash file or generate one
3414 * TODO: test if file is more recent than hash file!
3415 */
3416 function rg_hash_load($hash, $f)
3417 {
3418 $ret = array('ok' => 0);
3419 do {
3420 $r = @stat($f);
3421 if ($r === FALSE) {
3422 $ret['errmsg'] = 'cannot stat file';
3423 break;
3424 }
3425 $ret['size'] = $r['size'];
3426
3427 $mtime = $r['mtime'];
3428
3429 $r = @file_get_contents($f . '.' . $hash);
3430 if ($r !== FALSE) {
3431 $x = explode(' ', $r);
3432 if (isset($x[1]) && ($mtime == $x[1])) {
3433 $ret['hash'] = $x[0];
3434 $ret['ok'] = 1;
3435 break;
3436 }
3437 }
3438
3439 $r = hash_file($hash, $f);
3440 if ($r === FALSE) {
3441 $ret['errmsg'] = 'cannot create hash';
3442 break;
3443 }
3444 $ret['hash'] = $r;
3445 $ret['ok'] = 1;
3446
3447 @file_put_contents($f . '.' . $hash, $ret['hash']);
3448 // we ignore errors here
3449 } while (0);
3450
3451 return $ret;
3452 }
3453
3454 /*
3455 * XZ compress a file
3456 */
3457 function rg_xz_compress($f, $extra)
3458 {
3459 rg_log_enter('xz_compress: f=' . $f);
3460
3461 $ret = array('ok' => 0);
3462 do {
3463 $a = array(
3464 'cmds' => array(
3465 'cmd1' => array(
3466 'cmd' => 'xz ' . $extra . ' ' . escapeshellarg($f)
3467 )
3468 )
3469 );
3470
3471 $r = rg_exec2($a);
3472 if (($r['ok'] != 1) || ($r['cmds']['cmd1']['exitcode'] != 0)) {
3473 $ret['errmsg'] = $r['cmds']['cmd1']['last_errmsg']
3474 . ' [' . $r['cmds']['cmd1']['err_buf'];
3475 break;
3476 }
3477
3478 $ret['ok'] = 1;
3479 } while (0);
3480
3481 rg_log_exit();
3482 return $ret;
3483 }
3484
3485 /*
3486 * Remove dir2 from dir2 to obtain a relative path
3487 */
3488 function rg_dir_cut($dir1, $dir2)
3489 {
3490 return substr($dir1, strlen($dir2));
3491 }
3492
File root/index.php changed (mode: 100644) (index 3ecfb2e..6f170f0)
... ... if (!empty($_COOKIE))
109 109
110 110 //rg_log_ml('_SERVER: ' . print_r($_SERVER, TRUE)); //rg_log_ml('_SERVER: ' . print_r($_SERVER, TRUE));
111 111 $_list = array('SERVER_PROTOCOL', 'HTTP_CACHE_CONTROL', $_list = array('SERVER_PROTOCOL', 'HTTP_CACHE_CONTROL',
112 'HTTP_IF_NONE_MATCH', 'HTTP_REFERER',
112 'HTTP_IF_NONE_MATCH', 'HTTP_ETAG', 'HTTP_REFERER',
113 113 'HTTP_ACCEPT_ENCODING', 'HTTP_USER_AGENT', 'HTTP_HOST', 'HTTP_ACCEPT_ENCODING', 'HTTP_USER_AGENT', 'HTTP_HOST',
114 114 'CONTENT_LENGTH', 'CONTENT_TYPE', 'HTTP_RANGE'); 'CONTENT_LENGTH', 'CONTENT_TYPE', 'HTTP_RANGE');
115 115 foreach ($_list as $k) { foreach ($_list as $k) {
116 116 if (isset($_SERVER[$k]) && !empty($_SERVER[$k])) if (isset($_SERVER[$k]) && !empty($_SERVER[$k]))
117 117 rg_log($k . ': ' . $_SERVER[$k]); rg_log($k . ': ' . $_SERVER[$k]);
118 118 } }
119 // Try to detect if we cloning by http(s)
119 // Try to detect if we are cloning by http(s)
120 120 $rg['ct'] = isset($_SERVER['CONTENT_TYPE']) ? $_SERVER['CONTENT_TYPE'] : ''; $rg['ct'] = isset($_SERVER['CONTENT_TYPE']) ? $_SERVER['CONTENT_TYPE'] : '';
121 121
122 122
 
... ... $r = rg_user_http_git($db, $rg, $paras);
218 218 if ($r === TRUE) { if ($r === TRUE) {
219 219 rg_stats_conns_set('type', 'git-over-http'); rg_stats_conns_set('type', 'git-over-http');
220 220 $skip_etag = TRUE; $skip_etag = TRUE;
221 rg_debug() && header('X-RocketGit-skip-etag: 1');
222 221 $skip_compression = TRUE; $skip_compression = TRUE;
223 rg_debug() && header('X-RocketGit-skip-compression: 1');
224 222 } else if (strcmp($_op, 'pkgrepo') == 0) { } else if (strcmp($_op, 'pkgrepo') == 0) {
225 223 // This section is called by 'dnf' & co. // This section is called by 'dnf' & co.
226 224 rg_log_ml('_SERVER: ' . print_r($_SERVER, TRUE)); rg_log_ml('_SERVER: ' . print_r($_SERVER, TRUE));
 
... ... rg_stats_conns_insert($db);
388 386
389 387 rg_prof_log(); rg_prof_log();
390 388
391 if (rg_debug()) {
392 $o = @opcache_get_status();
393 rg_log('opcache[jit]: ' . print_r($o['jit'], TRUE));
394 }
389 //if (rg_debug()) {
390 // $o = @opcache_get_status();
391 // rg_log_ml('opcache[jit]: ' . print_r($o['jit'], TRUE));
392 //}
395 393
File root/themes/default/doc/demo/demos/ci-1/add_hook/main.html changed (mode: 100644) (index 7067fa3..dfd6219)
... ... The next step is to add a webhook that will trigger our test and deploy
4 4 phases when a push is taking place.<br /> phases when a push is taking place.<br />
5 5 <br /> <br />
6 6 To add this hook, you have to login and go to To add this hook, you have to login and go to
7 <b>Settings / Webhooks / Add</b> menu.<br />
8 Then, scroll to <b>build</b> type and click <b>Generic</b> link.<br />
7 <b>Settings / Webhooks / Add</b> <a href="/op/settings/wh/add" target="_blank">menu</a>.<br />
8 <br />
9
10 Scroll to <b>build</b> type and click <b>Generic</b> link.<br />
9 11 Now, you can choose what repository and branch we want to add this hook to. Now, you can choose what repository and branch we want to add this hook to.
10 12 Please note that both fields are regular expressions. So, with a single hook Please note that both fields are regular expressions. So, with a single hook
11 13 you can cover more/all repositories and branches.<br /> you can cover more/all repositories and branches.<br />
12 14 Just type your repository name. For branch, leave it empty, meaning that Just type your repository name. For branch, leave it empty, meaning that
13 15 any branch will trigger the hook.<br /> any branch will trigger the hook.<br />
16 <br />
17
14 18 Then, type a description to easy remember what the hook is for, for example: Then, type a description to easy remember what the hook is for, for example:
15 19 "This will deploy main.sh to the servers".<br /> "This will deploy main.sh to the servers".<br />
16 Now, you have to choose what events will trigger the hook:
20 <br />
21
22 If you need to pass some secrets to the build environment, fill them in the
23 <b>Secrets</b> area. Please note that after you save your changes, you will
24 not be able to see the secrets anymore, only to change them.<br />
25 To use them, just use them as environment variables.<br />
26 <br />
27
28 You have to choose what events will trigger the hook:
17 29 we will use <b>Push</b> event.<br /> we will use <b>Push</b> event.<br />
30 <br />
31
18 32 Next, you will have to choose a build environments. For our example, Next, you will have to choose a build environments. For our example,
19 33 we will use only one environment, 'debian-10-amd64'. we will use only one environment, 'debian-10-amd64'.
20 34 You will use multiple build environments when you want to be sure You will use multiple build environments when you want to be sure
21 35 your application will work across a full range of distributions and your application will work across a full range of distributions and
22 36 architectures combinations.<br /> architectures combinations.<br />
37 <br/>
38
23 39 Next, you will be able to specify what packages are needed to build and Next, you will be able to specify what packages are needed to build and
24 40 test your software. You can type 'bash' there, because we have a set of test your software. You can type 'bash' there, because we have a set of
25 41 bash scripts.<br /> bash scripts.<br />
26 Now, what is left is to specify what commands we want to execute.
42 <br />
43
44 What is left is to specify is which commands we want to execute.
27 45 First command will be './test.sh' and we will check the checkbox First command will be './test.sh' and we will check the checkbox
28 46 "Abort on fail?". Why? Because if the test does not pass, we will "Abort on fail?". Why? Because if the test does not pass, we will
29 not want to execute the deploy step.
47 not want to execute the deploy step.<br />
30 48 Optionally, you can add some labels which will be added to your last commit Optionally, you can add some labels which will be added to your last commit
31 49 in that branch.<br /> in that branch.<br />
32 50 For the second command you will type './deploy.sh'.<br /> For the second command you will type './deploy.sh'.<br />
File scripts/builder.php changed (mode: 100644) (index 3d49cf6..a434c4c)
... ... function job_save($job)
48 48 function xdestroy($key) function xdestroy($key)
49 49 { {
50 50 global $workers; global $workers;
51
51 52 $workers--; $workers--;
52 53 } }
53 54
File tests/by_http.php changed (mode: 100644) (index 4aa80be..33997a4)
... ... $commit_body = rg_id(32);
48 48 $a = rg_exec('rm -rf .by_http' $a = rg_exec('rm -rf .by_http'
49 49 . ' && mkdir .by_http' . ' && mkdir .by_http'
50 50 . ' && cd .by_http' . ' && cd .by_http'
51 . ' && git init'
51 . ' && git init --initial-branch=main'
52 52 . ' && git remote add public_repo ' . escapeshellarg($repo['clone_url_http']) . ' && git remote add public_repo ' . escapeshellarg($repo['clone_url_http'])
53 53 . ' && git remote add private_repo ' . escapeshellarg($repo2['clone_url_http']) . ' && git remote add private_repo ' . escapeshellarg($repo2['clone_url_http'])
54 54 . ' && git remote add private_repo_git ' . escapeshellarg($repo2['clone_url_git']) . ' && git remote add private_repo_git ' . escapeshellarg($repo2['clone_url_git'])
 
... ... rg_log('');
66 66 rg_log_enter('Trying to push to public (empty user)...'); rg_log_enter('Trying to push to public (empty user)...');
67 67 putenv('GIT_ASKPASS=' . dirname(__FILE__) . '/ask_pass_empty'); putenv('GIT_ASKPASS=' . dirname(__FILE__) . '/ask_pass_empty');
68 68 $r = rg_exec('cd .by_http' $r = rg_exec('cd .by_http'
69 . ' && ' . $git_push . ' public_repo master',
69 . ' && ' . $git_push . ' public_repo main',
70 70 '', FALSE, FALSE, FALSE); '', FALSE, FALSE, FALSE);
71 71 if ($r['ok'] == 1) { if ($r['ok'] == 1) {
72 72 rg_log_ml('r: ' . print_r($r, TRUE)); rg_log_ml('r: ' . print_r($r, TRUE));
 
... ... rg_log_exit();
84 84 rg_log(''); rg_log('');
85 85 rg_log_enter('Trying to push to public (with guest)...'); rg_log_enter('Trying to push to public (with guest)...');
86 86 putenv('GIT_ASKPASS=' . dirname(__FILE__) . '/ask_pass_guest'); putenv('GIT_ASKPASS=' . dirname(__FILE__) . '/ask_pass_guest');
87 $r = rg_exec('cd .by_http && ' . $git_push . ' public_repo master',
87 $r = rg_exec('cd .by_http && ' . $git_push . ' public_repo main',
88 88 '', FALSE, FALSE, FALSE); '', FALSE, FALSE, FALSE);
89 89 if ($r['ok'] != 1) { if ($r['ok'] != 1) {
90 90 rg_log_ml('r: ' . print_r($r, TRUE)); rg_log_ml('r: ' . print_r($r, TRUE));
 
... ... rg_log_exit();
102 102 rg_log(''); rg_log('');
103 103 rg_log_enter('Trying to push to public (with user/pass)...'); rg_log_enter('Trying to push to public (with user/pass)...');
104 104 putenv('GIT_ASKPASS=' . dirname(__FILE__) . '/ask_pass'); putenv('GIT_ASKPASS=' . dirname(__FILE__) . '/ask_pass');
105 $r = rg_exec('cd .by_http && ' . $git_push . ' public_repo master',
105 $r = rg_exec('cd .by_http && ' . $git_push . ' public_repo main',
106 106 '', FALSE, FALSE, FALSE); '', FALSE, FALSE, FALSE);
107 107 if ($r['ok'] != 1) { if ($r['ok'] != 1) {
108 108 rg_log_ml('r: ' . print_r($r, TRUE)); rg_log_ml('r: ' . print_r($r, TRUE));
 
... ... rg_log_exit();
115 115 rg_log(''); rg_log('');
116 116 rg_log_enter('Trying to fetch from public (with user/pass)...'); rg_log_enter('Trying to fetch from public (with user/pass)...');
117 117 putenv('GIT_ASKPASS=' . dirname(__FILE__) . '/ask_pass'); putenv('GIT_ASKPASS=' . dirname(__FILE__) . '/ask_pass');
118 $r = rg_exec('cd .by_http && git fetch --verbose public_repo master',
118 $r = rg_exec('cd .by_http && git fetch --verbose public_repo main',
119 119 '', FALSE, FALSE, FALSE); '', FALSE, FALSE, FALSE);
120 120 if ($r['ok'] != 1) { if ($r['ok'] != 1) {
121 121 rg_log_ml('r: ' . print_r($r, TRUE)); rg_log_ml('r: ' . print_r($r, TRUE));
 
... ... rg_log_exit();
127 127
128 128 rg_log(''); rg_log('');
129 129 rg_log_enter('Trying to fetch from private (by git://)...'); rg_log_enter('Trying to fetch from private (by git://)...');
130 $r = rg_exec('cd .by_http && git fetch --verbose private_repo_git master',
130 $r = rg_exec('cd .by_http && git fetch --verbose private_repo_git main',
131 131 '', FALSE, FALSE, FALSE); '', FALSE, FALSE, FALSE);
132 132 if ($r['ok'] == 1) { if ($r['ok'] == 1) {
133 133 rg_log_ml('r: ' . print_r($r, TRUE)); rg_log_ml('r: ' . print_r($r, TRUE));
 
... ... rg_log_exit();
140 140 rg_log(''); rg_log('');
141 141 rg_log_enter('Trying to push to private (guest user)...'); rg_log_enter('Trying to push to private (guest user)...');
142 142 putenv('GIT_ASKPASS=' . dirname(__FILE__) . '/ask_pass_guest'); putenv('GIT_ASKPASS=' . dirname(__FILE__) . '/ask_pass_guest');
143 $r = rg_exec('cd .by_http && ' . $git_push . ' private_repo master',
143 $r = rg_exec('cd .by_http && ' . $git_push . ' private_repo main',
144 144 '', FALSE, FALSE, FALSE); '', FALSE, FALSE, FALSE);
145 145 if ($r['ok'] == 1) { if ($r['ok'] == 1) {
146 146 rg_log_ml('r: ' . print_r($r, TRUE)); rg_log_ml('r: ' . print_r($r, TRUE));
 
... ... rg_log_exit();
159 159 rg_log(''); rg_log('');
160 160 rg_log_enter('Trying to push to private (with user/pass)...'); rg_log_enter('Trying to push to private (with user/pass)...');
161 161 putenv('GIT_ASKPASS=' . dirname(__FILE__) . '/ask_pass'); putenv('GIT_ASKPASS=' . dirname(__FILE__) . '/ask_pass');
162 $r = rg_exec('cd .by_http && ' . $git_push . ' private_repo master',
162 $r = rg_exec('cd .by_http && ' . $git_push . ' private_repo main',
163 163 '', FALSE, FALSE, FALSE); '', FALSE, FALSE, FALSE);
164 164 if ($r['ok'] != 1) { if ($r['ok'] != 1) {
165 165 rg_log_ml('r: ' . print_r($r, TRUE)); rg_log_ml('r: ' . print_r($r, TRUE));
 
... ... rg_log('key: ' . $key);
192 192 rg_log(''); rg_log('');
193 193 rg_log_enter('Trying to push to public (with user/pass/login_token_missing)...'); rg_log_enter('Trying to push to public (with user/pass/login_token_missing)...');
194 194 putenv('GIT_ASKPASS=' . dirname(__FILE__) . '/ask_pass'); putenv('GIT_ASKPASS=' . dirname(__FILE__) . '/ask_pass');
195 $r = rg_exec('cd .by_http && ' . $git_push . ' public_repo master',
195 $r = rg_exec('cd .by_http && ' . $git_push . ' public_repo main',
196 196 '', FALSE, FALSE, FALSE); '', FALSE, FALSE, FALSE);
197 197 if ($r['ok'] !== 0) { if ($r['ok'] !== 0) {
198 198 rg_log_ml('r: ' . print_r($r, TRUE)); rg_log_ml('r: ' . print_r($r, TRUE));
 
... ... rg_log_exit();
205 205 rg_log(''); rg_log('');
206 206 rg_log_enter('Trying to fetch from public (with user/pass/login_token_missing)...'); rg_log_enter('Trying to fetch from public (with user/pass/login_token_missing)...');
207 207 putenv('GIT_ASKPASS=' . dirname(__FILE__) . '/ask_pass'); putenv('GIT_ASKPASS=' . dirname(__FILE__) . '/ask_pass');
208 $r = rg_exec('cd .by_http && git fetch --verbose public_repo master',
208 $r = rg_exec('cd .by_http && git fetch --verbose public_repo main',
209 209 '', FALSE, FALSE, FALSE); '', FALSE, FALSE, FALSE);
210 210 if ($r['ok'] !== 1) { if ($r['ok'] !== 1) {
211 211 rg_log_ml('r: ' . print_r($r, TRUE)); rg_log_ml('r: ' . print_r($r, TRUE));
 
... ... rg_log('');
219 219 rg_log_enter('Trying to push to public (with user/pass/login_token_ok)...'); rg_log_enter('Trying to push to public (with user/pass/login_token_ok)...');
220 220 putenv('RG_LOGIN_TOKEN=' . rg_totp_compute($key, (time() - 30) / 30, 6)); putenv('RG_LOGIN_TOKEN=' . rg_totp_compute($key, (time() - 30) / 30, 6));
221 221 putenv('GIT_ASKPASS=' . dirname(__FILE__) . '/ask_pass'); putenv('GIT_ASKPASS=' . dirname(__FILE__) . '/ask_pass');
222 $r = rg_exec('cd .by_http && ' . $git_push . ' public_repo master',
222 $r = rg_exec('cd .by_http && ' . $git_push . ' public_repo main',
223 223 '', FALSE, FALSE, FALSE); '', FALSE, FALSE, FALSE);
224 224 if ($r['ok'] != 1) { if ($r['ok'] != 1) {
225 225 rg_log_ml('r: ' . print_r($r, TRUE)); rg_log_ml('r: ' . print_r($r, TRUE));
 
... ... rg_log('');
233 233 rg_log_enter('Trying to fetch from public (with user/pass/login_token_ok)...'); rg_log_enter('Trying to fetch from public (with user/pass/login_token_ok)...');
234 234 putenv('RG_LOGIN_TOKEN=' . rg_totp_compute($key, (time() - 0) / 30, 6)); putenv('RG_LOGIN_TOKEN=' . rg_totp_compute($key, (time() - 0) / 30, 6));
235 235 putenv('GIT_ASKPASS=' . dirname(__FILE__) . '/ask_pass'); putenv('GIT_ASKPASS=' . dirname(__FILE__) . '/ask_pass');
236 $r = rg_exec('cd .by_http && git fetch --verbose public_repo master',
236 $r = rg_exec('cd .by_http && git fetch --verbose public_repo main',
237 237 '', FALSE, FALSE, FALSE); '', FALSE, FALSE, FALSE);
238 238 if ($r['ok'] != 1) { if ($r['ok'] != 1) {
239 239 rg_log_ml('r: ' . print_r($r, TRUE)); rg_log_ml('r: ' . print_r($r, TRUE));
 
... ... rg_log_exit();
245 245
246 246
247 247 rg_log(''); rg_log('');
248 $commit = trim(file_get_contents('.by_http/.git/refs/heads/master'));
249 rg_log('master from .git: ' . $commit);
248 $commit = trim(file_get_contents('.by_http/.git/refs/heads/main'));
249 rg_log('main from .git: ' . $commit);
250 250 rg_log_enter('Checking on web that everything is OK...'); rg_log_enter('Checking on web that everything is OK...');
251 251 $data = array(); $data = array();
252 252 $headers = array(); $headers = array();
 
... ... $r = do_req($info, $test_url . '/user/' . rawurlencode($rg_ui['username'])
254 254 . '/' . rawurlencode($repo['name']) . '/source/log/commit/' . '/' . rawurlencode($repo['name']) . '/source/log/commit/'
255 255 . $commit, $data, $headers); . $commit, $data, $headers);
256 256 if ($r === FALSE) { if ($r === FALSE) {
257 rg_log('Cannot load master commit!');
257 rg_log('Cannot load main commit!');
258 258 exit(1); exit(1);
259 259 } }
260 260 if (!strstr($r['body'], $commit_body)) { if (!strstr($r['body'], $commit_body)) {
File tests/git.php changed (mode: 100644) (index a4b691f..42ee65b)
... ... $r = rg_exec('mkdir -p temp_repos'
22 22 . ' && rm -rf temp_repos/git_empty' . ' && rm -rf temp_repos/git_empty'
23 23 . ' && mkdir temp_repos/git_empty' . ' && mkdir temp_repos/git_empty'
24 24 . ' && cd temp_repos/git_empty' . ' && cd temp_repos/git_empty'
25 . ' && git init',
25 . ' && git init --initial-branch=main',
26 26 '', FALSE, FALSE, FALSE); '', FALSE, FALSE, FALSE);
27 27 if ($r['ok'] != 1) { if ($r['ok'] != 1) {
28 28 rg_log('Could not create repo: ' . $r['errmsg'] . '!'); rg_log('Could not create repo: ' . $r['errmsg'] . '!');
29 29 exit(1); exit(1);
30 30 } }
31 $r = rg_git_merge_base('temp_repos/git_empty', 'master',
31 $r = rg_git_merge_base('temp_repos/git_empty', 'main',
32 32 '3fa5ae7e933e33308a6f3ec70edcf2499c1914ac'); '3fa5ae7e933e33308a6f3ec70edcf2499c1914ac');
33 33 if ($r !== $rg_git_empty) { if ($r !== $rg_git_empty) {
34 34 rg_log('Test must return ' . $rg_git_empty . ' but returned: ' . $r); rg_log('Test must return ' . $rg_git_empty . ' but returned: ' . $r);
File tests/git2.php changed (mode: 100644) (index e03f299..7702f8b)
... ... rg_test_upload_ssh_key($db, $rg_ui, 'git2', $kn);
58 58
59 59
60 60 rg_log(''); rg_log('');
61 rg_log_enter('Trying to push master...');
61 rg_log_enter('Trying to push main...');
62 62 $remote = 'ssh://rocketgit@' . $rg_ssh_host . ':' .$rg_ssh_port $remote = 'ssh://rocketgit@' . $rg_ssh_host . ':' .$rg_ssh_port
63 63 . '/user/' . escapeshellarg($rg_ui['username']) . '/user/' . escapeshellarg($rg_ui['username'])
64 64 . '/' . escapeshellarg($repo['name']); . '/' . escapeshellarg($repo['name']);
65 65 $r = rg_exec("cd git2 && git remote add origin $remote" $r = rg_exec("cd git2 && git remote add origin $remote"
66 . " && git push origin master",
66 . " && git push origin main",
67 67 '', FALSE, FALSE, FALSE); '', FALSE, FALSE, FALSE);
68 68 if ($r['ok'] != 1) { if ($r['ok'] != 1) {
69 69 rg_log_ml('out: ' . print_r($r, TRUE)); rg_log_ml('out: ' . print_r($r, TRUE));
70 rg_log('Seems I cannot push master!');
70 rg_log('Seems I cannot push main!');
71 71 exit(1); exit(1);
72 72 } }
73 73 rg_log_exit(); rg_log_exit();
 
... ... rg_log_exit();
76 76 rg_log(''); rg_log('');
77 77 rg_log_enter('Go back one commit and try to push (must fail)...'); rg_log_enter('Go back one commit and try to push (must fail)...');
78 78 $r = rg_exec("cd git2 && git reset --hard HEAD^1" $r = rg_exec("cd git2 && git reset --hard HEAD^1"
79 . " && git push origin master",
79 . " && git push origin main",
80 80 '', FALSE, FALSE, FALSE); '', FALSE, FALSE, FALSE);
81 81 if ($r['ok'] == 1) { if ($r['ok'] == 1) {
82 rg_log('Seems I can push master and I must not!');
82 rg_log('Seems I can push main and I must not!');
83 83 exit(1); exit(1);
84 84 } }
85 85 if (!strstr($r['stderr'], 'tip of your current branch is behind')) { if (!strstr($r['stderr'], 'tip of your current branch is behind')) {
 
... ... rg_log_exit();
91 91
92 92 rg_log(''); rg_log('');
93 93 rg_log_enter('Go back one commit and try to push (force)...'); rg_log_enter('Go back one commit and try to push (force)...');
94 $r = rg_exec("cd git2 && git push --force origin master",
94 $r = rg_exec("cd git2 && git push --force origin main",
95 95 '', FALSE, FALSE, FALSE); '', FALSE, FALSE, FALSE);
96 96 if ($r['ok'] != 1) { if ($r['ok'] != 1) {
97 97 rg_log_ml('out: ' . $r['errmsg']); rg_log_ml('out: ' . $r['errmsg']);
98 rg_log("Seems I cannot force push the master! err=$err");
98 rg_log("Seems I cannot force push the main! err=$err");
99 99 exit(1); exit(1);
100 100 } }
101 101 rg_log_exit(); rg_log_exit();
 
... ... if ($r['ok'] != 1) {
113 113 rg_log_exit(); rg_log_exit();
114 114
115 115
116 $commit = trim(file_get_contents('git2/.git/refs/heads/master'));
117 rg_log("Loaded master from .git: $commit");
116 $commit = trim(file_get_contents('git2/.git/refs/heads/main'));
117 rg_log("Loaded main from .git: $commit");
118 118
119 119 rg_log(''); rg_log('');
120 120 rg_log_enter('Checking on web that everything is OK...'); rg_log_enter('Checking on web that everything is OK...');
 
... ... $r = do_req($info, $test_url . '/user/' . rawurlencode($rg_ui['username'])
124 124 . '/' . rawurlencode($repo['name']) . '/source/log/commit/' . '/' . rawurlencode($repo['name']) . '/source/log/commit/'
125 125 . $commit, $data, $headers); . $commit, $data, $headers);
126 126 if ($r === FALSE) { if ($r === FALSE) {
127 rg_log("Cannot load master commit!");
127 rg_log("Cannot load main commit!");
128 128 exit(1); exit(1);
129 129 } }
130 130 rg_log_exit(); rg_log_exit();
File tests/git2_helper.sh changed (mode: 100755) (index 9ff2f7c..49d6f99)
3 3 rm -rf git2 rm -rf git2
4 4 mkdir git2 mkdir git2
5 5 cd git2 cd git2
6 git init
6 git init --initial-branch=main
7 7 echo "a signature" > a echo "a signature" > a
8 8 git add a git add a
9 9 git commit -a -m "aa" git commit -a -m "aa"
 
... ... git checkout -b group2/subgroup1/branch2
12 12 git tag -a -m "aaaa" v1.0 git tag -a -m "aaaa" v1.0
13 13 git tag unannot1 git tag unannot1
14 14
15 git checkout master
15 git checkout main
16 16 echo "aaa" > b echo "aaa" > b
17 17 git add b git add b
18 18 git commit -m "commit b file" git commit -m "commit b file"
File tests/git_big_push.php changed (mode: 100644) (index 7de160f..712e1b4)
... ... if (!file_exists('temp_repos/git_small_obj')) {
42 42 rg_log_enter('Testing push with a lot of small objects (create repo)...'); rg_log_enter('Testing push with a lot of small objects (create repo)...');
43 43 $r = rg_exec('mkdir -p temp_repos && cd temp_repos' $r = rg_exec('mkdir -p temp_repos && cd temp_repos'
44 44 . ' && mkdir git_small_obj.tmp && cd git_small_obj.tmp' . ' && mkdir git_small_obj.tmp && cd git_small_obj.tmp'
45 . ' && git init'
45 . ' && git init --initial-branch=main'
46 46 . ' && (for i in `seq 0 500`; do' . ' && (for i in `seq 0 500`; do'
47 47 . ' dd if=/dev/urandom of=a-${i} bs=10000 count=1' . ' dd if=/dev/urandom of=a-${i} bs=10000 count=1'
48 48 . ' && git add a-${i}' . ' && git add a-${i}'
 
... ... rg_log('');
63 63 rg_log_enter('Testing push with a lot of small objects (push)...'); rg_log_enter('Testing push with a lot of small objects (push)...');
64 64 $r = rg_exec('cd temp_repos/git_small_obj' $r = rg_exec('cd temp_repos/git_small_obj'
65 65 . ' && git remote set-url origin ' . $remote . ' && git remote set-url origin ' . $remote
66 . ' && git push --force origin master',
66 . ' && git push --force origin main',
67 67 '', FALSE, FALSE, FALSE); '', FALSE, FALSE, FALSE);
68 68 if ($r['ok'] != 1) { if ($r['ok'] != 1) {
69 69 rg_log_ml('r: ' . print_r($r, TRUE)); rg_log_ml('r: ' . print_r($r, TRUE));
 
... ... if (!file_exists('temp_repos/git_big_push')) {
78 78 rg_log_enter('Testing push with a big file (create repo)...'); rg_log_enter('Testing push with a big file (create repo)...');
79 79 $r = rg_exec('mkdir -p temp_repos && cd temp_repos' $r = rg_exec('mkdir -p temp_repos && cd temp_repos'
80 80 . ' && mkdir git_big_push.tmp && cd git_big_push.tmp' . ' && mkdir git_big_push.tmp && cd git_big_push.tmp'
81 . ' && git init'
81 . ' && git init --initial-branch=main'
82 82 . ' && git remote add origin ' . $remote . ' && git remote add origin ' . $remote
83 83 . ' && dd if=/dev/zero of=a bs=1M count=2' . ' && dd if=/dev/zero of=a bs=1M count=2'
84 84 . ' && git add a' . ' && git add a'
 
... ... rg_log('');
98 98 rg_log_enter('Testing push with a big file (push)...'); rg_log_enter('Testing push with a big file (push)...');
99 99 $r = rg_exec('cd temp_repos/git_big_push' $r = rg_exec('cd temp_repos/git_big_push'
100 100 . ' && git remote set-url origin ' . $remote . ' && git remote set-url origin ' . $remote
101 . ' && git push --force origin master',
101 . ' && git push --force origin main',
102 102 '', FALSE, FALSE, FALSE); '', FALSE, FALSE, FALSE);
103 103 if ($r['ok'] != 1) { if ($r['ok'] != 1) {
104 104 if (!strstr($r['errmsg'], 'git config http.postBuffer')) { if (!strstr($r['errmsg'], 'git config http.postBuffer')) {
 
... ... rg_log_exit();
110 110
111 111
112 112 rg_log('OK!'); rg_log('OK!');
113 ?>
File tests/git_log1.expected changed (mode: 100644) (index b85d313..e76d3f4)
1 1 <div class="diff"> <div class="diff">
2 <a name="file-uniq-id-b9a1399c1280298cc14674769cff87a0a785e6ab"></a>
3 <table class="chunk">
2 <table id="file-uniq-id-b9a1399c1280298cc14674769cff87a0a785e6ab" class="chunk">
4 3 <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377</b> changed (mode: 100644) (index 72943a1..f761ec1)</td></tr> <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377</b> changed (mode: 100644) (index 72943a1..f761ec1)</td></tr>
5 4 1 cl-r aaa cl-e 1 cl-r aaa cl-e
6 5 1 cl-e cl-g bbb 1 cl-e cl-g bbb
7 6 </table> </table>
8 7 </div> </div>
9 8 <div class="diff"> <div class="diff">
10 <a name="file-uniq-id-b9a1399c1280298cc14674769cff87a0a785e6ab"></a>
11 <table class="chunk">
9 <table id="file-uniq-id-b9a1399c1280298cc14674769cff87a0a785e6ab" class="chunk">
12 10 <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377</b> copied from file <b>a b c ș</b> (similarity 100%)</td></tr> <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377</b> copied from file <b>a b c ș</b> (similarity 100%)</td></tr>
13 11 </table> </table>
14 12 </div> </div>
15 13 <div class="diff"> <div class="diff">
16 <a name="file-uniq-id-9c7aa2b11f270998a63b1b1795cff3890a4eb56f"></a>
17 <table class="chunk">
14 <table id="file-uniq-id-9c7aa2b11f270998a63b1b1795cff3890a4eb56f" class="chunk">
18 15 <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277</b> changed (mode: 100644) (index 72943a1..f761ec1)</td></tr> <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277</b> changed (mode: 100644) (index 72943a1..f761ec1)</td></tr>
19 16 1 cl-r aaa cl-e 1 cl-r aaa cl-e
20 17 1 cl-e cl-g bbb 1 cl-e cl-g bbb
21 18 </table> </table>
22 19 </div> </div>
23 20 <div class="diff"> <div class="diff">
24 <a name="file-uniq-id-9c7aa2b11f270998a63b1b1795cff3890a4eb56f"></a>
25 <table class="chunk">
21 <table id="file-uniq-id-9c7aa2b11f270998a63b1b1795cff3890a4eb56f" class="chunk">
26 22 <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277</b> copied from file <b>a b c ș</b> (similarity 100%)</td></tr> <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277</b> copied from file <b>a b c ș</b> (similarity 100%)</td></tr>
27 23 </table> </table>
28 24 </div> </div>
29 25 <div class="diff"> <div class="diff">
30 <a name="file-uniq-id-08f42ca259cf121d2ea9cd8b6c5b24c86d733db7"></a>
31 <table class="chunk">
26 <table id="file-uniq-id-08f42ca259cf121d2ea9cd8b6c5b24c86d733db7" class="chunk">
32 27 <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~\177</b> changed (mode: 100644) (index 72943a1..f761ec1)</td></tr> <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~\177</b> changed (mode: 100644) (index 72943a1..f761ec1)</td></tr>
33 28 1 cl-r aaa cl-e 1 cl-r aaa cl-e
34 29 1 cl-e cl-g bbb 1 cl-e cl-g bbb
35 30 </table> </table>
36 31 </div> </div>
37 32 <div class="diff"> <div class="diff">
38 <a name="file-uniq-id-08f42ca259cf121d2ea9cd8b6c5b24c86d733db7"></a>
39 <table class="chunk">
33 <table id="file-uniq-id-08f42ca259cf121d2ea9cd8b6c5b24c86d733db7" class="chunk">
40 34 <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~\177</b> copied from file <b>a b c ș</b> (similarity 100%)</td></tr> <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~\177</b> copied from file <b>a b c ș</b> (similarity 100%)</td></tr>
41 35 </table> </table>
42 36 </div> </div>
43 37 <div class="diff"> <div class="diff">
44 <a name="file-uniq-id-e9ead85f4cc2dfffaae3cd00d6f14cb099922f0c"></a>
45 <table class="chunk">
38 <table id="file-uniq-id-e9ead85f4cc2dfffaae3cd00d6f14cb099922f0c" class="chunk">
46 39 <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>\1\2\3\4\5\6\a\b\t\n\v\f\r\16\17\20\21\22\23\24\25\26\27\30\31\32\33\34\35\36\37 !&quot;#$%&amp;&apos;()*+,-.0123456789:;&lt;=&gt;?</b> changed (mode: 100644) (index 72943a1..f761ec1)</td></tr> <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>\1\2\3\4\5\6\a\b\t\n\v\f\r\16\17\20\21\22\23\24\25\26\27\30\31\32\33\34\35\36\37 !&quot;#$%&amp;&apos;()*+,-.0123456789:;&lt;=&gt;?</b> changed (mode: 100644) (index 72943a1..f761ec1)</td></tr>
47 40 1 cl-r aaa cl-e 1 cl-r aaa cl-e
48 41 1 cl-e cl-g bbb 1 cl-e cl-g bbb
49 42 </table> </table>
50 43 </div> </div>
51 44 <div class="diff"> <div class="diff">
52 <a name="file-uniq-id-e9ead85f4cc2dfffaae3cd00d6f14cb099922f0c"></a>
53 <table class="chunk">
45 <table id="file-uniq-id-e9ead85f4cc2dfffaae3cd00d6f14cb099922f0c" class="chunk">
54 46 <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>\1\2\3\4\5\6\a\b\t\n\v\f\r\16\17\20\21\22\23\24\25\26\27\30\31\32\33\34\35\36\37 !&quot;#$%&amp;&apos;()*+,-.0123456789:;&lt;=&gt;?</b> copied from file <b>a b c ș</b> (similarity 100%)</td></tr> <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>\1\2\3\4\5\6\a\b\t\n\v\f\r\16\17\20\21\22\23\24\25\26\27\30\31\32\33\34\35\36\37 !&quot;#$%&amp;&apos;()*+,-.0123456789:;&lt;=&gt;?</b> copied from file <b>a b c ș</b> (similarity 100%)</td></tr>
55 47 </table> </table>
56 48 </div> </div>
57 49 <div class="diff"> <div class="diff">
58 <a name="file-uniq-id-e57f9914bcbd958506a4a7148bcd0fa6b2f49b8d"></a>
59 <table class="chunk">
50 <table id="file-uniq-id-e57f9914bcbd958506a4a7148bcd0fa6b2f49b8d" class="chunk">
60 51 <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>dis1</b> changed (mode: 100644) (index 2c4179b..2bf9115)</td></tr> <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>dis1</b> changed (mode: 100644) (index 2c4179b..2bf9115)</td></tr>
61 52 1 cl-r aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa cl-e 1 cl-r aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa cl-e
62 53 2 1 cl-e baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa cl-e baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 2 1 cl-e baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa cl-e baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
64 55 </table> </table>
65 56 </div> </div>
66 57 <div class="diff"> <div class="diff">
67 <a name="file-uniq-id-e57f9914bcbd958506a4a7148bcd0fa6b2f49b8d"></a>
68 <table class="chunk">
58 <table id="file-uniq-id-e57f9914bcbd958506a4a7148bcd0fa6b2f49b8d" class="chunk">
69 59 <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>dis1</b> added (mode: 100644) (index 0000000..2c4179b)</td></tr> <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>dis1</b> added (mode: 100644) (index 0000000..2c4179b)</td></tr>
70 60 1 cl-e cl-g aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 1 cl-e cl-g aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
71 61 2 cl-e cl-g baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 2 cl-e cl-g baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
72 62 </table> </table>
73 63 </div> </div>
74 64 <div class="diff"> <div class="diff">
75 <a name="file-uniq-id-039b389972b4d0ed5fabf08adece44f7a64a1152"></a>
76 <table class="chunk">
65 <table id="file-uniq-id-039b389972b4d0ed5fabf08adece44f7a64a1152" class="chunk">
77 66 <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b> b\a\b</b> added (mode: 100644) (index 0000000..a9a1f63)</td></tr> <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b> b\a\b</b> added (mode: 100644) (index 0000000..a9a1f63)</td></tr>
78 67 1 cl-e cl-g aaafdsfsd 1 cl-e cl-g aaafdsfsd
79 68 </table> </table>
80 69 </div> </div>
81 70 <div class="diff"> <div class="diff">
82 <a name="file-uniq-id-d97bde1f426a49de70c1be6772fe99215766f3a3"></a>
83 <table class="chunk">
71 <table id="file-uniq-id-d97bde1f426a49de70c1be6772fe99215766f3a3" class="chunk">
84 72 <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>a b c&lt;xss&gt;</b> added (mode: 100644) (index 0000000..e19d72a)</td></tr> <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>a b c&lt;xss&gt;</b> added (mode: 100644) (index 0000000..e19d72a)</td></tr>
85 73 1 cl-e cl-g adsnjnfsdjnfsndfjksnaa 1 cl-e cl-g adsnjnfsdjnfsndfjksnaa
86 74 </table> </table>
87 75 </div> </div>
88 76 <div class="diff"> <div class="diff">
89 <a name="file-uniq-id-a958c33024ce45b9785fa950e1e9e21e9b655337"></a>
90 <table class="chunk">
77 <table id="file-uniq-id-a958c33024ce45b9785fa950e1e9e21e9b655337" class="chunk">
91 78 <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>a b c ș</b> added (mode: 100644) (index 0000000..72943a1)</td></tr> <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>a b c ș</b> added (mode: 100644) (index 0000000..72943a1)</td></tr>
92 79 1 cl-e cl-g aaa 1 cl-e cl-g aaa
93 80 </table> </table>
94 81 </div> </div>
95 82 <div class="diff"> <div class="diff">
96 <a name="file-uniq-id-252bc06763afb3b6c2a0802f7346700ab55f46f5"></a>
97 <table class="chunk">
83 <table id="file-uniq-id-252bc06763afb3b6c2a0802f7346700ab55f46f5" class="chunk">
98 84 <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>a3</b> deleted (index 193814c..0000000)</td></tr> <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>a3</b> deleted (index 193814c..0000000)</td></tr>
99 85 1 cl-r aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa cl-e 1 cl-r aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa cl-e
100 86 </table> </table>
101 87 </div> </div>
102 88 <div class="diff"> <div class="diff">
103 <a name="file-uniq-id-252bc06763afb3b6c2a0802f7346700ab55f46f5"></a>
104 <table class="chunk">
89 <table id="file-uniq-id-252bc06763afb3b6c2a0802f7346700ab55f46f5" class="chunk">
105 90 <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>a3</b> renamed from <b>a2</b> (similarity 100%)</td></tr> <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>a3</b> renamed from <b>a2</b> (similarity 100%)</td></tr>
106 91 </table> </table>
107 <a name="file-uniq-id-84a516841ba77a5b4648de2cd0dfcb30ea46dbb4"></a>
108 <table class="chunk">
92 <table id="file-uniq-id-84a516841ba77a5b4648de2cd0dfcb30ea46dbb4" class="chunk">
109 93 <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>c</b> added (mode: 100644) (index 0000000..8ded189)</td></tr> <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>c</b> added (mode: 100644) (index 0000000..8ded189)</td></tr>
110 94 1 cl-e cl-g aaaaaaaaaaaaaaaaaaaa 1 cl-e cl-g aaaaaaaaaaaaaaaaaaaa
111 95 </table> </table>
112 96 </div> </div>
113 97 <div class="diff"> <div class="diff">
114 <a name="file-uniq-id-b9f85daa6f83cf02ce5c31913d1f64d3f5c8fade"></a>
115 <table class="chunk">
98 <table id="file-uniq-id-b9f85daa6f83cf02ce5c31913d1f64d3f5c8fade" class="chunk">
116 99 <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>a2</b> copied from file <b>a</b> (similarity 100%)</td></tr> <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>a2</b> copied from file <b>a</b> (similarity 100%)</td></tr>
117 100 </table> </table>
118 101 </div> </div>
119 102 <div class="diff"> <div class="diff">
120 <a name="file-uniq-id-2f2c3aed7ef52985dbc835f7a091c91a69ad6ebb"></a>
121 <table class="chunk">
103 <table id="file-uniq-id-2f2c3aed7ef52985dbc835f7a091c91a69ad6ebb" class="chunk">
122 104 <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>empty.txt</b> added (mode: 100644) (index 0000000..e69de29)</td></tr> <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>empty.txt</b> added (mode: 100644) (index 0000000..e69de29)</td></tr>
123 105 </table> </table>
124 106 </div> </div>
125 107 <div class="diff"> <div class="diff">
126 <a name="file-uniq-id-b7418c54bc2eb2de8dcb3c02b69d853e2feb3c92"></a>
127 <table class="chunk">
108 <table id="file-uniq-id-b7418c54bc2eb2de8dcb3c02b69d853e2feb3c92" class="chunk">
128 109 <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>xx&quot;yy</b> added (mode: 100644) (index 0000000..1678aa7)</td></tr> <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>xx&quot;yy</b> added (mode: 100644) (index 0000000..1678aa7)</td></tr>
129 110 1 cl-e cl-g fsdfnsjfnsff 1 cl-e cl-g fsdfnsjfnsff
130 111 </table> </table>
131 112 </div> </div>
132 113 <div class="diff"> <div class="diff">
133 <a name="file-uniq-id-86f7e437faa5a7fce15d1ddcb9eaeaea377667b8"></a>
134 <table class="chunk">
114 <table id="file-uniq-id-86f7e437faa5a7fce15d1ddcb9eaeaea377667b8" class="chunk">
135 115 <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>a</b> added (mode: 100644) (index 0000000..193814c)</td></tr> <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>a</b> added (mode: 100644) (index 0000000..193814c)</td></tr>
136 116 1 cl-e cl-g aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 1 cl-e cl-g aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
137 117 </table> </table>
File tests/git_log1.sh changed (mode: 100755) (index d5e5a84..9bca615)
... ... rm -rf git_log1
6 6
7 7 mkdir git_log1 mkdir git_log1
8 8 cd git_log1 cd git_log1
9 git init
9 git init --initial-branch=main
10 10 git remote add origin ssh://rocketgit@ssh.rocketgit.com/user/catalinux/test1 git remote add origin ssh://rocketgit@ssh.rocketgit.com/user/catalinux/test1
11 11
12 12 echo "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" > a echo "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" > a
File tests/hook_update.sh changed (mode: 100755) (index a78de7b..19bc54d)
... ... rm -rf repos/hook_update_*.git
17 17 mkdir -p "${dest}" mkdir -p "${dest}"
18 18 ( (
19 19 cd "${dest}" cd "${dest}"
20 git init --bare
20 git init --bare --initial-branch=main
21 21 ) )
22 22 cp -v ../hooks/update "${dest}/hooks/" cp -v ../hooks/update "${dest}/hooks/"
23 23
 
... ... git commit -m "a" a >/dev/null || exit 1
41 41 echo "bbb" >> a echo "bbb" >> a
42 42 git commit -m "b" a >/dev/null || exit 1 git commit -m "b" a >/dev/null || exit 1
43 43 #strace -s200 -ff -o ${tests}/hook_update.strace \ #strace -s200 -ff -o ${tests}/hook_update.strace \
44 git push origin master
44 git push origin main
45 45 if [ "${?}" != "1" ]; then if [ "${?}" != "1" ]; then
46 46 echo "Should not work!" echo "Should not work!"
47 47 exit 1 exit 1
 
... ... echo "=== Testing push with rights..."
50 50 export ROCKETGIT_REPO_RIGHTS="CP" export ROCKETGIT_REPO_RIGHTS="CP"
51 51 php ${tests}/hook_update_help.php refs php ${tests}/hook_update_help.php refs
52 52 #strace -s200 -ff -o ${tests}/hook_update.strace \ #strace -s200 -ff -o ${tests}/hook_update.strace \
53 git push origin master
53 git push origin main
54 54 if [ "${?}" != "0" ]; then if [ "${?}" != "0" ]; then
55 55 echo "Should work!" echo "Should work!"
56 56 exit 1 exit 1
 
... ... echo "=== Testing not fast-forward without rights..."
61 61 git reset --hard HEAD~1 git reset --hard HEAD~1
62 62 echo "bbb" > a echo "bbb" > a
63 63 git commit -m "new a" a git commit -m "new a" a
64 git push --force origin master
64 git push --force origin main
65 65 if [ "${?}" != "1" ]; then if [ "${?}" != "1" ]; then
66 66 echo "Should not work!" echo "Should not work!"
67 67 exit 1 exit 1
 
... ... fi
69 69 echo "=== Testing not fast-forward with rights..." echo "=== Testing not fast-forward with rights..."
70 70 export ROCKETGIT_REPO_RIGHTS="COP" export ROCKETGIT_REPO_RIGHTS="COP"
71 71 php ${tests}/hook_update_help.php refs php ${tests}/hook_update_help.php refs
72 git push --force origin master
72 git push --force origin main
73 73 if [ "${?}" != "0" ]; then if [ "${?}" != "0" ]; then
74 74 echo "Should work!" echo "Should work!"
75 75 exit 1 exit 1
 
... ... echo "=== Testing merge-commit without rights (${ROCKETGIT_REPO_RIGHTS})..."
132 132 git checkout -b branch1 git checkout -b branch1
133 133 echo "ccc" >> a echo "ccc" >> a
134 134 git commit -m "new b" a git commit -m "new b" a
135 git checkout master
135 git checkout main
136 136 echo "a" > b; git add b echo "a" > b; git add b
137 137 git commit -m "c" b git commit -m "c" b
138 138 git tag ret_point git tag ret_point
139 139 git merge -m "this is a merge" branch1 git merge -m "this is a merge" branch1
140 140 # Add a commit to see if we test all commits, not only the last one # Add a commit to see if we test all commits, not only the last one
141 141 echo "aaasasa" >> b; git add b; git commit -m "d" echo "aaasasa" >> b; git add b; git commit -m "d"
142 git push origin master
142 git push origin main
143 143 if [ "${?}" != "1" ]; then if [ "${?}" != "1" ]; then
144 144 echo "Should not work!" echo "Should not work!"
145 145 exit 1 exit 1
 
... ... fi
147 147 echo "=== Testing merge-commit with rights..." echo "=== Testing merge-commit with rights..."
148 148 export ROCKETGIT_REPO_RIGHTS="${ROCKETGIT_REPO_RIGHTS}M" export ROCKETGIT_REPO_RIGHTS="${ROCKETGIT_REPO_RIGHTS}M"
149 149 php ${tests}/hook_update_help.php refs php ${tests}/hook_update_help.php refs
150 git push origin master
150 git push origin main
151 151 if [ "${?}" != "0" ]; then if [ "${?}" != "0" ]; then
152 152 echo "Should work!" echo "Should work!"
153 153 exit 1 exit 1
154 154 fi fi
155 155 # Because we test anonymous push, we need to throw away the merge commit # Because we test anonymous push, we need to throw away the merge commit
156 156 git reset --hard ret_point git reset --hard ret_point
157 git push --force origin master
157 git push --force origin main
158 158
159 159 echo echo
160 160 echo "=== Testing bad-whitespace without rights..." echo "=== Testing bad-whitespace without rights..."
161 161 echo -e " \t \ta \t\n \r\n" > b echo -e " \t \ta \t\n \r\n" > b
162 162 git commit -m "d" b git commit -m "d" b
163 git push origin master
163 git push origin main
164 164 if [ "${?}" != "1" ]; then if [ "${?}" != "1" ]; then
165 165 echo "Should not work!" echo "Should not work!"
166 166 exit 1 exit 1
 
... ... fi
168 168 echo "=== Testing bad-whitespace with rights..." echo "=== Testing bad-whitespace with rights..."
169 169 export ROCKETGIT_REPO_RIGHTS="${ROCKETGIT_REPO_RIGHTS}W" export ROCKETGIT_REPO_RIGHTS="${ROCKETGIT_REPO_RIGHTS}W"
170 170 php ${tests}/hook_update_help.php refs php ${tests}/hook_update_help.php refs
171 git push origin master
171 git push origin main
172 172 if [ "${?}" != "0" ]; then if [ "${?}" != "0" ]; then
173 173 echo "Should work!" echo "Should work!"
174 174 exit 1 exit 1
 
... ... mkdir -p ${X}
239 239 cp -a "${dest}"/refs/heads/* "${X}/" cp -a "${dest}"/refs/heads/* "${X}/"
240 240 echo "=== Testing anonymous push without rights..." echo "=== Testing anonymous push without rights..."
241 241 #strace -s200 -ff -o ${tests}/hook_update.strace \ #strace -s200 -ff -o ${tests}/hook_update.strace \
242 git push origin master
242 git push origin main
243 243 if [ "${?}" != "1" ]; then if [ "${?}" != "1" ]; then
244 244 echo "Should not work!" echo "Should not work!"
245 245 exit 1 exit 1
 
... ... fi
247 247 echo "=== Testing anonymous push with rights..." echo "=== Testing anonymous push with rights..."
248 248 export ROCKETGIT_REPO_RIGHTS="HW" export ROCKETGIT_REPO_RIGHTS="HW"
249 249 php ${tests}/hook_update_help.php refs php ${tests}/hook_update_help.php refs
250 git push origin master
250 git push origin main
251 251 if [ "${?}" != "0" ]; then if [ "${?}" != "0" ]; then
252 252 echo "Should work!" echo "Should work!"
253 253 exit 1 exit 1
254 254 fi fi
255 255 # Test if the namespace has been updated instead of main namespace # Test if the namespace has been updated instead of main namespace
256 A=`diff "${dest}/refs/namespaces/${GIT_NAMESPACE}/refs/heads/master" \
257 .git/refs/heads/master`
256 A=`diff "${dest}/refs/namespaces/${GIT_NAMESPACE}/refs/heads/main" \
257 .git/refs/heads/main`
258 258 if [ "${?}" != 0 ]; then if [ "${?}" != 0 ]; then
259 259 echo "Cannot do the diff for anonymous push" echo "Cannot do the diff for anonymous push"
260 260 exit 1 exit 1
 
... ... if [ "${A}" != "" ]; then
263 263 echo "We did not update the namespace!" echo "We did not update the namespace!"
264 264 exit 1 exit 1
265 265 fi fi
266 A=`diff "${dest}/refs/heads/master" .git/refs/heads/master`
266 A=`diff "${dest}/refs/heads/main" .git/refs/heads/main`
267 267 if [ "${A}" = "" ]; then if [ "${A}" = "" ]; then
268 268 echo "Seems we updated also main namespace!" echo "Seems we updated also main namespace!"
269 269 exit 1 exit 1
 
... ... if [ "${A}" != "" ]; then
302 302 echo "We did not update the namespace but main refs (anon+branch)!" echo "We did not update the namespace but main refs (anon+branch)!"
303 303 exit 1 exit 1
304 304 fi fi
305 A=`diff "${dest}/refs/heads/master" .git/refs/heads/branch_anon1`
305 A=`diff "${dest}/refs/heads/main" .git/refs/heads/branch_anon1`
306 306 if [ "${A}" = "" ]; then if [ "${A}" = "" ]; then
307 307 echo "Seems we updated also main refs (anon+branch)!" echo "Seems we updated also main refs (anon+branch)!"
308 308 exit 1 exit 1
File tests/http.inc.php changed (mode: 100644) (index d1994b2..8e8d9eb)
... ... function do_req($info, $url, &$data, &$headers)
89 89 curl_setopt($c, CURLOPT_REFERER, $info['referer']); curl_setopt($c, CURLOPT_REFERER, $info['referer']);
90 90 curl_setopt($c, CURLOPT_CERTINFO, TRUE); curl_setopt($c, CURLOPT_CERTINFO, TRUE);
91 91 curl_setopt($c, CURLOPT_VERBOSE, TRUE); curl_setopt($c, CURLOPT_VERBOSE, TRUE);
92 curl_setopt($c, CURLOPT_ENCODING , 'gzip');
92 curl_setopt($c, CURLOPT_ENCODING, 'gzip');
93 93 curl_setopt($c, CURLOPT_COOKIEJAR, $cookie_jar); curl_setopt($c, CURLOPT_COOKIEJAR, $cookie_jar);
94 94 curl_setopt($c, CURLOPT_COOKIEFILE, $cookie_jar); curl_setopt($c, CURLOPT_COOKIEFILE, $cookie_jar);
95 95
File tests/http_settings.php changed (mode: 100644) (index 2434dae..a254b82)
... ... $headers = array();
151 151 $r = do_req($info, $test_url . "/op/settings/edit_info?t=post_edit_info_form", $data, $headers); $r = do_req($info, $test_url . "/op/settings/edit_info?t=post_edit_info_form", $data, $headers);
152 152 if (!strstr($r['body'], "Information has been successfully updated")) { if (!strstr($r['body'], "Information has been successfully updated")) {
153 153 rg_log_ml('r: ' . print_r($r, TRUE)); rg_log_ml('r: ' . print_r($r, TRUE));
154 rg_log("Cannot change account info!");
154 rg_log("Cannot change account info (ok message missing)!");
155 155 exit(1); exit(1);
156 156 } }
157 157 rg_log_exit(); rg_log_exit();
File tests/mr.inc.php changed (mode: 100644) (index 5e5075f..b84ae14)
... ... function test_mr_check($db, $t, $rg_ui, $repo, $mr_id, $mr_refname, $expect_ff)
81 81 } }
82 82
83 83 $r = rg_exec('cd temp_repos/pr_anon' $r = rg_exec('cd temp_repos/pr_anon'
84 . ' && git pull origin_git master',
84 . ' && git pull origin_git main',
85 85 '', FALSE, FALSE, FALSE); '', FALSE, FALSE, FALSE);
86 86 if ($r['ok'] != 1) { if ($r['ok'] != 1) {
87 87 rg_log('Could not pull: ' . $r['errmsg'] . '!'); rg_log('Could not pull: ' . $r['errmsg'] . '!');
File tests/pr_anon.php changed (mode: 100644) (index 8046a9a..512a6ce)
... ... $r = rg_exec('mkdir -p temp_repos && cd temp_repos'
56 56 . ' && rm -rf pr_anon' . ' && rm -rf pr_anon'
57 57 . ' && mkdir pr_anon' . ' && mkdir pr_anon'
58 58 . ' && cd pr_anon' . ' && cd pr_anon'
59 . ' && git init'
59 . ' && git init --initial-branch=main'
60 60 . ' && git remote add origin_ssh ' . ' && git remote add origin_ssh '
61 61 . ' ssh://rocketgit@' . $rg_ssh_host . ':' . $rg_ssh_port . ' ssh://rocketgit@' . $rg_ssh_host . ':' . $rg_ssh_port
62 62 . '/user/' . escapeshellarg($rg_ui['username']) . '/' . '/user/' . escapeshellarg($rg_ui['username']) . '/'
 
... ... file_put_contents('temp_repos/pr_anon/change1.txt', "change1 desc\n\nthis is the
80 80 $r = rg_exec('cd temp_repos/pr_anon' $r = rg_exec('cd temp_repos/pr_anon'
81 81 . ' && echo "change0" > a && git add a && git commit -F change0.txt' . ' && echo "change0" > a && git add a && git commit -F change0.txt'
82 82 . ' && echo "change1" > b && git add b && git commit -F change1.txt' . ' && echo "change1" > b && git add b && git commit -F change1.txt'
83 . ' && git push origin_git master',
83 . ' && git push origin_git main',
84 84 '', FALSE, FALSE, FALSE); '', FALSE, FALSE, FALSE);
85 85 if ($r['ok'] != 1) { if ($r['ok'] != 1) {
86 86 rg_log('Anonymous push request was rejected: ' . $r['errmsg'] . '!'); rg_log('Anonymous push request was rejected: ' . $r['errmsg'] . '!');
 
... ... if ($r['ok'] != 1) {
89 89 rg_log_exit(); rg_log_exit();
90 90
91 91
92 test_mr_check($db, $_testns, $rg_ui, $repo, 1, 'refs/heads/master', TRUE);
92 test_mr_check($db, $_testns, $rg_ui, $repo, 1, 'refs/heads/main', TRUE);
93 93
94 94
95 95 rg_log(''); rg_log('');
 
... ... file_put_contents('temp_repos/pr_anon/change3.txt', "change3 desc\n\nthis is the
99 99 $r = rg_exec('cd temp_repos/pr_anon' $r = rg_exec('cd temp_repos/pr_anon'
100 100 . ' && echo "change2" > a && git commit -a -F change2.txt' . ' && echo "change2" > a && git commit -a -F change2.txt'
101 101 . ' && echo "change3" > a && git commit -a -F change3.txt' . ' && echo "change3" > a && git commit -a -F change3.txt'
102 . ' && git push origin_ssh master',
102 . ' && git push origin_ssh main',
103 103 '', FALSE, FALSE, FALSE); '', FALSE, FALSE, FALSE);
104 104 if ($r['ok'] != 1) { if ($r['ok'] != 1) {
105 105 rg_log('Non-anonymous push was rejected: ' . $r['errmsg'] . '!'); rg_log('Non-anonymous push was rejected: ' . $r['errmsg'] . '!');
 
... ... file_put_contents('temp_repos/pr_anon/change5.txt', "anon change5 desc\n\nthis i
115 115 $r = rg_exec('cd temp_repos/pr_anon' $r = rg_exec('cd temp_repos/pr_anon'
116 116 . ' && echo "change4" >> a && git commit -a -F change4.txt' . ' && echo "change4" >> a && git commit -a -F change4.txt'
117 117 . ' && echo "change5" >> a && git commit -a -F change5.txt' . ' && echo "change5" >> a && git commit -a -F change5.txt'
118 . ' && git push origin_git master',
118 . ' && git push origin_git main',
119 119 '', FALSE, FALSE, FALSE); '', FALSE, FALSE, FALSE);
120 120 if ($r['ok'] != 1) { if ($r['ok'] != 1) {
121 121 rg_log('Anonymous push was rejected: ' . $r['errmsg'] . '!'); rg_log('Anonymous push was rejected: ' . $r['errmsg'] . '!');
 
... ... if ($r['ok'] != 1) {
124 124 rg_log_exit(); rg_log_exit();
125 125
126 126
127 test_mr_check($db, $_testns, $rg_ui, $repo, 2, 'refs/heads/master', FALSE);
127 test_mr_check($db, $_testns, $rg_ui, $repo, 2, 'refs/heads/main', FALSE);
128 128
129 129
130 130 rg_log(''); rg_log('');
131 131 rg_log_enter('Now, try to see what happens when a merge is with conflicts (this is mr 3)...'); rg_log_enter('Now, try to see what happens when a merge is with conflicts (this is mr 3)...');
132 132 $r = rg_exec('cd temp_repos/pr_anon' $r = rg_exec('cd temp_repos/pr_anon'
133 133 . ' && echo "change2" > a && git commit -a -m "conflict1b"' . ' && echo "change2" > a && git commit -a -m "conflict1b"'
134 . ' && git push origin_git master',
134 . ' && git push origin_git main',
135 135 '', FALSE, FALSE, FALSE); '', FALSE, FALSE, FALSE);
136 136 if ($r['ok'] != 1) { if ($r['ok'] != 1) {
137 137 rg_log_ml('r: ' . print_r($r, TRUE)); rg_log_ml('r: ' . print_r($r, TRUE));
 
... ... $list = array(
143 143 'git reset --hard HEAD^1', 'git reset --hard HEAD^1',
144 144 'echo "change1" > a', 'echo "change1" > a',
145 145 'git commit -a -m "conflict1a"', 'git commit -a -m "conflict1a"',
146 'git push origin_ssh master'
146 'git push origin_ssh main'
147 147 ); );
148 148 foreach ($list as $cmd) { foreach ($list as $cmd) {
149 149 $r = rg_exec($cmd, '', FALSE, FALSE, FALSE); $r = rg_exec($cmd, '', FALSE, FALSE, FALSE);
File tests/source.php changed (mode: 100644) (index 4b5906b..c3f3570)
... ... rg_log_exit();
50 50
51 51
52 52 rg_log(''); rg_log('');
53 rg_log_enter('Trying to push master with an empty file...');
53 rg_log_enter('Trying to push main with an empty file...');
54 54 $cmsg = time() . ' commit message'; $cmsg = time() . ' commit message';
55 55 $remote = 'ssh://rocketgit@' . $rg_ssh_host . ':' .$rg_ssh_port $remote = 'ssh://rocketgit@' . $rg_ssh_host . ':' .$rg_ssh_port
56 56 . '/user/' . escapeshellarg($rg_ui['username']) . '/user/' . escapeshellarg($rg_ui['username'])
57 57 . '/' . escapeshellarg($repo['name']); . '/' . escapeshellarg($repo['name']);
58 58 $r = rg_exec('mkdir -p temp_repos && cd temp_repos' $r = rg_exec('mkdir -p temp_repos && cd temp_repos'
59 59 . ' && rm -rf .source && mkdir .source && cd .source' . ' && rm -rf .source && mkdir .source && cd .source'
60 . ' && git init && git commit --allow-empty -m "' . $cmsg . '"'
60 . ' && git init --initial-branch=main'
61 . ' && git commit --allow-empty -m "' . $cmsg . '"'
61 62 . ' && git remote add origin ' . $remote . ' && git remote add origin ' . $remote
62 . ' && git push origin master',
63 . ' && git push origin main',
63 64 '', FALSE, FALSE, FALSE); '', FALSE, FALSE, FALSE);
64 65 if ($r['ok'] != 1) { if ($r['ok'] != 1) {
65 66 rg_log_ml('out: ' . $r['errmsg']); rg_log_ml('out: ' . $r['errmsg']);
66 rg_log('Seems I cannot push master!');
67 rg_log('Seems I cannot push main!');
67 68 exit(1); exit(1);
68 69 } }
69 70 $data = array(); $data = array();
 
... ... rg_log_exit();
99 100
100 101
101 102 rg_log(''); rg_log('');
102 rg_log_enter('Trying to push master with strange file names...');
103 rg_log_enter('Trying to push main with strange file names...');
103 104 $d = 'ă'; $ed = escapeshellarg($d); $d = 'ă'; $ed = escapeshellarg($d);
104 105 $f = 'ș ț"\\'; $ef = escapeshellarg($f); $f = 'ș ț"\\'; $ef = escapeshellarg($f);
105 106 $cmsg = time() . ' commit message'; $cmsg = time() . ' commit message';
 
... ... $r = rg_exec('cd temp_repos/.source'
108 109 . ' && git add "a b c" ' . $ed . '/' . $ef . ' && git add "a b c" ' . $ed . '/' . $ef
109 110 . ' && git commit -m "' . $cmsg . '"' . ' && git commit -m "' . $cmsg . '"'
110 111 . ' && git branch "Î/branch_î"' . ' && git branch "Î/branch_î"'
111 . ' && git push origin master'
112 . ' && git push origin main'
112 113 . ' && git push origin "Î/branch_î"', . ' && git push origin "Î/branch_î"',
113 114 '', FALSE, FALSE, FALSE); '', FALSE, FALSE, FALSE);
114 115 if ($r['ok'] != 1) { if ($r['ok'] != 1) {
115 116 rg_log_ml('out: ' . $r['errmsg']); rg_log_ml('out: ' . $r['errmsg']);
116 rg_log('Seems I cannot push master!');
117 rg_log('Seems I cannot push main!');
117 118 exit(1); exit(1);
118 119 } }
119 120
 
... ... rg_log_enter('Loading blob page...');
167 168 $data = array(); $data = array();
168 169 $headers = array(); $headers = array();
169 170 $r = do_req($info, $test_url . '/user/' . rawurlencode($rg_ui['username']) $r = do_req($info, $test_url . '/user/' . rawurlencode($rg_ui['username'])
170 . '/' . rawurlencode($repo['name']) . '/source/tree/branch/master'
171 . '/' . rawurlencode($repo['name']) . '/source/tree/branch/main'
171 172 . '/blob/' . rawurlencode($d) . '/' . rawurlencode($f), . '/blob/' . rawurlencode($d) . '/' . rawurlencode($f),
172 173 $data, $headers); $data, $headers);
173 174 if ($r === FALSE) { if ($r === FALSE) {
 
... ... rg_log_enter('Downloading blob...');
184 185 $data = array(); $data = array();
185 186 $headers = array(); $headers = array();
186 187 $r = do_req($info, $test_url . '/user/' . rawurlencode($rg_ui['username']) $r = do_req($info, $test_url . '/user/' . rawurlencode($rg_ui['username'])
187 . '/' . rawurlencode($repo['name']) . '/source/tree/branch/master'
188 . '/' . rawurlencode($repo['name']) . '/source/tree/branch/main'
188 189 . '/blob_download/' . rawurlencode($d) . '/' . rawurlencode($f) . '?format=raw', . '/blob_download/' . rawurlencode($d) . '/' . rawurlencode($f) . '?format=raw',
189 190 $data, $headers); $data, $headers);
190 191 if ($r === FALSE) { if ($r === FALSE) {
File tests/wh_cloud.git.sh changed (mode: 100755) (index 5a16ad1..a16b189)
... ... echo "Cloning repo..."
9 9 rm -rf temp_repos/wh_cloud.git rm -rf temp_repos/wh_cloud.git
10 10 git clone "${1}" temp_repos/wh_cloud.git git clone "${1}" temp_repos/wh_cloud.git
11 11 cd temp_repos/wh_cloud.git cd temp_repos/wh_cloud.git
12 git checkout -b master || :
12 13 cat >appspec.yml <<EOF cat >appspec.yml <<EOF
13 14 version: 0.0 version: 0.0
14 15 os: linux os: linux
 
... ... git add appspec.yml
32 33 git commit -a -m "a commit" git commit -a -m "a commit"
33 34
34 35 echo "Pushing..." echo "Pushing..."
36 # We keep the name 'master' because we need to reconfigure AWS (TODO)
35 37 git push origin master git push origin master
File tests/wh_lambda.git.sh added (mode: 100755) (index 0000000..a9a5d26)
1 #!/bin/bash
2
3 set -e
4 set -u
5
6 export GIT_SSH_COMMAND="ssh -o ControlMaster=no -o IdentityFile=${PWD}/keys/${RG_SSH_KEY} -o IdentitiesOnly=yes"
7
8 echo "Cloning repo..."
9 rm -rf temp_repos/wh_lambda.git
10 git clone "${1}" temp_repos/wh_lambda.git
11 cd temp_repos/wh_lambda.git
12 echo "aaa" > a.txt
13 git add a.txt
14 git commit -a -m "a commit"
15
16 echo "Pushing..."
17 git push origin main
File tests/wh_lambda.php changed (mode: 100644) (index 06061b2..ef90f3a)
... ... rg_log('wh_id=' . $wh_id);
82 82 rg_log_exit(); rg_log_exit();
83 83
84 84
85 rg_test_upload_ssh_key($db, $rg_ui, 'wh_cloud', $kn);
85 rg_test_upload_ssh_key($db, $rg_ui, 'wh_lambda', $kn);
86 86
87 87
88 88 rg_log(''); rg_log('');
 
... ... rg_log_enter('Pushing repo, so the trigger has a chanse to execute...');
91 91 $repo_url = 'ssh://rocketgit@' . $rg_ssh_host . ':' . $rg_ssh_port $repo_url = 'ssh://rocketgit@' . $rg_ssh_host . ':' . $rg_ssh_port
92 92 . '/user/' . $rg_ui['username'] . '/' . $repo['name']; . '/user/' . $rg_ui['username'] . '/' . $repo['name'];
93 93 rg_log('repo_url=' . $repo_url); rg_log('repo_url=' . $repo_url);
94 $r = rg_exec('./wh_cloud.git.sh ' . escapeshellarg($repo_url),
94 $r = rg_exec('./wh_lambda.git.sh ' . escapeshellarg($repo_url),
95 95 '', FALSE, FALSE, FALSE); '', FALSE, FALSE, FALSE);
96 96 if ($r['ok'] != 1) { if ($r['ok'] != 1) {
97 97 rg_log_ml('Could not create local git repo: ' . $r['errmsg'] . '!'); rg_log_ml('Could not create local git repo: ' . $r['errmsg'] . '!');
 
... ... if ($a === NULL) {
109 109 rg_log('Cannot decode JSON: '. $r); rg_log('Cannot decode JSON: '. $r);
110 110 exit(1); exit(1);
111 111 } }
112 $e = 'Hello from Lambda; key: aaa branch=master repo=wh-cloud';
112 $e = 'Hello from Lambda; key: aaa branch=main repo=wh-cloud';
113 113 if (strcmp($a, $e) != 0) { if (strcmp($a, $e) != 0) {
114 114 rg_log_ml('r: ' . print_r($r, TRUE)); rg_log_ml('r: ' . print_r($r, TRUE));
115 115 rg_log('Seems hook did not executed correctly [' . $a . '] != [' . $e . ']!'); rg_log('Seems hook did not executed correctly [' . $a . '] != [' . $e . ']!');
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://rocketgit.com/user/catalinux/rocketgit

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/catalinux/rocketgit

Clone this repository using git:
git clone git://git.rocketgit.com/user/catalinux/rocketgit

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