Code

version-gen.sh: Append '.dirty' to the version number if appropriate.
authorSebastian Harl <sh@tokkee.org>
Sun, 18 Oct 2009 18:38:39 +0000 (20:38 +0200)
committerSebastian Harl <sh@tokkee.org>
Sun, 18 Oct 2009 18:38:39 +0000 (20:38 +0200)
version-gen.sh

index 5b9c1712bb9e6797e2e90de75d4d740c2cf373f5..8797e49673f730de5fdb3380b5c90672e1800264 100755 (executable)
@@ -1,11 +1,16 @@
 #! /bin/sh
 
-DEFAULT_VERSION="0.0.0"
+DEFAULT_VERSION="0.0.0.git"
 
 VERSION="$( git describe 2> /dev/null | sed -e 's/foobar-//' )"
 
 if test -z "$VERSION"; then
        VERSION="$DEFAULT_VERSION"
+else
+       git update-index -q --refresh
+       if test -n "$( git diff-index --name-only HEAD )"; then
+               VERSION="$VERSION-dirty"
+       fi
 fi
 
 VERSION="$( echo "$VERSION" | sed -e 's/-/./g' )"