List of commits:
Subject Hash Author Date (UTC)
Add possibility for admin to limit the git log --patch limit 1865405c40ebe92aa1bc6fd4569dcbb0e3af476c Catalin(ux) M. BOIE 2017-04-15 09:28:46
Silent curl in API functional test e6808bc97d201fd4944de0ad2982c3090ae4743a Catalin(ux) M. BOIE 2017-04-15 06:31:04
Fixed a lot of tests which used time() for different fields and sometime lost the time race 6a61493189d07110d3c5fdbe34ea0725d5abbd3b Catalin(ux) M. BOIE 2017-04-15 06:25:40
Fixed the crash with big diffs by setting a limit 788e15942d8272685764a25b640eba2c07046437 Catalin(ux) M. BOIE 2017-04-15 06:24:30
Allow .well-known folder access 90519cd03bf64839d1a9fc2497e58bd63d8ce6f3 Catalin(ux) M. BOIE 2017-04-12 16:50:16
When an un-auth user is visiting a user page with no repo, do not invite to create a repo 6904e1eac3f46c281ae6b4757bcaa16d2acc6169 Catalin(ux) M. BOIE 2017-03-27 15:23:52
Added a 'push' target in Makefile to not forget to push tags... 92a9b78e26d8a3e7b466f5aa45678dd2db8d4310 Catalin(ux) M. BOIE 2017-03-26 14:29:55
Bump version to 0.67 6f1c9a6d7f7d40d65def54e23a3590556a346bb8 Catalin(ux) M. BOIE 2017-03-26 09:44:32
Cosmetic cb68f1921782a503675c592dc7484aa26b8815b6 Catalin(ux) M. BOIE 2017-03-26 09:37:41
Improve state handling: do not check for an old value; verify if table exists before doing a select 17d8eb4b4592dd96e62a8da74d87d3d3b26aeb86 Catalin(ux) M. BOIE 2017-03-26 09:37:01
Impoved debug for cache 4d6349f7143d61583e6d2d9612c89b55af4eea97 Catalin(ux) M. BOIE 2017-03-26 09:36:08
I cannot be sure if the data is stored only in Germany. And we do backups in Romania. 1610c997dbda53c0a21e301b51832d9285ecbcf2 Catalin(ux) M. BOIE 2017-03-26 08:24:46
Removed a not used variable 4d2bab105c6f7748ca53d9a8301a2da320153d53 Catalin(ux) M. BOIE 2017-03-21 20:15:29
tests: ignore some dirs 7260fc44f8d0197b917bc13a0ac19eb8c58d4534 Catalin(ux) M. BOIE 2017-03-21 20:01:03
Link to anon push doc 42dbfdc9ad5fad0157388f239f790f2e8f4de7c2 Catalin(ux) M. BOIE 2017-03-21 20:00:45
comparison: add red/green for css/js sizes and for pagespeed cbcda26a9d20c115eb0931ab2af69f3c2315ab7d Catalin(ux) M. BOIE 2017-03-21 19:44:47
Trim the hints for cloning the tree 59bc91f5229abf96f453d872a58a2c96cf18198c Catalin(ux) M. BOIE 2017-03-21 19:35:58
Do the right thing (no error) when an empty tree is present 7c138f486a81d09df44e811714d7bdeb92d7c01d Catalin(ux) M. BOIE 2017-03-21 19:34:03
Do not use UA when building anti-CSRF token. Think about plugins which change the UA at every request 7346fceeff8bea1eaa500dd3ce1677deb84f8b77 Catalin(ux) M. BOIE 2017-03-21 16:36:46
Do not create a namespace anymore if the user has the rights to push 13f8037ba76b57ae919758609c523dcbb6588745 Catalin(ux) M. BOIE 2017-03-19 19:44:07
Commit 1865405c40ebe92aa1bc6fd4569dcbb0e3af476c - Add possibility for admin to limit the git log --patch limit
Author: Catalin(ux) M. BOIE
Author date (UTC): 2017-04-15 09:28
Committer name: Catalin(ux) M. BOIE
Committer date (UTC): 2017-04-15 09:28
Parent(s): e6808bc97d201fd4944de0ad2982c3090ae4743a
Signer:
Signing key:
Signing status: N
Tree: 2081b51d44eb5a7416215ea6fc477827d98a88e3
File Lines added Lines deleted
inc/admin.inc.php 67 0
inc/git.inc.php 30 10
inc/mr.inc.php 2 1
inc/repo.inc.php 2 1
inc/user/repo-page.php 3 2
root/themes/default/admin/settings/git/hints.html 2 0
root/themes/default/admin/settings/git/main.html 20 0
root/themes/default/admin/settings/menu.html 1 0
tests/_run_tests.sh 1 1
tests/admin_set_git.php 8 12
tests/git.php 35 24
tests/git_log1.php 3 1
File inc/admin.inc.php changed (mode: 100644) (index b6d3fec..d297e7e)
... ... function rg_admin_settings_ssh($db, $rg)
619 619 return $ret; return $ret;
620 620 } }
621 621
622 /*
623 * Admin ->Settings -> Git menu
624 */
625 function rg_admin_settings_git($db, $rg)
626 {
627 global $rg_git_patch_limit_default;
628
629 rg_log_enter('admin_settings_git');
630
631 $ret = '';
632 $errmsg = array();
633 $hints = array();
634 while ($rg['doit'] == 1) {
635 if (!rg_valid_referer()) {
636 $errmsg[] = 'invalid referer; try again';
637 break;
638 }
639
640 if (!rg_token_valid($db, $rg, 'admin_settings_git', FALSE)) {
641 $errmsg[] = 'invalid token; try again';
642 break;
643 }
644
645 $v = rg_var_uint('git_patch_limit');
646 $r = rg_state_set($db, 'git_patch_limit', $v);
647 if ($r === FALSE) {
648 $errmsg[] = 'cannot set state; try again';
649 break;
650 }
651
652 $ret .= rg_template('admin/settings/ok.html',
653 $rg, TRUE /*xss*/);
654 break;
655 }
656
657 // Load defaults
658 while (1) {
659 $r = rg_state_get($db, 'git_patch_limit');
660 if ($r === FALSE) {
661 $ret = rg_template('admin/settings/load_err.html',
662 $rg, TRUE /*xss*/);
663 break;
664 }
665 if (empty($r))
666 $r = $rg_git_patch_limit_default;
667 $rg['git_patch_limit'] = $r;
668
669 $hints[]['HTML:hint'] = rg_template('admin/settings/git/hints.html',
670 $rg, TRUE /*xss*/);
671
672 $rg['HTML:hints'] = rg_template_table('hints/list', $hints, $rg);
673 $rg['HTML:errmsg'] = rg_template_errmsg($errmsg);
674 $rg['rg_form_token'] = rg_token_get($db, $rg,
675 'admin_settings_git');
676 $ret .= rg_template('admin/settings/git/main.html',
677 $rg, TRUE /*xss*/);
678 break;
679 }
680
681 rg_log_exit();
682 return $ret;
683 }
684
622 685 /* /*
623 686 * Deals with Admin -> Settings menu * Deals with Admin -> Settings menu
624 687 */ */
 
... ... function rg_admin_settings($db, &$rg, $paras)
642 705 $ret .= rg_admin_settings_ssh($db, $rg); $ret .= rg_admin_settings_ssh($db, $rg);
643 706 break; break;
644 707
708 case 'git':
709 $ret .= rg_admin_settings_git($db, $rg);
710 break;
711
645 712 default: default:
646 713 $ret .= rg_template('invalid_menu.html', $rg, TRUE /*xss*/); $ret .= rg_template('invalid_menu.html', $rg, TRUE /*xss*/);
647 714 break; break;
File inc/git.inc.php changed (mode: 100644) (index d76ab44..125262c)
... ... require_once($INC . "/log.inc.php");
4 4 require_once($INC . "/prof.inc.php"); require_once($INC . "/prof.inc.php");
5 5 require_once($INC . "/events.inc.php"); require_once($INC . "/events.inc.php");
6 6
7 if (!isset($rg_git_patch_limit))
8 $rg_git_patch_limit = 5000;
7 $rg_git_patch_limit_default = 5000;
9 8
10 9 $rg_git_debug = 0; $rg_git_debug = 0;
11 10
 
... ... function rg_git_fatal($msg)
39 38 exit(1); exit(1);
40 39 } }
41 40
41 /*
42 * Returns the limit for diff for 'git log --patch'
43 */
44 function rg_git_patch_limit($db)
45 {
46 global $rg_git_patch_limit_force;
47 global $rg_git_patch_limit_default;
48
49 // This is for functionl tests
50 if (isset($rg_git_patch_limit_force))
51 return $rg_git_patch_limit_force;
52
53 $r = rg_state_get($db, 'git_patch_limit');
54 if (($r === FALSE) || empty($r))
55 return $rg_git_patch_limit_default;
56
57 return intval($r);
58 }
59
42 60 /* /*
43 61 * Returns the short version for a reference * Returns the short version for a reference
44 62 */ */
 
... ... function rg_git_diff2array($diff, &$out)
848 866 * TODO: $also_merges: remove --no-merges * TODO: $also_merges: remove --no-merges
849 867 * 'simple' because rg_git_log will do the filtering of big diffs. * 'simple' because rg_git_log will do the filtering of big diffs.
850 868 */ */
851 function rg_git_log_simple($repo_path, $max, $from, $to, $also_patch, $files)
869 function rg_git_log_simple($repo_path, $max, $from, $to, $also_patch, $files,
870 $patch_limit)
852 871 { {
853 872 global $rg_git_debug; global $rg_git_debug;
854 global $rg_git_patch_limit;
855 873
856 874 rg_prof_start('git_log_simple'); rg_prof_start('git_log_simple');
857 875 rg_log_enter('git_log_simple: repo_path=' . $repo_path rg_log_enter('git_log_simple: repo_path=' . $repo_path
858 876 . ' max=' . $max . ' from=' . $from . ' to=' . $to . ' max=' . $max . ' from=' . $from . ' to=' . $to
859 877 . ' also_patch=' . ($also_patch ? 'true' : 'false') . ' also_patch=' . ($also_patch ? 'true' : 'false')
860 . ' files:' . rg_array2string($files));
878 . ' files:' . rg_array2string($files)
879 . ' patch_limit=' . $patch_limit);
861 880
862 881 $ret = FALSE; $ret = FALSE;
863 882 while (1) { while (1) {
 
... ... function rg_git_log_simple($repo_path, $max, $from, $to, $also_patch, $files)
1023 1042 //rg_log('DEBUG: File [' . $f . '] ' //rg_log('DEBUG: File [' . $f . '] '
1024 1043 // . $changes . ' changes'); // . $changes . ' changes');
1025 1044 $y['files'][$f]['oversize_diff'] = $y['files'][$f]['oversize_diff'] =
1026 $changes > $rg_git_patch_limit ? 1 : 0;
1045 $changes > $patch_limit ? 1 : 0;
1027 1046
1028 1047 // Add to total // Add to total
1029 1048 $y['vars']['lines_add'] += $y['files'][$f]['lines_add']; $y['vars']['lines_add'] += $y['files'][$f]['lines_add'];
 
... ... function rg_git_log_detect_big_diff($stat, $from)
1166 1185 * TODO: $also_merges: remove --no-merges * TODO: $also_merges: remove --no-merges
1167 1186 * '@from' - it will be excluded from the list of commits * '@from' - it will be excluded from the list of commits
1168 1187 */ */
1169 function rg_git_log($repo_path, $max, $from, $to, $also_patch)
1188 function rg_git_log($repo_path, $max, $from, $to, $also_patch, $patch_limit)
1170 1189 { {
1171 1190 rg_prof_start('git_log'); rg_prof_start('git_log');
1172 1191 rg_log_enter('git_log: repo_path=' . $repo_path . ' from=' . $from rg_log_enter('git_log: repo_path=' . $repo_path . ' from=' . $from
 
... ... function rg_git_log($repo_path, $max, $from, $to, $also_patch)
1176 1195 while (1) { while (1) {
1177 1196 $good_files = array(); // = all $good_files = array(); // = all
1178 1197 $stat = rg_git_log_simple($repo_path, $max, $from, $to, $stat = rg_git_log_simple($repo_path, $max, $from, $to,
1179 FALSE /*also_patch*/, $good_files);
1198 FALSE /*also_patch*/, $good_files, $patch_limit);
1180 1199
1181 1200 // First, if 'also_path' is FALSE, we just call simple version // First, if 'also_path' is FALSE, we just call simple version
1182 1201 // because we do not show a diff which should be filtered. // because we do not show a diff which should be filtered.
 
... ... function rg_git_log($repo_path, $max, $from, $to, $also_patch)
1189 1208 if (empty($r)) { // = no big diff if (empty($r)) { // = no big diff
1190 1209 $good_files = array(); // = all $good_files = array(); // = all
1191 1210 $ret = rg_git_log_simple($repo_path, $max, $from, $to, $ret = rg_git_log_simple($repo_path, $max, $from, $to,
1192 $also_patch, $good_files);
1211 $also_patch, $good_files, $patch_limit);
1193 1212 break; break;
1194 1213 } }
1195 1214
 
... ... function rg_git_log($repo_path, $max, $from, $to, $also_patch)
1202 1221 $_files = $i['good_files']; $_files = $i['good_files'];
1203 1222
1204 1223 $x = rg_git_log_simple($repo_path, 0 /*max*/, $x = rg_git_log_simple($repo_path, 0 /*max*/,
1205 $i['from'], $i['to'], $also_patch, $_files);
1224 $i['from'], $i['to'], $also_patch, $_files,
1225 $patch_limit);
1206 1226 if ($x === FALSE) if ($x === FALSE)
1207 1227 break; break;
1208 1228 //rg_log_ml('DEBUG: x: ' . print_r($x, TRUE)); //rg_log_ml('DEBUG: x: ' . print_r($x, TRUE));
File inc/mr.inc.php changed (mode: 100644) (index 8564878..b6589ea)
... ... function rg_mr_high_level($db, &$rg, $paras)
499 499 } }
500 500 } }
501 501
502 $patch_limit = rg_git_patch_limit($db);
502 503 $_log = rg_git_log($rg['repo_path'], 0, $mri['old_rev'], $_log = rg_git_log($rg['repo_path'], 0, $mri['old_rev'],
503 $mri['new_rev'], TRUE);
504 $mri['new_rev'], TRUE /*also_patch*/, $patch_limit);
504 505 if ($_log === FALSE) { if ($_log === FALSE) {
505 506 $ret .= rg_warning('Error generating patch.'); $ret .= rg_warning('Error generating patch.');
506 507 break; break;
File inc/repo.inc.php changed (mode: 100644) (index 3e2abed..34e5165)
... ... function rg_repo_stats($rg)
2136 2136 } }
2137 2137
2138 2138 $path = rg_repo_path_by_id($rg['ri']['uid'], $rg['ri']['repo_id']); $path = rg_repo_path_by_id($rg['ri']['uid'], $rg['ri']['repo_id']);
2139 $log = rg_git_log($path, 0 /*max*/, '', '', FALSE);
2139 $log = rg_git_log($path, 0 /*max*/, '', '', FALSE /*also_patch*/,
2140 0 /*patch_limit*/);
2140 2141 if ($log === FALSE) { if ($log === FALSE) {
2141 2142 $ret = rg_template('internal_err.html', $rg, TRUE /*xss*/); $ret = rg_template('internal_err.html', $rg, TRUE /*xss*/);
2142 2143 break; break;
File inc/user/repo-page.php changed (mode: 100644) (index 201efb0..a8465c6)
... ... if (strcmp($_subop, "history") == 0) {
229 229 } }
230 230 } else { // show the log } else { // show the log
231 231 // TODO: improve the error report (error or empty?) // TODO: improve the error report (error or empty?)
232 $log = rg_git_log($rg['repo_path'], 10, '', $ref, FALSE);
232 $log = rg_git_log($rg['repo_path'], 10, '', $ref, FALSE, 0);
233 233 if ($log === FALSE) { if ($log === FALSE) {
234 234 $_repo_body .= rg_template("repo/not_init.html", $rg, $_repo_body .= rg_template("repo/not_init.html", $rg,
235 235 TRUE /*xss*/); TRUE /*xss*/);
 
... ... if (strcmp($_subop, "history") == 0) {
266 266 $rg['HTML:commit_labels'] = rg_repo_commit_labels_html( $rg['HTML:commit_labels'] = rg_repo_commit_labels_html(
267 267 $db, $rg['ri']['repo_id'], $commit); $db, $rg['ri']['repo_id'], $commit);
268 268
269 $patch_limit = rg_git_patch_limit($db);
269 270 $log = rg_git_log($rg['repo_path'], 1, $first, $second, $log = rg_git_log($rg['repo_path'], 1, $first, $second,
270 TRUE);
271 TRUE /*also_patch*/, $patch_limit);
271 272 $_repo_body .= rg_git_log2listing($log, $rg, FALSE); $_repo_body .= rg_git_log2listing($log, $rg, FALSE);
272 273 } }
273 274 } }
File root/themes/default/admin/settings/git/hints.html added (mode: 100644) (index 0000000..2d26d80)
1 <br />
2 Default for the number of changes (added + deletet lines) is 5000.
File root/themes/default/admin/settings/git/main.html added (mode: 100644) (index 0000000..c7dcb5e)
1 <div class="formarea">
2
3 <div class="formarea_title">Git settings</div>
4
5 @@errmsg@@
6
7 <form method="post" action="@@url@@">
8 <input type="hidden" name="doit" value="1" />
9 <input type="hidden" name="token" value="@@rg_form_token@@" />
10
11 <p>
12 <label for="git_patch_limit">Maximum number of changes allowed for 'git log --patch' command</label><br />
13 <input type="text" name="git_patch_limit" id="git_patch_limit" value="@@git_patch_limit@@" />
14 </p>
15
16 <input type="submit" value="Update" />
17 </form>
18 </div>
19
20 @@hints@@
File root/themes/default/admin/settings/menu.html changed (mode: 100644) (index 3e7d824..6ea52e1)
1 1 <div class="menu menu3"> <div class="menu menu3">
2 2 <ul> <ul>
3 3 <li@@if(@@admin_settings_menu::ssh@@ == 1){{ class="selected"}}{{}}><a href="/op/admin/settings/ssh">SSH</a></li> <li@@if(@@admin_settings_menu::ssh@@ == 1){{ class="selected"}}{{}}><a href="/op/admin/settings/ssh">SSH</a></li>
4 <li@@if(@@admin_settings_menu::git@@ == 1){{ class="selected"}}{{}}><a href="/op/admin/settings/git">Git</a></li>
4 5 </ul> </ul>
5 6 </div> </div>
File tests/_run_tests.sh changed (mode: 100755) (index c5008c4..6f3fe70)
1 1 #!/bin/bash #!/bin/bash
2 2
3 tests="by_http wh_lambda http_keys http_forgot \
3 tests="admin_set_git by_http wh_lambda http_keys http_forgot \
4 4 api wh_cloud pr_anon wh_http ssh http_totp totp git_log1 \ api wh_cloud pr_anon wh_http ssh http_totp totp git_log1 \
5 5 http_admin http_bug \ http_admin http_bug \
6 6 http_create_account http_login http_settings http_csrf http_top \ http_create_account http_login http_settings http_csrf http_top \
File tests/admin_set_git.php copied from file tests/http_keys.php (similarity 73%) (mode: 100644) (index fc51b0a..e79f4a5)
... ... require_once($INC . '/util.inc.php');
11 11 require_once('helpers.inc.php'); require_once('helpers.inc.php');
12 12 require_once('http.inc.php'); require_once('http.inc.php');
13 13
14 rg_log_set_file('http_keys.log');
14 rg_log_set_file('admin_set_git.log');
15 15
16 16 $rg_sql = 'host=localhost user=rocketgit dbname=rocketgit connect_timeout=10'; $rg_sql = 'host=localhost user=rocketgit dbname=rocketgit connect_timeout=10';
17 17 $rg_no_db = TRUE; $rg_no_db = TRUE;
18 18 require_once('common.php'); require_once('common.php');
19 19
20 $_testns = 'http_keys';
20 $_testns = 'admin_set_git';
21 21 $rg_cache_enable = TRUE; $rg_cache_enable = TRUE;
22 22 $rg_cache_debug = TRUE; $rg_cache_debug = TRUE;
23 23
 
... ... test_login($test_url, $rg_ui, $good_sid);
27 27
28 28
29 29 rg_log(''); rg_log('');
30 rg_log_enter('Loading Admin -> Settings -> SSH...');
30 rg_log_enter('Loading Admin -> Settings -> Git...');
31 31 $data = array(); $data = array();
32 32 $headers = array("Cookie: sid=" . $good_sid); $headers = array("Cookie: sid=" . $good_sid);
33 $r = do_req($test_url . '/op/admin/settings/ssh', $data, $headers);
33 $r = do_req($test_url . '/op/admin/settings/git', $data, $headers);
34 34 if ($r === FALSE) { if ($r === FALSE) {
35 35 rg_log("Cannot load page!"); rg_log("Cannot load page!");
36 36 exit(1); exit(1);
37 37 } }
38 if (!isset($r['tokens']['admin_settings_ssh'])) {
38 if (!isset($r['tokens']['admin_settings_git'])) {
39 39 rg_log_ml('r:' . print_r($r, TRUE)); rg_log_ml('r:' . print_r($r, TRUE));
40 40 rg_log("No token?!"); rg_log("No token?!");
41 41 exit(1); exit(1);
42 42 } }
43 $token = $r['tokens']['admin_settings_ssh'];
43 $token = $r['tokens']['admin_settings_git'];
44 44
45 45 rg_log('Posting the form...'); rg_log('Posting the form...');
46 46 $data = array( $data = array(
 
... ... $data = array(
48 48 'token' => $token 'token' => $token
49 49 ); );
50 50 $list = array( $list = array(
51 'max_ssh_keys' => 10,
52 'ssh_key_min_bits_rsa' => 2048,
53 'ssh_key_allow_dsa' => 0,
54 'ssh_key_min_bits_ecdsa' => 256,
55 'AuthorizedKeysCommand' => 1
51 'git_patch_limit' => rand(5000, 7000)
56 52 ); );
57 53 foreach ($list as $var => $def) { foreach ($list as $var => $def) {
58 54 $v = rg_state_get($db, $var); $v = rg_state_get($db, $var);
 
... ... foreach ($list as $var => $def) {
65 61 else else
66 62 $data[$var] = $v; $data[$var] = $v;
67 63 } }
68 $r = do_req($test_url . '/op/admin/settings/ssh', $data, $headers);
64 $r = do_req($test_url . '/op/admin/settings/git', $data, $headers);
69 65 if (!strstr($r['body'], 'Configuration has been successfully saved.')) { if (!strstr($r['body'], 'Configuration has been successfully saved.')) {
70 66 rg_log_ml('r: ' . print_r($r, TRUE)); rg_log_ml('r: ' . print_r($r, TRUE));
71 67 rg_log("Cannot post form!"); rg_log("Cannot post form!");
File tests/git.php changed (mode: 100644) (index eefbc95..60db4e1)
... ... $rg_no_db = TRUE;
13 13 require_once("common.php"); require_once("common.php");
14 14
15 15 $rg_git_debug = 100; $rg_git_debug = 100;
16 $patch_limit = rg_git_patch_limit($db);
16 17
17 18 rg_log(''); rg_log('');
18 19 rg_log("Testing rg_git_log with a rename"); rg_log("Testing rg_git_log with a rename");
 
... ... if ($r['ok'] != 1) {
30 31 rg_log('Could not exec repo script: ' . $r['errmsg'] . '!'); rg_log('Could not exec repo script: ' . $r['errmsg'] . '!');
31 32 exit(1); exit(1);
32 33 } }
33 $r = rg_git_log('temp_repos/git_rename/.git', 1, '', '', TRUE);
34 $r = rg_git_log('temp_repos/git_rename/.git', 1, '', '', TRUE, $patch_limit);
34 35 if (@strcmp($r[0]['files']['aclone']['file_from'], 'a') != 0) { if (@strcmp($r[0]['files']['aclone']['file_from'], 'a') != 0) {
35 36 rg_log_ml(print_r($r, TRUE)); rg_log_ml(print_r($r, TRUE));
36 rg_log('git_bin: r[0][files][aclone][file_from] is not "a"!');
37 rg_log('git_bin: r[0][files][aclone][file_from] is not "a" ('
38 . @$r[0]['files']['aclone']['file_from'] . ')!');
37 39 exit(1); exit(1);
38 40 } }
39 41 if (@$r[0]['files']['aclone']['lines_add'] != 0) { if (@$r[0]['files']['aclone']['lines_add'] != 0) {
40 42 rg_log_ml(print_r($r, TRUE)); rg_log_ml(print_r($r, TRUE));
41 rg_log('git_bin: r[0][files][aclone][lines_add] is not 0!');
43 rg_log('git_bin: r[0][files][aclone][lines_add] is not 0 ('
44 . @$r[0]['files']['aclone']['lines_add'] . ')!');
42 45 exit(1); exit(1);
43 46 } }
44 47 if (@!strstr($r[0]['files']['aclone']['flags'], 'C')) { if (@!strstr($r[0]['files']['aclone']['flags'], 'C')) {
45 48 rg_log_ml(print_r($r, TRUE)); rg_log_ml(print_r($r, TRUE));
46 rg_log('git_bin: r[0][files][aclone][flags] does not containc "C"!');
49 rg_log('git_bin: r[0][files][aclone][flags] does not containc "C" ('
50 . @$r[0]['files']['aclone']['flags'] . ')!');
47 51 exit(1); exit(1);
48 52 } }
49 53 if (@strcmp($r[0]['files']['b2']['file_from'], 'b') != 0) { if (@strcmp($r[0]['files']['b2']['file_from'], 'b') != 0) {
50 54 rg_log_ml(print_r($r, TRUE)); rg_log_ml(print_r($r, TRUE));
51 rg_log('git_bin: r[0][files][b2][file_from] is not "b"!');
55 rg_log('git_bin: r[0][files][b2][file_from] is not "b" ('
56 . @$r[0]['files']['b2']['file_from'] . ')!');
52 57 exit(1); exit(1);
53 58 } }
54 59 if (@$r[0]['files']['b2']['lines_add'] != 0) { if (@$r[0]['files']['b2']['lines_add'] != 0) {
55 60 rg_log_ml(print_r($r, TRUE)); rg_log_ml(print_r($r, TRUE));
56 rg_log('git_bin: r[0][files][b2][lines_add] is not 0!');
61 rg_log('git_bin: r[0][files][b2][lines_add] is not 0 ('
62 . @$r[0]['files']['b2']['lines_add'] . ')!');
57 63 exit(1); exit(1);
58 64 } }
59 65 if (@!strstr($r[0]['files']['b2']['flags'], 'R')) { if (@!strstr($r[0]['files']['b2']['flags'], 'R')) {
60 66 rg_log_ml(print_r($r, TRUE)); rg_log_ml(print_r($r, TRUE));
61 rg_log('git_bin: r[0][files][b2][flags] does not containc "C"!');
67 rg_log('git_bin: r[0][files][b2][flags] does not containc "C" ('
68 . @$r[0]['files']['b2']['flags'] . ')!');
62 69 exit(1); exit(1);
63 70 } }
64 71 system("rm -rf temp_repos/git_rename"); system("rm -rf temp_repos/git_rename");
 
... ... if ($r['ok'] != 1) {
78 85 rg_log('Could not exec repo script: ' . $r['errmsg'] . '!'); rg_log('Could not exec repo script: ' . $r['errmsg'] . '!');
79 86 exit(1); exit(1);
80 87 } }
81 $r = rg_git_log('temp_repos/git_bin/.git', 0, '', '', TRUE);
88 $r = rg_git_log('temp_repos/git_bin/.git', 0, '', '', TRUE, $patch_limit);
82 89 if (@$r[0]['vars']['lines_add'] != 0) { if (@$r[0]['vars']['lines_add'] != 0) {
83 90 rg_log_ml(print_r($r, TRUE)); rg_log_ml(print_r($r, TRUE));
84 rg_log('git_bin: r[0][vars][lines_add] is not 0!');
91 rg_log('git_bin: r[0][vars][lines_add] is not 0 ('
92 . @$r[0]['vars']['lines_add'] . ')!');
85 93 exit(1); exit(1);
86 94 } }
87 95 if (@$r[0]['vars']['lines_del'] != 0) { if (@$r[0]['vars']['lines_del'] != 0) {
88 96 rg_log_ml(print_r($r, TRUE)); rg_log_ml(print_r($r, TRUE));
89 rg_log('git_bin: r[0][vars][lines_del] is not 0!');
97 rg_log('git_bin: r[0][vars][lines_del] is not 0 ('
98 . @$r[0]['vars']['lines_del'] . ')!');
90 99 exit(1); exit(1);
91 100 } }
92 101 if (@strcmp($r[0]['files']['a']['mode'], '100644') != 0) { if (@strcmp($r[0]['files']['a']['mode'], '100644') != 0) {
93 102 rg_log_ml(print_r($r, TRUE)); rg_log_ml(print_r($r, TRUE));
94 rg_log('git_bin: r[0][files][a][mode] is not 100644!');
103 rg_log('git_bin: r[0][files][a][mode] is not 100644 ('
104 . @$r[0]['files']['a']['mode'] . ')!');
95 105 exit(1); exit(1);
96 106 } }
97 107 system("rm -rf temp_repos/git_bin"); system("rm -rf temp_repos/git_bin");
 
... ... system("rm -rf git.tmp");
141 151
142 152 rg_log(''); rg_log('');
143 153 rg_log_enter('Testing rg_git_log with a big diff...'); rg_log_enter('Testing rg_git_log with a big diff...');
144 $rg_git_patch_limit = 5;
145 154 $r = rg_exec('mkdir -p temp_repos && cd temp_repos' $r = rg_exec('mkdir -p temp_repos && cd temp_repos'
146 155 . ' && rm -rf git_big_diff && mkdir git_big_diff && cd git_big_diff' . ' && rm -rf git_big_diff && mkdir git_big_diff && cd git_big_diff'
147 156 . ' && git init' . ' && git init'
 
... ... if ($r['ok'] != 1) {
172 181 rg_log('Could not exec repo script: ' . $r['errmsg'] . '!'); rg_log('Could not exec repo script: ' . $r['errmsg'] . '!');
173 182 exit(1); exit(1);
174 183 } }
175 $r = rg_git_log('temp_repos/git_big_diff/.git', 0, '', '', TRUE);
184 $r = rg_git_log('temp_repos/git_big_diff/.git', 0, '', '', TRUE /*also_patch*/,
185 5 /*patch_limit*/);
186 if (empty($r[1]['files']['b']['chunks'])) {
187 rg_log_ml(@print_r($r[1], TRUE));
188 rg_log('r[1][files][b][chunks] is empty!');
189 exit(1);
190 }
176 191 if (@$r[2]['vars']['lines_add'] != 2) { if (@$r[2]['vars']['lines_add'] != 2) {
177 rg_log_ml(print_r($r, TRUE));
178 rg_log('git_bin: lines_add is incorrect');
192 rg_log_ml(@print_r($r[2], TRUE));
193 rg_log('lines_add is != 2 (' . @$r[2]['vars']['lines_add'] . ')');
179 194 exit(1); exit(1);
180 195 } }
181 196 if (@$r[2]['files']['a']['oversize_diff'] != 1) { if (@$r[2]['files']['a']['oversize_diff'] != 1) {
182 rg_log_ml(print_r($r, TRUE));
183 rg_log('git_bin: r[2][files][a][oversize_diff] is not 1!');
197 rg_log_ml('r[2]: ' . @print_r($r[2], TRUE));
198 rg_log('r[2][files][a][oversize_diff] is not 1 ('
199 . @@$r[2]['files']['a']['oversize_diff'] . ')!');
184 200 exit(1); exit(1);
185 201 } }
186 202 if (!empty($r[2]['files']['a']['chunks'])) { if (!empty($r[2]['files']['a']['chunks'])) {
187 rg_log_ml(print_r($r, TRUE));
188 rg_log('git_bin: r[2][files][a][chunks] is not empty!');
189 exit(1);
190 }
191 if (empty($r[1]['files']['b']['chunks'])) {
192 rg_log_ml(print_r($r, TRUE));
193 rg_log('git_bin: r[1][files][b][chunks] is empty!');
203 rg_log_ml(@print_r($r[2], TRUE));
204 rg_log('r[2][files][a][chunks] is not empty!');
194 205 exit(1); exit(1);
195 206 } }
196 207 system('rm -rf temp_repos/git_big_diff'); system('rm -rf temp_repos/git_big_diff');
File tests/git_log1.php changed (mode: 100644) (index c93752a..05244ce)
... ... rg_log_set_file(dirname(__FILE__) . "/git_log1.log");
14 14 $rg_no_db = TRUE; $rg_no_db = TRUE;
15 15 require_once("common.php"); require_once("common.php");
16 16
17 $patch_limit = rg_git_patch_limit($db);
18
17 19 // test rg_log // test rg_log
18 20 $path = dirname(__FILE__) . "/git_log1/.git"; $path = dirname(__FILE__) . "/git_log1/.git";
19 21 $max = 0; $max = 0;
20 22 $from = ""; $from = "";
21 23 $to = ""; $to = "";
22 24 $also_patch = TRUE; $also_patch = TRUE;
23 $r = rg_git_log($path, $max, $from, $to, $also_patch);
25 $r = rg_git_log($path, $max, $from, $to, $also_patch, $patch_limit);
24 26 if ($r === FALSE) { if ($r === FALSE) {
25 27 rg_log("Cannot generate log (" . rg_git_error() . ")!"); rg_log("Cannot generate log (" . rg_git_error() . ")!");
26 28 exit(1); exit(1);
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