Code

git-fetch: exit with non-zero status when fast-forward check fails
authorJunio C Hamano <junkio@cox.net>
Sat, 25 Nov 2006 09:04:28 +0000 (01:04 -0800)
committerJunio C Hamano <junkio@cox.net>
Sat, 25 Nov 2006 09:04:28 +0000 (01:04 -0800)
When update_local_ref() refuses to update a branch head due to
fast-forward check, it was not propagated properly in the call
chain and the command did not exit with non-zero status as a
result.

Signed-off-by: Junio C Hamano <junkio@cox.net>
git-fetch.sh

index eb32476bbdc98cc9a34d4026575e4d1a608289be..44255620983fde6bdbcb7d75d8b1d10bf8db6583 100755 (executable)
@@ -359,7 +359,7 @@ fetch_main () {
       esac
 
       append_fetch_head "$head" "$remote" \
-         "$remote_name" "$remote_nick" "$local_name" "$not_for_merge"
+         "$remote_name" "$remote_nick" "$local_name" "$not_for_merge" || exit
 
   done
 
@@ -413,15 +413,16 @@ fetch_main () {
          done
          local_name=$(expr "z$found" : 'z[^:]*:\(.*\)')
          append_fetch_head "$sha1" "$remote" \
-                 "$remote_name" "$remote_nick" "$local_name" "$not_for_merge"
-      done
+                 "$remote_name" "$remote_nick" "$local_name" \
+                 "$not_for_merge" || exit
+      done &&
       if [ "$pack_lockfile" ]; then rm -f "$pack_lockfile"; fi
     ) || exit ;;
   esac
 
 }
 
-fetch_main "$reflist"
+fetch_main "$reflist" || exit
 
 # automated tag following
 case "$no_tags$tags" in
@@ -449,7 +450,7 @@ case "$no_tags$tags" in
        case "$taglist" in
        '') ;;
        ?*)
-               fetch_main "$taglist" ;;
+               fetch_main "$taglist" || exit ;;
        esac
 esac