Git 网页界面
我正在尝试使 viewgit 界面适用于我的项目。
然而,我在 PHP exec 中遇到了这个奇怪的问题:
这两个 unix 命令在我的 viewgit/ 目录中工作:
/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
但是
/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();
,当使用 php exec 时,只有第一个命令返回输出:
$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 实际上包含来自命令行的数据。 ..但是,$output_2 是空的!
关于造成这种情况的原因有什么想法吗?
谢谢
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 ... however, $output_2 is empty !
Any ideas on what is causing this ?
Thx
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
经过一番懊恼之后,我终于找到了一个解决方案......逃避^。
所以我深入研究了代码并替换为:
其他地方可能存在类似的问题,但
仍然没有解决它们。
After much chagrin I finally landed on a solution....escape the ^.
So I digged into the code and replaced:
with
there might be similar problems elsewhere, still haven't landed on them yet.