File inc/git.inc.php changed (mode: 100644) (index ee5fa2f..13a7dc6) |
... |
... |
function rg_git_ls_tree($repo_path, $tree, $path) |
640 |
640 |
} |
} |
641 |
641 |
|
|
642 |
642 |
$output = explode("\n", trim($a['data'])); |
$output = explode("\n", trim($a['data'])); |
|
643 |
|
unset($a['data']); // manually free data |
643 |
644 |
foreach ($output as $line) { |
foreach ($output as $line) { |
644 |
645 |
//rg_log('DEBUG: processing line [' . $line . ']'); |
//rg_log('DEBUG: processing line [' . $line . ']'); |
645 |
646 |
$_y = array(); |
$_y = array(); |
646 |
647 |
$_t = explode("\t", $line); |
$_t = explode("\t", $line); |
|
648 |
|
unset($line); // manually free data |
647 |
649 |
$_y['file'] = trim($_t[1]); |
$_y['file'] = trim($_t[1]); |
648 |
650 |
$_i = preg_replace("/([0-9]*) ([a-z]*) ([a-z0-9]*) ( *)([0-9]*)/", |
$_i = preg_replace("/([0-9]*) ([a-z]*) ([a-z0-9]*) ( *)([0-9]*)/", |
649 |
651 |
'${1} ${2} ${3} ${5}', $_t[0]); |
'${1} ${2} ${3} ${5}', $_t[0]); |
650 |
652 |
$_t = explode(" ", $_i); |
$_t = explode(" ", $_i); |
|
653 |
|
unset($_i); // manually free data |
651 |
654 |
$_y['mode'] = $_t[0]; |
$_y['mode'] = $_t[0]; |
652 |
655 |
$_y['mode_int'] = intval(base_convert($_t[0], 8, 10)); |
$_y['mode_int'] = intval(base_convert($_t[0], 8, 10)); |
653 |
656 |
if (($_y['mode_int'] & GIT_LINK_MASK) == GIT_LINK_MASK) |
if (($_y['mode_int'] & GIT_LINK_MASK) == GIT_LINK_MASK) |
|
... |
... |
function rg_git_diff2array($diff, &$out) |
684 |
687 |
|
|
685 |
688 |
$ret = TRUE; |
$ret = TRUE; |
686 |
689 |
$lines = explode("\n", $diff); |
$lines = explode("\n", $diff); |
|
690 |
|
unset($diff); // manually free data |
687 |
691 |
//rg_log_ml("DEBUG: lines: " . print_r($lines, TRUE)); |
//rg_log_ml("DEBUG: lines: " . print_r($lines, TRUE)); |
688 |
692 |
foreach ($lines as $line) { |
foreach ($lines as $line) { |
689 |
693 |
if ($rg_git_debug > 90) |
if ($rg_git_debug > 90) |
|
... |
... |
function rg_git_diff2array($diff, &$out) |
704 |
708 |
$rest = trim($rest, '"'); |
$rest = trim($rest, '"'); |
705 |
709 |
$rest = substr($rest, 2); /* skip 'a/' */ |
$rest = substr($rest, 2); /* skip 'a/' */ |
706 |
710 |
$_t = explode(' b/', $rest); |
$_t = explode(' b/', $rest); |
|
711 |
|
unset($rest); // manually free data |
707 |
712 |
foreach ($_t as &$_file) { |
foreach ($_t as &$_file) { |
708 |
713 |
if (strncmp($_file, '"', 1) == 0) |
if (strncmp($_file, '"', 1) == 0) |
709 |
714 |
$_file = substr($_file, 1, -1); |
$_file = substr($_file, 1, -1); |
|
... |
... |
function rg_git_diff2array($diff, &$out) |
782 |
787 |
if (strncmp($line, "index ", 6) == 0) { |
if (strncmp($line, "index ", 6) == 0) { |
783 |
788 |
$rest = substr($line, 6); |
$rest = substr($line, 6); |
784 |
789 |
$_t = explode(' ', $rest); |
$_t = explode(' ', $rest); |
|
790 |
|
unset($rest); // manually free data |
785 |
791 |
$out[$file]['index'] = $_t[0]; |
$out[$file]['index'] = $_t[0]; |
786 |
792 |
if (isset($_t[1])) |
if (isset($_t[1])) |
787 |
793 |
$out[$file]['mode'] = $_t[1]; |
$out[$file]['mode'] = $_t[1]; |
|
... |
... |
function rg_git_log_simple($repo_path, $max, $from, $to, $also_patch, $files, |
945 |
951 |
if ($rg_git_debug > 70) |
if ($rg_git_debug > 70) |
946 |
952 |
rg_log_ml("DEBUG: OUTPUT OF GIT LOG: " . $a['data']); |
rg_log_ml("DEBUG: OUTPUT OF GIT LOG: " . $a['data']); |
947 |
953 |
|
|
948 |
|
// because data starts with the separator, we remove it |
|
949 |
954 |
$blocks = explode($sep_start, $a['data']); |
$blocks = explode($sep_start, $a['data']); |
|
955 |
|
unset($a['data']); // manually free memory |
|
956 |
|
// because data starts with the separator, we remove it |
950 |
957 |
unset($blocks[0]); |
unset($blocks[0]); |
951 |
958 |
|
|
952 |
959 |
//rg_log_ml('DEBUG: blocks: ' . print_r($blocks, TRUE)); |
//rg_log_ml('DEBUG: blocks: ' . print_r($blocks, TRUE)); |
|
... |
... |
function rg_git_log_simple($repo_path, $max, $from, $to, $also_patch, $files, |
960 |
967 |
|
|
961 |
968 |
// split block in two: vars and patches |
// split block in two: vars and patches |
962 |
969 |
$parts = explode($sep_end, $block, 2); |
$parts = explode($sep_end, $block, 2); |
|
970 |
|
unset($block); // manually free memory |
963 |
971 |
//rg_log_ml('DEBUG: parts: ' . print_r($parts, TRUE)); |
//rg_log_ml('DEBUG: parts: ' . print_r($parts, TRUE)); |
964 |
972 |
|
|
965 |
973 |
// vars |
// vars |
966 |
974 |
$y['vars']['lines_add'] = 0; |
$y['vars']['lines_add'] = 0; |
967 |
975 |
$y['vars']['lines_del'] = 0; |
$y['vars']['lines_del'] = 0; |
968 |
976 |
$x = explode ("\0", $parts[0]); |
$x = explode ("\0", $parts[0]); |
|
977 |
|
unset($parts[0]); // manually free data |
969 |
978 |
$count = count($x) - 1; // last is empty |
$count = count($x) - 1; // last is empty |
970 |
979 |
for ($i = 0; $i < $count; $i++) { |
for ($i = 0; $i < $count; $i++) { |
971 |
980 |
$_t = explode(':', $x[$i], 2); |
$_t = explode(':', $x[$i], 2); |
|
... |
... |
function rg_git_log_simple($repo_path, $max, $from, $to, $also_patch, $files, |
990 |
999 |
//rg_log_ml('DEBUG parts[1]: ' . print_r($parts[1], TRUE)); |
//rg_log_ml('DEBUG parts[1]: ' . print_r($parts[1], TRUE)); |
991 |
1000 |
// numstat [+ diff separated by \0\0] |
// numstat [+ diff separated by \0\0] |
992 |
1001 |
$n_d = explode("\0\0", $parts[1]); |
$n_d = explode("\0\0", $parts[1]); |
|
1002 |
|
unset($parts[1]); // manually free data |
993 |
1003 |
//rg_log_ml('DEBUG: n_d: ' . print_r($n_d, TRUE)); |
//rg_log_ml('DEBUG: n_d: ' . print_r($n_d, TRUE)); |
994 |
1004 |
|
|
995 |
1005 |
// numstat |
// numstat |
|
... |
... |
function rg_git_files($old, $new) |
1353 |
1363 |
} |
} |
1354 |
1364 |
|
|
1355 |
1365 |
$ret = explode("\n", trim($a['data'])); |
$ret = explode("\n", trim($a['data'])); |
|
1366 |
|
unset($a['data']); // manually free data |
1356 |
1367 |
break; |
break; |
1357 |
1368 |
} |
} |
1358 |
1369 |
|
|
|
... |
... |
function rg_git_diff_tree($tree1, $tree2) |
1942 |
1953 |
} |
} |
1943 |
1954 |
|
|
1944 |
1955 |
$output = explode("\n", trim($a['data'])); |
$output = explode("\n", trim($a['data'])); |
|
1956 |
|
unset($a['data']); // manually free data |
1945 |
1957 |
$ret = array(); |
$ret = array(); |
1946 |
1958 |
foreach ($output as $line) { |
foreach ($output as $line) { |
1947 |
1959 |
$_y = array(); |
$_y = array(); |