Only run git describe when we're in a git repo
[collectd.git] / version-gen.sh
index a80e979..493a6eb 100755 (executable)
@@ -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"