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
This commit is contained in:
Michael Hohmuth 2011-05-06 08:36:10 +00:00
parent fcf51bcd92
commit 7bac05c749

View file

@ -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}"