Git Web Interface
I am trying to make the viewgit interface work for my projects.
However I am running into this curious issue with PHP exec:
These 2 unix commands work from inside my viewgit/ directory:
/viewgit-> GIT_DIR=/usr/local/apache2/htdocs/repo/.git git rev-list --header --max-count=1 c19e231ad87413798b6a1387a98ec814836fda1e 19e231ad87413798b6a1387a98ec814836fda1e c19e231ad87413798b6a1387a98ec814836fda1e tree 4351aa5fb93c3a093902577e5a58138280851152 parent 5099ea6747f8b8a532d153f0536e7be956532a33 author John.smith514-490-6597 1255981013 -0400 committer John.Smith514-490-6597 1255981013 -0400
and
/viewgit-> GIT_DIR=/usr/local/apache2/htdocs/repo/.git git diff c19e231ad87413798b6a1387a98ec814836fda1e^..c19e231ad87413798b6a1387a98ec814836fda1e diff --git a/bootstrap.php b/bootstrap.php index 6cc6336..857890b 100755 --- a/bootstrap.php +++ b/bootstrap.php @@ -17,7 +17,7 @@ ); // ZEND LIBRARY - //-------------------------------------- + //--------------------------------------- // 1.7 //require_once "Zend/Loader.php"; //Zend_Loader::registerAutoload();
however when using php exec only the first one returns an output:
$output_1 = array(); $output_2 = array(); $cmd_1 = "GIT_DIR=/usr/local/apache2/htdocs/repo/.git git rev-list --header --max-count=1 c19e231ad87413798b6a1387a98ec814836fda1e"; $cmd_2 = "GIT_DIR=/usr/local/apache2/htdocs/repo/.git git diff c19e231ad87413798b6a1387a98ec814836fda1e^..c19e231ad87413798b6a1387a98ec814836fda1e"; exec($cmd_1, $output_1, $ret); exec($cmd_2, $output_2, $ret);
$output_1 does infact contain the data from the command line ...开发者_StackOverflow中文版 however, $output_2 is empty !
Any ideas on what is causing this ?
Thx
After much chagrin I finally landed on a solution....escape the ^.
So I digged into the code and replaced:
$text = git_diff($page['project'], "$hash^", $hash);
with
$text = git_diff($page['project'], "$hash\^", $hash);
there might be similar problems elsewhere, still haven't landed on them yet.
精彩评论