From: Sebastian Harl Date: Sun, 18 Oct 2009 18:38:39 +0000 (+0200) Subject: version-gen.sh: Append '.dirty' to the version number if appropriate. X-Git-Url: https://git.tokkee.org/?p=template.git;a=commitdiff_plain;h=b64b24b7a0cfbbf8eca8ec2520f78ee7345102dc version-gen.sh: Append '.dirty' to the version number if appropriate. --- diff --git a/version-gen.sh b/version-gen.sh index 5b9c171..8797e49 100755 --- a/version-gen.sh +++ b/version-gen.sh @@ -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' )"