linuxcnc/scripts/get-version-from-git
Sebastian Kuzminsky a1e21b3efb Make a script to say the version of the software
This commit splits the debian/update-dch-from-git script, factoring
out the code that determines the version, leaving behind the code that
updates the changelog.

This way the version information can be used to overwrite the VERSION
file, and generally be useful elsewhere.
2011-04-07 18:40:44 -06:00

21 lines
453 B
Bash
Executable file

#!/bin/bash
if [ -z "$1" ]; then
GIT_BRANCH=$(git branch | egrep '^\*' | cut -d ' ' -f 2)
if [ "$GIT_BRANCH" = "(no" ]; then
echo "'git branch' says we're not on a branch, pass one in as an argument"
exit 1
fi
else
GIT_BRANCH="$1"
fi
case $GIT_BRANCH in
master) TAG_GLOB="v2.6*";;
v2.5_branch) TAG_GLOB="v2.5*";;
v2.4_branch) TAG_GLOB="v2.4*";;
*) TAG_GLOB="*";;
esac
git describe --match "$TAG_GLOB"