2013-06-24 10:09:29 +00:00
|
|
|
#!/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
|
2014-10-12 13:01:13 +00:00
|
|
|
DEF_VER=unknown
|
2013-06-24 10:09:29 +00:00
|
|
|
|
|
|
|
# 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"
|
2013-09-02 12:08:46 +00:00
|
|
|
elif test -d .git -o -f .git && type git >/dev/null
|
2013-06-24 10:09:29 +00:00
|
|
|
then
|
2014-02-06 00:20:09 +00:00
|
|
|
VN=$(git describe --always --dirty 2>/dev/null)
|
2013-06-24 10:09:29 +00:00
|
|
|
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
|
|
|
|
}
|