From 72d8a34f748ca065e32c2e1f330f869e39e0d909 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 18 Dec 2019 15:29:12 +0300 Subject: get_version: don't pass useless root dir to git, instead log it in case of failure --- include/functions.php | 8 ++++++-- 1 file 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); } } -- cgit v1.2.3