summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xutil/getversion.sh4
1 files changed, 3 insertions, 1 deletions
diff --git a/util/getversion.sh b/util/getversion.sh
index d91ec771c4..6b20db4171 100755
--- a/util/getversion.sh
+++ b/util/getversion.sh
@@ -118,6 +118,8 @@ if [ -n "$global_dirty" ]; then
echo "#define DATE \"$(date '+%F %T')\""
else
echo "/* Repo is clean, use the commit date of the last commit */"
- gitdate=$(git log -1 --format='%ci' HEAD | cut -d ' ' -f '1 2')
+ # If called from an ebuild we won't have a git repo, so redirect stderr
+ # to avoid annoying 'Not a git repository' errors.
+ gitdate=$(git log -1 --format='%ci' HEAD 2>/dev/null | cut -d ' ' -f '1 2')
echo "#define DATE \"${gitdate}\""
fi