Add proper exit code
authorHugo Villeneuve <hvilleneuve@addenergie.ca>
Fri, 5 Jul 2019 14:02:13 +0000 (10:02 -0400)
committerHugo Villeneuve <hvilleneuve@addenergie.ca>
Fri, 5 Jul 2019 14:02:21 +0000 (10:02 -0400)
scripts/git-project-update.sh

index 0a37cc1..302a4f8 100755 (executable)
@@ -32,6 +32,7 @@ if [ ! -f ${SUBREPOS_LIST} ]; then
 fi
 
 branch=${1}
+rc=0
 
 update_repo()
 {
@@ -53,6 +54,10 @@ update_repo()
         exists=$(git show-ref refs/heads/${b})
         if [ -n "$exists" ]; then
             vco -q ${b} 1> /dev/null
+
+            if [ ${?} -ne 0 ]; then
+                rc=1
+            fi
             echo "${b}"
             valid="1"
             break
@@ -61,6 +66,7 @@ update_repo()
 
     if [ x"${valid}" = x"0" ]; then
         echo "No valid branch found"
+        rc=1
     fi
 
     popd 1> /dev/null
@@ -87,3 +93,5 @@ while IFS=$'\n' read r ; do
 
     update_repo ${r}
 done < ${SUBREPOS_LIST}
+
+exit ${rc}