[PATCHv3,3/9] scripts/git_hash: fix bug where dirty was always set

Message ID 1447191136-21213-4-git-send-email-anders.roxell@linaro.org
State New
Headers show

Commit Message

Anders Roxell Nov. 10, 2015, 9:32 p.m.
Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
---
 scripts/git_hash.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Patch

diff --git a/scripts/git_hash.sh b/scripts/git_hash.sh
index e15094e..fc0b057 100755
--- a/scripts/git_hash.sh
+++ b/scripts/git_hash.sh
@@ -9,7 +9,8 @@  ROOTDIR=${1}
 CUSTOM_STR=${CUSTOM_STR:-https://git.linaro.org/lng/odp.git}
 if [ -d ${ROOTDIR}/.git ]; then
 	hash=$(git --git-dir=${ROOTDIR}/.git describe | tr -d "\n")
-	if git --git-dir=${ROOTDIR}/.git diff-index --name-only HEAD &>/dev/null ; then
+	if [[ $(git --git-dir=${ROOTDIR}/.git diff --shortstat 2> /dev/null \
+		| tail -n1) != "" ]]; then
 		dirty=-dirty
 	fi