Skip to content

Commit f64d7fd

Browse files
author
Junio C Hamano
committed
git-fetch: exit with non-zero status when fast-forward check fails
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 <[email protected]>
1 parent d25c26e commit f64d7fd

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

git-fetch.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ fetch_main () {
359359
esac
360360
361361
append_fetch_head "$head" "$remote" \
362-
"$remote_name" "$remote_nick" "$local_name" "$not_for_merge"
362+
"$remote_name" "$remote_nick" "$local_name" "$not_for_merge" || exit
363363
364364
done
365365
@@ -413,15 +413,16 @@ fetch_main () {
413413
done
414414
local_name=$(expr "z$found" : 'z[^:]*:\(.*\)')
415415
append_fetch_head "$sha1" "$remote" \
416-
"$remote_name" "$remote_nick" "$local_name" "$not_for_merge"
417-
done
416+
"$remote_name" "$remote_nick" "$local_name" \
417+
"$not_for_merge" || exit
418+
done &&
418419
if [ "$pack_lockfile" ]; then rm -f "$pack_lockfile"; fi
419420
) || exit ;;
420421
esac
421422
422423
}
423424
424-
fetch_main "$reflist"
425+
fetch_main "$reflist" || exit
425426
426427
# automated tag following
427428
case "$no_tags$tags" in
@@ -449,7 +450,7 @@ case "$no_tags$tags" in
449450
case "$taglist" in
450451
'') ;;
451452
?*)
452-
fetch_main "$taglist" ;;
453+
fetch_main "$taglist" || exit ;;
453454
esac
454455
esac
455456

0 commit comments

Comments
 (0)