GIT-VERSION-GEN: detect dirty tree and mark the version accordingly.
If we are building from a working tree with local modifications, mark the version accordingly. Deliberately uses '-' to prevent RPM from being built from such a tree. Signed-off-by: Junio C Hamano <junkio@cox.net>
Junio C Hamano committed
Jan 9, 2006 at 14:25 UTC
eb858c60d7850fc2ed2f69397f0560e707de324d
1 file changed
+9
GIT-VERSION-GEN
+9
@@ -10,6 +10,15 @@ VN=$(cat version) ||
10
VN="$DEF_VER"
11
12
VN=$(expr "$VN" : v*'\(.*\)')
13
+
14
+dirty=$(sh -c 'git-diff-index --name-only HEAD' 2>/dev/null) || dirty=
15
+case "$dirty" in
16
+'')
17
+ ;;
18
+*)
19
+ VN="$VN-dirty" ;;
20
+esac
21
+
22
if test -r $GVF
23
then
24
VC=$(sed -e 's/^GIT_VERSION = //' <$GVF)