【问题标题】:Git Web InterfaceGit 网页界面
【发布时间】:2009-10-19 21:59:20
【问题描述】:

我正在尝试使 viewgit 界面适用于我的项目。

但是我在 PHP exec 中遇到了这个奇怪的问题:

这 2 个 unix 命令在我的 viewgit/ 目录中工作:

/viewgit-> GIT_DIR=/usr/local/apache2/htdocs/repo/.git git rev-list --header --max-count=1 c19e231ad87413798b6a1387a98ec814836fda1e 19e231ad87413798b6a1387a98ec814836fda1e c19e231ad87413798b6a1387a98ec814836fda1e 树 4351aa5fb93c3a093902577e5a58138280851152 父 5099ea6747f8b8a532d153f0536e7be956532a33 作者 John.smith514-490-6597 1255981013 -0400 提交者 John.Smith514-490-6597 1255981013 -0400

/viewgit-> GIT_DIR=/usr/local/apache2/htdocs/repo/.git git diff c19e231ad87413798b6a1387a98ec814836fda1e^..c19e231ad87413798b6a1387a98ec814836fda1e 差异 --git a/bootstrap.php b/bootstrap.php 索引 6cc6336..857890b 100755 --- a/bootstrap.php +++ b/bootstrap.php @@ -17,7 +17,7 @@ ); // ZEND 库 - //---------------------------------------- + //---------------------------------------- // 1.7 //require_once "Zend/Loader.php"; //Zend_Loader::registerAutoload();

但是,当使用 php exec 时,只有第一个返回输出:

$output_1 = 数组(); $output_2 = 数组(); $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"; 执行($cmd_1,$output_1,$ret); 执行($cmd_2,$output_2,$ret);

$output_1 实际上包含来自命令行的数据...但是,$output_2 是空的!

关于造成这种情况的任何想法?

谢谢

【问题讨论】:

  • 好像是某个地方的权限问题,但是找不到
  • 好吧,我已经取得了一些进展,以“守护进程”身份登录并直接从 shell 运行命令,cmd_2 不起作用!似乎 ^ 指定提交标识符导致守护程序执行后面的内容,因此在这种情况下:..c19e231ad87413798b6a1387a98ec814836fda1e

标签: php git gitweb


【解决方案1】:

经过一番懊恼,我终于找到了一个解决方案....逃脱了^。

于是我深入研究代码并替换:

$text = git_diff($page['project'], "$hash^", $hash);

$text = git_diff($page['project'], "$hash\^", $hash);

其他地方可能也有类似的问题,还没有遇到。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-12-22
    • 1970-01-01
    • 1970-01-01
    • 2015-04-25
    相关资源
    最近更新 更多