2

私は自分のプロジェクトでviewgitインターフェースを機能させようとしています。

しかし、私はPHPexecでこの奇妙な問題に遭遇しています。

これらの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-65971255981013-0400
コミッターJohn.Smith514-490-65971255981013-0400

/ viewgit-> GIT_DIR = / usr / local / apache2 / htdocs / repo / .git git diff c19e231ad87413798b6a1387a98ec814836fda1e ^ .. c19e231ad87413798b6a1387a98ec814836fda1e
diff --git a / bootstrap.php b / bootstrap.php
インデックス6cc6336..857890b100755
--- 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は空です!

これを引き起こしているものについてのアイデアはありますか?

どうも

4

1 に答える 1

1

多くの悔しさの後、私は最終的に解決策にたどり着きました....エスケープ^。

だから私はコードを掘り下げて置き換えました:

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

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

他の場所でも同様の問題がある可能性がありますが、まだ解決していません。

于 2009-10-20T15:17:35.060 に答える