Git Web Interface
I am trying to make a viewgit frontend for my projects.
However, I am facing this curious issue with PHP exec:
These 2 unix commands work from 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 the 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 indeed contain data from the command line ... however $ output_2 is empty!
Any ideas on what is causing this?
thank
+2
source to share
1 answer
After much chagrin, I finally landed on a solution ... avoid ^.
So, I dug up the code and replaced:
$ text = git_diff ($ page ['project'], "$ hash ^", $ hash);
from
$ text = git_diff ($ page ['project'], "$ hash \ ^", $ hash);
there may be similar problems elsewhere, still not landed on them.
+2
source to share