summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2019-12-18 15:29:12 +0300
committerAndrew Dolgov <[email protected]>2019-12-18 15:29:12 +0300
commit72d8a34f748ca065e32c2e1f330f869e39e0d909 (patch)
tree4254cf17de08a6b70f72c965f0e438eb08a10430 /include
parent72d0fac80c0d88d015203578007260c338b40ece (diff)
get_version: don't pass useless root dir to git, instead log it in case of failure
Diffstat (limited to 'include')
-rw-r--r--include/functions.php8
1 files changed, 6 insertions, 2 deletions
diff --git a/include/functions.php b/include/functions.php
index e72a70c13..97557ed95 100644
--- a/include/functions.php
+++ b/include/functions.php
@@ -1903,7 +1903,11 @@
$rc = 0;
$output = [];
- exec("git log --pretty=".escapeshellarg('%ct %h')." -n1 HEAD " . escapeshellarg($root_dir) . ' 2>&1', $output, $rc);
+ $cwd = getcwd();
+
+ chdir($root_dir);
+ exec('git log --pretty='.escapeshellarg('%ct %h').' -n1 HEAD 2>&1', $output, $rc);
+ chdir($cwd);
if ($rc == 0) {
if (is_array($output) && count($output) > 0) {
@@ -1915,7 +1919,7 @@
$ttrss_version = strftime("%y.%m", $timestamp) . "-$commit";
}
} else {
- user_error("Unable to determine version: " . implode("\n", $output), E_USER_WARNING);
+ user_error("Unable to determine version (using $root_dir): " . implode("\n", $output), E_USER_WARNING);
}
}