diff options
author | Karl Ramm <kcr@1ts.org> | 2013-10-05 23:47:19 -0400 |
---|---|---|
committer | Karl Ramm <kcr@1ts.org> | 2013-10-05 23:47:19 -0400 |
commit | 49152ad1189ce40c2629cab3236d968588b2fdb1 (patch) | |
tree | cd3b7e334ed21996d26591078519cc9c0519fed7 | |
parent | 279cbd919e3dd6dbfba025f833cef8f73afd01cf (diff) |
try to expose the branch name
-rwxr-xr-x | get_vers.sh | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/get_vers.sh b/get_vers.sh index 7f281ae..c67a173 100755 --- a/get_vers.sh +++ b/get_vers.sh @@ -6,6 +6,15 @@ if test -f ${top_srcdir}/VERSION; then VERSION=`cat ${top_srcdir}/VERSION` elif test -d ${top_srcdir}/.git; then VERSION=`(cd $top_srcdir; git describe --abbrev=6 --dirty | sed -e 's/%7E/~/')` + + if test "$(git symbolic-ref HEAD)" != refs/heads/master; then + REF=$(git symbolic-ref --short HEAD) + if test "$REF" = "fatal: ref HEAD is not a symbolic ref"; then + VERSION="$VERSION: detached head" + else + VERSION="$VERSION $(echo $REF | tr 'a-z-' 'A-Z ')" + fi + fi fi if test -z "$VERSION"; then |