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 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 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/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/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 !"#$%&'()*+,-.0123456789:;<=>?</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 !"#$%&'()*+,-.0123456789:;<=>?</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 !"#$%&'()*+,-.0123456789:;<=>?</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 !"#$%&'()*+,-.0123456789:;<=>?</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<xss></b> added (mode: 100644) (index 0000000..e19d72a)</td></tr> |
<tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>a b c<xss></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"yy</b> added (mode: 100644) (index 0000000..1678aa7)</td></tr> |
<tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>xx"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/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/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) { |