From d353e84321177e73725221fd5a5719d32af85e56 Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Wed, 4 Mar 2015 14:54:52 +0100 Subject: [PATCH] Only run git describe when we're in a git repo This fixes an issue I see when extracting a collectd tarball into another git repo (the Fedora collectd rpm one). In that case version-gen.sh picked up the last tag from the Fedora repo, which is the wrong one. --- version-gen.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/version-gen.sh b/version-gen.sh index a80e9790..493a6ebf 100755 --- a/version-gen.sh +++ b/version-gen.sh @@ -2,7 +2,9 @@ DEFAULT_VERSION="5.5.0.git" -VERSION="`git describe --dirty=+ --abbrev=7 2> /dev/null | grep collectd | sed -e 's/^collectd-//' -e 's/-/./g'`" +if [ -d .git ]; then + VERSION="`git describe --dirty=+ --abbrev=7 2> /dev/null | grep collectd | sed -e 's/^collectd-//' -e 's/-/./g'`" +fi if test -z "$VERSION"; then VERSION="$DEFAULT_VERSION" -- 2.11.0