*/
protected $basedir;
+ /**
+ * Location of the repository
+ */
+ protected $repoDir;
+
/**
* Path to JSON cache file for pre-computed git information.
*/
* @see precomputeValues
*/
public function __construct( $repoDir, $usePrecomputed = true ) {
+ $this->repoDir = $repoDir;
$this->cacheFile = self::getCacheFilePath( $repoDir );
wfDebugLog( 'gitinfo',
"Computed cacheFile={$this->cacheFile} for {$repoDir}"
'--format=format:%ct',
'HEAD',
];
+ $gitDir = realpath( $this->basedir );
$result = Shell::command( $cmd )
- ->environment( [ 'GIT_DIR' => $this->basedir ] )
+ ->environment( [ 'GIT_DIR' => $gitDir ] )
->restrict( Shell::RESTRICT_DEFAULT | Shell::NO_NETWORK )
- ->whitelistPaths( [ $this->basedir ] )
+ ->whitelistPaths( [ $gitDir, $this->repoDir ] )
->execute();
if ( $result->getExitCode() === 0 ) {