From 3bb8cf88247db589b60e79c0520b081793cfd68e Mon Sep 17 00:00:00 2001 From: =?utf8?q?SZEDER=20G=C3=A1bor?= Date: Sun, 10 Oct 2010 23:48:57 +0200 Subject: [PATCH] bisect: improve error msg of 'bisect reset' when original HEAD is deleted MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 'git bisect reset' (without the optional 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 '. Signed-off-by: SZEDER Gábor Signed-off-by: Junio C Hamano --- git-bisect.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/git-bisect.sh b/git-bisect.sh index 3a4bf8150..68fcff6db 100755 --- a/git-bisect.sh +++ b/git-bisect.sh @@ -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 '." + fi } bisect_clean_state() { -- 2.30.2