Skip to content

Commit 4973aa2

Browse files
committed
git-pull: dead code removal
Back when a74b170 (git-pull: disallow implicit merging to detached HEAD, 2007-01-15) added this check, $? referred to the error status of reading HEAD as a symbolic-ref; but cd67e4d (Teach 'git pull' about --rebase, 2007-11-28) moved the command away from where the check is, and nobody noticed the breakage. Ever since, $? has always been 0 (tr at the end of the pipe to find merge_head never fails) and other case arms were never reached. These days, error_on_no_merge_candidates function is prepared to handle a detached HEAD case, which was what the code this patch removes used to handle. Signed-off-by: Junio C Hamano <[email protected]>
1 parent a7aebb9 commit 4973aa2

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

git-pull.sh

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -182,14 +182,7 @@ merge_head=$(sed -e '/ not-for-merge /d' \
182182

183183
case "$merge_head" in
184184
'')
185-
case $? in
186-
0) error_on_no_merge_candidates "$@";;
187-
1) echo >&2 "You are not currently on a branch; you must explicitly"
188-
echo >&2 "specify which branch you wish to merge:"
189-
echo >&2 " git pull <remote> <branch>"
190-
exit 1;;
191-
*) exit $?;;
192-
esac
185+
error_on_no_merge_candidates "$@"
193186
;;
194187
?*' '?*)
195188
if test -z "$orig_head"

0 commit comments

Comments
 (0)