From ed74c773b32de2bf486b47aed7c3f1f976441822 Mon Sep 17 00:00:00 2001 From: nowrep Date: Fri, 9 Nov 2012 15:43:52 +0100 Subject: [PATCH] Updated getrevision.sh script - it can now show long/short revision number --- scripts/getrevision.sh | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/scripts/getrevision.sh b/scripts/getrevision.sh index ae875a630..f3049b541 100755 --- a/scripts/getrevision.sh +++ b/scripts/getrevision.sh @@ -1,10 +1,21 @@ #!/bin/bash -#git show-ref refs/heads/master | cut -d " " -f 1 | cut -c 1-10 -if [ -e "/usr/bin/git" ] && [ -e ".git" ]; then - git show-ref refs/heads/master | cut -d " " -f 1 | cut -c 1-10; +REV="" + +if [ -e "/usr/bin/git" ] && ([ -e ".git" ] || [ -e "../.git" ]); then + REV=`git show-ref refs/heads/master | cut -d " " -f 1` elif [ -e "git_revision" ]; then - cat git_revision | cut -c 1-10; + REV=`cat git_revision` fi +case $1 in + long) + echo $REV + ;; + + short|*) + echo $REV | cut -c 1-10 + ;; +esac + exit;