function git_invoke($command, $fail_safe = FALSE, $repository_path = NULL, $env = NULL) { if (!isset($env)) { $env = $_ENV; } if ($repository_path) { $env['GIT_DIR'] = $repository_path; } $descriptor_spec = array(1 => array('pipe', 'w'), 2 => array('pipe', 'w')); git_log('Invoking ' . $command, 'DEBUG'); $process = proc_open($command, $descriptor_spec, $pipes, NULL, $env); if (is_resource($process)) { $stdout = stream_get_contents($pipes[1]); fclose($pipes[1]); $stderr = stream_get_contents($pipes[2]); fclose($pipes[2]); $return_code = proc_close($process); if ($return_code != 0 && !$fail_safe) { throw new Exception("Invocation of '" . $command . "' failed with return code " . $return_code . ": \n" . $stdout . $stderr); } return $stdout; } }
switch ($_GET['a']) { case "summary": require_once 'include/display.git_summary.php'; git_summary($gitphp_conf['projectroot'], $project); break; case "tree": require_once 'include/display.git_tree.php'; git_tree($gitphp_conf['projectroot'], $project, isset($_GET['h']) ? $_GET['h'] : NULL, isset($_GET['f']) ? $_GET['f'] : NULL, isset($_GET['hb']) ? $_GET['hb'] : NULL); break; case "shortlog": require_once 'include/display.git_shortlog.php'; git_shortlog($gitphp_conf['projectroot'], $project, isset($_GET['h']) ? $_GET['h'] : NULL, isset($_GET['pg']) ? $_GET['pg'] : NULL); break; case "log": require_once 'include/display.git_log.php'; git_log($gitphp_conf['projectroot'], $project, isset($_GET['h']) ? $_GET['h'] : NULL, isset($_GET['pg']) ? $_GET['pg'] : NULL); break; case "commit": require_once 'include/display.git_commit.php'; git_commit($gitphp_conf['projectroot'], $project, $_GET['h']); break; case "commitdiff": require_once 'include/display.git_commitdiff.php'; git_commitdiff($gitphp_conf['projectroot'], $project, $_GET['h'], isset($_GET['hp']) ? $_GET['hp'] : NULL); break; case "commitdiff_plain": require_once 'include/display.git_commitdiff_plain.php'; git_commitdiff_plain($gitphp_conf['projectroot'], $project, $_GET['h'], isset($_GET['hp']) ? $_GET['hp'] : NULL); break; case "heads": require_once 'include/display.git_heads.php';
function _clean_up_import($dir) { git_log("Cleaning up import temp directory {$dir}.", 'DEBUG'); passthru('rm -Rf ' . escapeshellarg($dir)); }
case 1: // Pull from sources //$rslt = git_pull_all($directory,$sources); $id = ${"_" . _STYPE}['id']; $rslt = git_pull($directory[$id], $sources[$id]); break; case 2: // Init new repo break; case 3: // Delete this repo break; case 4: // Git log //$rslt = git_log_all($directory); $rslt = git_log(${"_" . _STYPE}['dir']); break; } } else { echo ""; } } echo "<html><head></head><body>"; /* echo "<form method='"._STYPE."' action='".$_SERVER['PHP_SELF']."'> <input type='hidden' name='id' value='$id'></input> <select name='action'> <option value='0' selected>Save</option> <option value='1'>Pull</option> <option value='2'>Initialise</option> <option value='3'>Delete</option>