[web-doc] master: Need to pass safe.directory to Git invocations
| From: | Jim Winstead | Date: | Tue, 22 Oct 2024 23:43:29 +0000 |
| Subject: | [web-doc] master: Need to pass safe.directory to Git invocations | ||
| Groups: | php.doc.web | ||
| Request: | Send a blank email to doc-web+get-2526@lists.php.net to get a copy of this message | ||
Author: Jim Winstead (jimwins)
Date: 2024-10-22T16:39:19-07:00
Commit: https://github.com/php/web-doc/commit/1f8d7bd1d82cc7a8f3635f1472ca9cdc053606b7
Raw diff: https://github.com/php/web-doc/commit/1f8d7bd1d82cc7a8f3635f1472ca9cdc053606b7.diff
Need to pass safe.directory to Git invocations
Original patch by @nilgun in #43
Changed paths:
M include/lib_revcheck.inc.php
Diff:
diff --git a/include/lib_revcheck.inc.php b/include/lib_revcheck.inc.php
index ad3f0db..ce534a0 100644
--- a/include/lib_revcheck.inc.php
+++ b/include/lib_revcheck.inc.php
@@ -249,13 +249,14 @@ function showdiff ()
if (isset($_GET['c']))
$c = $_GET['c'];
$cwd = getcwd();
+ $safedir = 'safe.directory=' . GIT_DIR . 'en';
chdir( GIT_DIR . 'en' );
$arg_h = escapeshellarg($h);
$arg_f = escapeshellarg($gitfile);
- $file =
git diff --ignore-space-at-eol {$arg_h} -- {$arg_f};
+ $file = git -c {$safedir} diff --ignore-space-at-eol {$arg_h} -- {$arg_f};
if ($file == null)
- $file = git diff {$arg_h} -- {$arg_f};
- $hash = git log -n 1 --pretty=format:%H -- {$arg_f};
+ $file = git -c {$safedir} diff {$arg_h} -- {$arg_f};
+ $hash = git -c {$safedir} log -n 1 --pretty=format:%H -- {$arg_f};
chdir( $cwd );
if (!$file) return;
$raw = htmlspecialchars( $file, ENT_XML1, 'UTF-8' );