diff options
-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() { | |||
34 | # rockbox. If the commit information for HEAD has a svn-id in it we report that instead of | 34 | # rockbox. If the commit information for HEAD has a svn-id in it we report that instead of |
35 | # the git id | 35 | # the git id |
36 | gitversion() { | 36 | gitversion() { |
37 | export GIT_DIR="$1" | 37 | export GIT_DIR="$1/.git" |
38 | 38 | ||
39 | # This verifies we are in a git directory | 39 | # This verifies we are in a git directory |
40 | if head=`git rev-parse --verify --short HEAD 2>/dev/null`; then | 40 | if head=`git rev-parse --verify --short HEAD 2>/dev/null`; then |
@@ -46,10 +46,13 @@ gitversion() { | |||
46 | if ! git log HEAD^.. --pretty=format:"%b" | grep -q "git-svn-id: svn" ; then | 46 | if ! git log HEAD^.. --pretty=format:"%b" | grep -q "git-svn-id: svn" ; then |
47 | mod="M" | 47 | mod="M" |
48 | # Are there uncommitted changes? | 48 | # Are there uncommitted changes? |
49 | elif git diff --name-only HEAD | read dummy; then | 49 | else |
50 | mod="M" | 50 | export GIT_WORK_TREE="$1" |
51 | elif git diff --name-only --cached HEAD | read dummy; then | 51 | if git diff --name-only HEAD | read dummy; then |
52 | mod="M" | 52 | mod="M" |
53 | elif git diff --name-only --cached HEAD | read dummy; then | ||
54 | mod="M" | ||
55 | fi | ||
53 | fi | 56 | fi |
54 | 57 | ||
55 | echo "${version}${mod}" | 58 | echo "${version}${mod}" |
@@ -69,7 +72,7 @@ if [ -r $TOP/$VERSIONFILE ]; then VER=`cat $TOP/$VERSIONFILE`; | |||
69 | else | 72 | else |
70 | # Ok, we need to derive it from the Version Control system | 73 | # Ok, we need to derive it from the Version Control system |
71 | if [ -d "$TOP/.git" ]; then | 74 | if [ -d "$TOP/.git" ]; then |
72 | VER=`gitversion $TOP/.git` | 75 | VER=`gitversion $TOP` |
73 | else | 76 | else |
74 | VER=`svnversion_safe $TOP`; | 77 | VER=`svnversion_safe $TOP`; |
75 | if [ "$VER" = "unknown" ]; then | 78 | if [ "$VER" = "unknown" ]; then |