Browse Source

scripts: Update git-version-gen to be more useful.

master
Solomon Peachy 9 years ago
parent
commit
a54523cac7
  1. 22
      git-version-gen

22
git-version-gen

@ -11,10 +11,16 @@ then
VN=$(cat version)
elif test -d .git
then
VN=$(git describe 2>/dev/null) &&
git update-index -q --refresh
# test -z "$(git diff-index --name-only HEAD --)" ||
# VN="$VN-dirty"
VN=$(git describe 2>/dev/null) && git update-index -q --refresh
HEAD=$(git rev-parse --verify --short HEAD 2>/dev/null)
if [ -n "$VN" ] ; then
VN="$VN-$HEAD"
else
VN="none-$HEAD"
fi
test -z "$(git diff-index --name-only HEAD --)" || VN="$VN-dirty"
else
VN="$DEF_VER"
fi
@ -30,9 +36,13 @@ then
else
VC=unset
fi
test "\"$VN\"" = "$VC" -a "\"-$APP\"" = "$VM" || {
if [ -n "$APP" ] ; then
APP="-$APP"
fi
test "\"$VN\"" = "$VC" -a "\"$APP\"" = "$VM" || {
echo "#define SYSTEM_VERSION \"$VN\"" >$GVF
echo "#define SYSTEM_APP \"-$APP\"" >>$GVF
echo "#define SYSTEM_APP \"$APP\"" >>$GVF
}

Loading…
Cancel
Save