From 429a960ce023c1165abeb8ee8335cf7b3ef5f85b Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Tue, 20 Mar 2018 14:11:00 +0100 Subject: [PATCH] Fix return on git status error --- check_git_config | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/check_git_config b/check_git_config index 40d83f6..43e51e5 100755 --- a/check_git_config +++ b/check_git_config @@ -54,11 +54,16 @@ done cd $GIT_ROOT -STATUS=$( git status -s ) +STATUS=$( git status -s 2>&1 ) +res=$? +[ $DEBUG -eq 1 ] && echo -e "Status (return $res): $STATUS" -[ $DEBUG -eq 1 ] && echo -e "Status : $STATUS" - -if [ -n "$STATUS" ] +if [ $res -ne 0 ] +then + echo "UNKNOWN : Fail to retreive git status (return code : $res)" + echo -e "$STATUS" + exit 3 +elif [ -n "$STATUS" ] then echo "WARNING : Git config repo on $( hostname ) not clean" exit 1