From 831265410ec45131470e9f12415198c9e407b132 Mon Sep 17 00:00:00 2001 From: Bryan Davis Date: Tue, 6 May 2014 13:15:09 -0600 Subject: [PATCH] Check for valid git repository in GitInfo::getHeadCommitDate Ensure that GitInfo::getHead returns a valid value before attempting to use the git binary to extract a commit date. Bug: 64948 Change-Id: Ib0d245306842706dbb5d4b9522bb381a5f55526c --- includes/GitInfo.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/includes/GitInfo.php b/includes/GitInfo.php index dc2fff1398..304c1bce30 100644 --- a/includes/GitInfo.php +++ b/includes/GitInfo.php @@ -195,7 +195,10 @@ class GitInfo { if ( !isset( $this->cache['headCommitDate'] ) ) { $date = false; - if ( is_file( $wgGitBin ) && is_executable( $wgGitBin ) ) { + if ( is_file( $wgGitBin ) && + is_executable( $wgGitBin ) && + $this->getHead() !== false + ) { $environment = array( "GIT_DIR" => $this->basedir ); $cmd = wfEscapeShellArg( $wgGitBin ) . " show -s --format=format:%ct HEAD"; -- 2.20.1