From 7fb61ed941beb8bd480f0b19ba6b957f7d7036d4 Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@Germany>
Date: Sun, 2 Aug 2009 11:06:26 +0200
Subject: [PATCH] wmakePrintBuild - cd first, so we get the correct git
 information

---
 wmake/wmakePrintBuild | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/wmake/wmakePrintBuild b/wmake/wmakePrintBuild
index d82c9ef92d5..da3c8d40865 100755
--- a/wmake/wmakePrintBuild
+++ b/wmake/wmakePrintBuild
@@ -27,15 +27,13 @@
 #     wmakePrintBuild
 #
 # Description
-#     Print the version used when building the project.
+#     Print the version used when building the project
 #
 #------------------------------------------------------------------------------
-Script=${0##*/}
-
 usage() {
     while [ "$#" -ge 1 ]; do echo "$1"; shift; done
     cat<<USAGE
-usage: $Script [OPTION]
+usage: ${0##*/} [OPTION]
 options:
   -check          check the git head commit vs. \$WM_PROJECT_DIR/.build
                   (exit code 0 for no changes)
@@ -76,7 +74,7 @@ do
         ;;
     -v | -version)
         [ "$#" -ge 2 ] || usage "'$1' option requires an argument"
-        version=$2
+        version="$2"
         shift 2
         ;;
     *)
@@ -101,7 +99,10 @@ else
     # get the head SHA1 when building under git
     # if there are multiple values (eg, HEAD, origin/HEAD, ...)
     # only take the first one, which is 'HEAD'
-    version=$(git show-ref --hash=12 --head HEAD 2>/dev/null | head -1)
+    version=$(
+        cd $WM_PROJECT_DIR 2>/dev/null && \
+        git show-ref --hash=12 --head HEAD 2>/dev/null | head -1
+    )
 
     if [ -n "$version" ]
     then
-- 
GitLab