Yet another fix for git version script

This commit is contained in:
o9000 2015-04-25 15:45:38 +02:00
parent 233157930b
commit 5d11fe5cc1

View file

@ -1,5 +1,7 @@
#!/bin/sh #!/bin/sh
DIRTY=""
git update-index -q --ignore-submodules --refresh git update-index -q --ignore-submodules --refresh
# Disallow unstaged changes in the working tree # Disallow unstaged changes in the working tree
if ! git diff-files --quiet --ignore-submodules -- if ! git diff-files --quiet --ignore-submodules --
@ -10,7 +12,7 @@ then
git diff-files --name-status -r --ignore-submodules -- >&2 git diff-files --name-status -r --ignore-submodules -- >&2
exit 1 exit 1
else else
echo "dirty" DIRTY="-dirty"
fi fi
fi fi
@ -23,8 +25,10 @@ then
git diff-index --cached --name-status -r --ignore-submodules HEAD -- >&2 git diff-index --cached --name-status -r --ignore-submodules HEAD -- >&2
exit 1 exit 1
else else
echo "dirty" DIRTY="-dirty"
fi fi
fi fi
git describe --exact-match 2>/dev/null || echo "0.11-git$(git show -s --pretty=format:%cI.%h | tr -d ':' | tr -d '-' | tr '.' '-' | sed 's/T[0-9\+]*//g')" VERSION=$(git describe --exact-match 2>/dev/null || echo "0.11-git$(git show -s --pretty=format:%cI.%h | tr -d ':' | tr -d '-' | tr '.' '-' | sed 's/T[0-9\+]*//g')")$DIRTY
echo '#define VERSION_STRING "'$VERSION'"' > version.h