Attached Files | 0001-ENH-Check-that-git-directory-is-writable.patch [^] (1,473 bytes) 2013-11-11 07:19 [Show Content] [Hide Content]From 68945bdeb9c13a668c699e8d3ec2a36bfcae6e7d Mon Sep 17 00:00:00 2001
From: Igor Murzov <e-mail@date.by>
Date: Tue, 22 Oct 2013 17:44:05 +0400
Subject: [PATCH] ENH: Check that git directory is writable
and avoid undefined index usage if it's not.
---
cdash/dailyupdates.php | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/cdash/dailyupdates.php b/cdash/dailyupdates.php
index 57d5e1e..1f0b802 100644
--- a/cdash/dailyupdates.php
+++ b/cdash/dailyupdates.php
@@ -390,11 +390,12 @@ function get_git_repository_commits($gitroot, $dates, $branch, $previousrevision
$gitcommand = $CDASH_GIT_COMMAND;
$gitlocaldirectory = $CDASH_DEFAULT_GIT_DIRECTORY;
- // Check that the default git directory exists
- if(empty($gitlocaldirectory) || !file_exists($gitlocaldirectory))
+ // Check that the default git directory exists and is writable
+ if(empty($gitlocaldirectory) || !is_writable($gitlocaldirectory))
{
add_log("CDASH_DEFAULT_GIT_DIRECTORY is not set in config or not writable.","get_git_repository_commits");
- return $commits;
+ $results['commits'] = $commits;
+ return $results;
}
$pos = strrpos($gitroot,'/');
@@ -487,7 +488,7 @@ function get_git_repository_commits($gitroot, $dates, $branch, $previousrevision
}
else if(strlen($line)>0 && $line[0] == ' ')
{
- $commit['comment'] .= trim($line).'\n';
+ $commit['comment'] .= trim($line)."\n";
}
}
--
1.8.4
|