Code

version-gen.sh: Slightly improved robustness against errors.
authorSebastian Harl <sh@tokkee.org>
Sat, 1 May 2010 20:26:43 +0000 (22:26 +0200)
committerSebastian Harl <sh@tokkee.org>
Sat, 1 May 2010 20:26:43 +0000 (22:26 +0200)
version-gen.sh

index a54f2af2fdaec5e36a91847c3b8f2268535de5be..ca8414d47b4afe0c7e707b729423f8b3b6f39418 100755 (executable)
@@ -2,13 +2,14 @@
 
 DEFAULT_VERSION="0.0.0.git"
 
-VERSION="$( git describe --tags 2> /dev/null | sed -e 's/foobar-//' )"
+VERSION="$( git describe --tags 2> /dev/null \
+       | sed -e 's/foobar-//' || true )"
 
 if test -z "$VERSION"; then
        VERSION="$DEFAULT_VERSION"
 else
-       git update-index -q --refresh
-       if test -n "$( git diff-index --name-only HEAD )"; then
+       git update-index -q --refresh || true
+       if test -n "$( git diff-index --name-only HEAD || true )"; then
                VERSION="$VERSION-dirty"
        fi
 fi