From: SZEDER Gábor Date: Sun, 10 Oct 2010 21:48:57 +0000 (+0200) Subject: bisect: improve error msg of 'bisect reset' when original HEAD is deleted X-Git-Tag: v1.7.4-rc0~141^2~1 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=3bb8cf88247db589b60e79c0520b081793cfd68e;p=git.git bisect: improve error msg of 'bisect reset' when original HEAD is deleted '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 --- 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() {