Skip to content

Commit 181129d

Browse files
H. Peter AnvinJunio C Hamano
authored andcommitted
For release tarballs, include the proper version
When producing a release tarball, include a "version" file, which GIT-VERSION-GEN can then use to do the right thing when building from a tarball. Signed-off-by: H. Peter Anvin <hpa@zytor.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
1 parent 5a2282d commit 181129d

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

GIT-VERSION-GEN

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
#!/bin/sh
22

33
GVF=GIT-VERSION-FILE
4+
DEF_VER=v1.1.GIT
45

5-
VN=$(git-describe --abbrev=4 HEAD 2>/dev/null) || VN=v1.0.GIT
6-
VN=$(expr "$VN" : v'\(.*\)')
6+
# First try git-describe, then see if there is a version file
7+
# (included in release tarballs), then default
8+
VN=$(git-describe --abbrev=4 HEAD 2>/dev/null) ||
9+
VN=$(cat version) ||
10+
VN="$DEF_VER"
11+
12+
VN=$(expr "$VN" : v*'\(.*\)')
713
if test -r $GVF
814
then
915
VC=$(sed -e 's/^GIT_VERSION = //' <$GVF)

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,9 @@ dist: git.spec git-tar-tree
489489
./git-tar-tree HEAD $(GIT_TARNAME) > $(GIT_TARNAME).tar
490490
@mkdir -p $(GIT_TARNAME)
491491
@cp git.spec $(GIT_TARNAME)
492-
$(TAR) rf $(GIT_TARNAME).tar $(GIT_TARNAME)/git.spec
492+
@echo $(GIT_VERSION) > $(GIT_TARNAME)/version
493+
$(TAR) rf $(GIT_TARNAME).tar \
494+
$(GIT_TARNAME)/git.spec $(GIT_TARNAME)/version
493495
@rm -rf $(GIT_TARNAME)
494496
gzip -f -9 $(GIT_TARNAME).tar
495497

0 commit comments

Comments
 (0)