提交 3bb8cf88 编写于 作者: S SZEDER Gábor 提交者: Junio C Hamano

bisect: improve error msg of 'bisect reset' when original HEAD is deleted

'git bisect reset' (without the optional <commit> argument) returns to
the original HEAD from where the bisection was started.  However,
when, for whatever reason, the user deleted the original HEAD before
invoking 'git bisect reset', then all he gets is an error message from
'git checkout':

  fatal: invalid reference: somebranch

Let's try to be more helpful with an error message better describing
what went wrong and a suggestion about how to resolve the situation:

  Could not check out original HEAD 'somebranch'. Try 'git bisect reset <commit>'.
Signed-off-by: NSZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 412ff738
......@@ -316,7 +316,12 @@ bisect_reset() {
*)
usage ;;
esac
git checkout "$branch" -- && bisect_clean_state
if git checkout "$branch" -- ; then
bisect_clean_state
else
die "Could not check out original HEAD '$branch'." \
"Try 'git bisect reset <commit>'."
fi
}
bisect_clean_state() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册