get_version: don't pass useless root dir to git, instead log it in case of failure

This commit is contained in:
Andrew Dolgov 2019-12-18 15:29:12 +03:00
parent 72d0fac80c
commit 72d8a34f74
1 changed files with 6 additions and 2 deletions

View File

@ -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);
}
}