提交 4973aa22 编写于 作者: J Junio C Hamano

git-pull: dead code removal

Back when a74b1706 (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 cd67e4d4 (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: NJunio C Hamano <gitster@pobox.com>
上级 a7aebb9d
...@@ -182,14 +182,7 @@ merge_head=$(sed -e '/ not-for-merge /d' \ ...@@ -182,14 +182,7 @@ merge_head=$(sed -e '/ not-for-merge /d' \
case "$merge_head" in case "$merge_head" in
'') '')
case $? in error_on_no_merge_candidates "$@"
0) error_on_no_merge_candidates "$@";;
1) echo >&2 "You are not currently on a branch; you must explicitly"
echo >&2 "specify which branch you wish to merge:"
echo >&2 " git pull <remote> <branch>"
exit 1;;
*) exit $?;;
esac
;; ;;
?*' '?*) ?*' '?*)
if test -z "$orig_head" if test -z "$orig_head"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册