Skip to content

Commit eb858c6

Browse files
author
Junio C Hamano
committed
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>
1 parent 181129d commit eb858c6

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

GIT-VERSION-GEN

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@ VN=$(cat version) ||
1010
VN="$DEF_VER"
1111

1212
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+
1322
if test -r $GVF
1423
then
1524
VC=$(sed -e 's/^GIT_VERSION = //' <$GVF)

0 commit comments

Comments
 (0)