summaryrefslogtreecommitdiff
path: root/git-bisect.sh
diff options
context:
space:
mode:
authorSZEDER Gábor <szeder@ira.uka.de>2010-10-10 23:48:57 +0200
committerJunio C Hamano <gitster@pobox.com>2010-10-13 15:07:50 -0700
commit3bb8cf88247db589b60e79c0520b081793cfd68e (patch)
treefaaaa45e33f8ff1d37edeafafd975f8826fc39cf /git-bisect.sh
parent412ff738addd3f329d641073fd1aa32629d5bfbf (diff)
downloadgit-3bb8cf88247db589b60e79c0520b081793cfd68e.tar.gz
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: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-bisect.sh')
-rwxr-xr-xgit-bisect.sh7
1 files changed, 6 insertions, 1 deletions
diff --git a/git-bisect.sh b/git-bisect.sh
index 3a4bf8150d..68fcff6dbf 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 <commit>'."
+ fi
}
bisect_clean_state() {