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/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 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'); |