add git_version_gen: generate a version number from the git tree
Originally from the git sources (GIT-VERSION-GEN) (C) Junio C Hamano <junkio@cox.net> Reused under GPL v2.0
This commit is contained in:
parent
625a1cb0b5
commit
05563ab11e
1
.gitignore
vendored
1
.gitignore
vendored
@ -32,3 +32,4 @@ user_doc/
|
||||
xcuserdata
|
||||
tests/*tmp.*
|
||||
tests/foo.txt
|
||||
FISH-BUILD-VERSION-FILE
|
||||
|
31
build_tools/git_version_gen.sh
Executable file
31
build_tools/git_version_gen.sh
Executable file
@ -0,0 +1,31 @@
|
||||
#!/bin/sh
|
||||
# Originally from the git sources (GIT-VERSION-GEN)
|
||||
# Presumably (C) Junio C Hamano <junkio@cox.net>
|
||||
# Reused under GPL v2.0
|
||||
# Modified for fish by David Adam <zanchey@ucc.gu.uwa.edu.au>
|
||||
|
||||
FBVF=FISH-BUILD-VERSION-FILE
|
||||
DEF_VER=2.0.GIT
|
||||
|
||||
# First see if there is a version file (included in release tarballs),
|
||||
# then try git-describe, then default.
|
||||
if test -f version
|
||||
then
|
||||
VN=$(cat version) || VN="$DEF_VER"
|
||||
elif test -d .git -o -f .git && which git >/dev/null
|
||||
then
|
||||
VN=$(git describe --tags --dirty 2>/dev/null)
|
||||
else
|
||||
VN="$DEF_VER"
|
||||
fi
|
||||
|
||||
if test -r $FBVF
|
||||
then
|
||||
VC=$(sed -e 's/^FISH_BUILD_VERSION = //' <$FBVF)
|
||||
else
|
||||
VC=unset
|
||||
fi
|
||||
test "$VN" = "$VC" || {
|
||||
echo >&2 "FISH_BUILD_VERSION = $VN"
|
||||
echo "FISH_BUILD_VERSION = $VN" >$FBVF
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user