From: Ruben Kerkhof Date: Wed, 4 Mar 2015 13:54:52 +0000 (+0100) Subject: Only run git describe when we're in a git repo X-Git-Tag: collectd-5.6.0~571^2 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=d353e84321177e73725221fd5a5719d32af85e56;p=collectd.git 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. --- 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"