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,17 +43,16 @@ gitversion() {
version=`git log --pretty=format:'%b' --grep='git-svn-id: svn' -1 | tail -n 1 | perl -ne 'm/@(\d*)/; print "r" . $1;'` version=`git log --pretty=format:'%b' --grep='git-svn-id: svn' -1 | tail -n 1 | perl -ne 'm/@(\d*)/; print "r" . $1;'`
mod="" mod=""
# Is this a git-svn commit? # Is this a git-svn commit?
if ! git log HEAD^.. --pretty=format:"%b" | grep -q "git-svn-id: svn" ; then if ! git log -1 --pretty=format:"%b" | grep -q "git-svn-id: svn" ; then
mod="M" version="$version+$head"
fi
# Are there uncommitted changes? # Are there uncommitted changes?
else
export GIT_WORK_TREE="$1" export GIT_WORK_TREE="$1"
if git diff --name-only HEAD | read dummy; then if git diff --name-only HEAD | read dummy; then
mod="M" mod="M"
elif git diff --name-only --cached HEAD | read dummy; then elif git diff --name-only --cached HEAD | read dummy; then
mod="M" mod="M"
fi fi
fi
echo "${version}${mod}" echo "${version}${mod}"
# All done with git # All done with git