From 7bac05c74954a10888b92754b51418c70bcd458a Mon Sep 17 00:00:00 2001 From: Michael Hohmuth Date: Fri, 6 May 2011 08:36:10 +0000 Subject: [PATCH] Better version reporting for git-tracked repositories: Include the git commit ID in the version string, much like is done for repos tracked with bzr. FS#11297 git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29827 a1c6a512-1295-4272-9138-f99709370657 --- tools/version.sh | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/tools/version.sh b/tools/version.sh index 484a33189c..04c7651192 100755 --- a/tools/version.sh +++ b/tools/version.sh @@ -43,16 +43,15 @@ gitversion() { version=`git log --pretty=format:'%b' --grep='git-svn-id: svn' -1 | tail -n 1 | perl -ne 'm/@(\d*)/; print "r" . $1;'` mod="" # Is this a git-svn commit? - if ! git log HEAD^.. --pretty=format:"%b" | grep -q "git-svn-id: svn" ; then - mod="M" + if ! git log -1 --pretty=format:"%b" | grep -q "git-svn-id: svn" ; then + version="$version+$head" + fi # Are there uncommitted changes? - else - export GIT_WORK_TREE="$1" - if git diff --name-only HEAD | read dummy; then - mod="M" - elif git diff --name-only --cached HEAD | read dummy; then - mod="M" - fi + export GIT_WORK_TREE="$1" + if git diff --name-only HEAD | read dummy; then + mod="M" + elif git diff --name-only --cached HEAD | read dummy; then + mod="M" fi echo "${version}${mod}"