diff options
author | Andrew Mahone <andrew.mahone@gmail.com> | 2009-05-15 01:14:48 +0000 |
---|---|---|
committer | Andrew Mahone <andrew.mahone@gmail.com> | 2009-05-15 01:14:48 +0000 |
commit | 6df03c6d53051e44bcc9b879408542c40c79db5e (patch) | |
tree | e6d0007281321f60117c7e6c52ee42b29d330e65 /tools/version.sh | |
parent | 1de930227b625def744d41b9e05abf429fc404c3 (diff) | |
download | rockbox-6df03c6d53051e44bcc9b879408542c40c79db5e.tar.gz rockbox-6df03c6d53051e44bcc9b879408542c40c79db5e.zip |
Fix version.sh when it's run outside of the git working directory.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20934 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'tools/version.sh')
-rwxr-xr-x | tools/version.sh | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/tools/version.sh b/tools/version.sh index 332dbc1838..7d67fabc8b 100755 --- a/tools/version.sh +++ b/tools/version.sh @@ -34,7 +34,7 @@ svnversion_safe() { # rockbox. If the commit information for HEAD has a svn-id in it we report that instead of # the git id gitversion() { - export GIT_DIR="$1" + export GIT_DIR="$1/.git" # This verifies we are in a git directory if head=`git rev-parse --verify --short HEAD 2>/dev/null`; then @@ -46,10 +46,13 @@ gitversion() { if ! git log HEAD^.. --pretty=format:"%b" | grep -q "git-svn-id: svn" ; then mod="M" # Are there uncommitted changes? - elif git diff --name-only HEAD | read dummy; then - mod="M" - elif git diff --name-only --cached HEAD | read dummy; then - mod="M" + 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 fi echo "${version}${mod}" @@ -69,7 +72,7 @@ if [ -r $TOP/$VERSIONFILE ]; then VER=`cat $TOP/$VERSIONFILE`; else # Ok, we need to derive it from the Version Control system if [ -d "$TOP/.git" ]; then - VER=`gitversion $TOP/.git` + VER=`gitversion $TOP` else VER=`svnversion_safe $TOP`; if [ "$VER" = "unknown" ]; then |