2007-01-21 04:31:09 +03:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
GVF=GIT-VERSION-FILE
|
2007-02-13 00:38:29 +03:00
|
|
|
DEF_VER=0.5.GIT
|
2007-01-21 04:31:09 +03:00
|
|
|
|
|
|
|
LF='
|
|
|
|
'
|
|
|
|
|
|
|
|
# First try git-describe, then see if there is a version file
|
|
|
|
# (included in release tarballs), then default
|
|
|
|
if VN=$(git describe --abbrev=4 HEAD 2>/dev/null) &&
|
|
|
|
case "$VN" in
|
|
|
|
*$LF*) (exit 1) ;;
|
2007-02-13 00:38:29 +03:00
|
|
|
gitgui-[0-9]*) : happy ;;
|
2007-01-21 04:31:09 +03:00
|
|
|
esac
|
|
|
|
then
|
2007-02-13 00:38:29 +03:00
|
|
|
VN=$(echo "$VN" | sed -e 's/^gitgui-//;s/-/./g');
|
2007-01-21 04:31:09 +03:00
|
|
|
elif test -f version
|
|
|
|
then
|
|
|
|
VN=$(cat version) || VN="$DEF_VER"
|
|
|
|
else
|
|
|
|
VN="$DEF_VER"
|
|
|
|
fi
|
|
|
|
|
|
|
|
dirty=$(sh -c 'git diff-index --name-only HEAD' 2>/dev/null) || dirty=
|
|
|
|
case "$dirty" in
|
|
|
|
'')
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
VN="$VN-dirty" ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
if test -r $GVF
|
|
|
|
then
|
2007-02-13 00:12:04 +03:00
|
|
|
VC=$(sed -e 's/^GITGUI_VERSION = //' <$GVF)
|
2007-01-21 04:31:09 +03:00
|
|
|
else
|
|
|
|
VC=unset
|
|
|
|
fi
|
|
|
|
test "$VN" = "$VC" || {
|
2007-02-13 00:12:04 +03:00
|
|
|
echo >&2 "GITGUI_VERSION = $VN"
|
|
|
|
echo "GITGUI_VERSION = $VN" >$GVF
|
2007-01-21 04:31:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|