summaryrefslogtreecommitdiff
path: root/git-bisect.sh
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2008-02-23 17:14:17 -0800
committerJunio C Hamano <gitster@pobox.com>2008-02-24 17:41:33 -0800
commitb577bb925e745845155c6f51eae841c339ce68f6 (patch)
tree5b27d72fe54e93c2ea47f3d6bdcd87593083b96f /git-bisect.sh
parent923d44aeb7cb6d21eeb459fdc1b58137e37c2b1c (diff)
downloadgit-b577bb925e745845155c6f51eae841c339ce68f6.tar.gz
Eliminate confusing "won't bisect on seeked tree" failure
This error message is very confusing---it doesn't tell the user anything about how to fix the situation. And the actual fix for the situation ("git bisect reset") does a checkout of a potentially random branch, (compared to what the user wants to be on for the bisect she is starting). The simplest way to eliminate the confusion is to just make "git bisect start" do the cleanup itself. There's no significant loss of safety here since we already have a general safety in the form of the reflog. Note: We preserve the warning for any cogito users. We do this by switching from .git/head-name to .git/BISECT_START for the extra state, (which is a more descriptive name anyway). Signed-off-by: Carl Worth <cworth@cworth.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-bisect.sh')
-rwxr-xr-xgit-bisect.sh14
1 files changed, 9 insertions, 5 deletions
diff --git a/git-bisect.sh b/git-bisect.sh
index 74715edf0b..2c32d0b9eb 100755
--- a/git-bisect.sh
+++ b/git-bisect.sh
@@ -67,16 +67,18 @@ bisect_start() {
die "Bad HEAD - I need a HEAD"
case "$head" in
refs/heads/bisect)
- if [ -s "$GIT_DIR/head-name" ]; then
- branch=`cat "$GIT_DIR/head-name"`
+ if [ -s "$GIT_DIR/BISECT_START" ]; then
+ branch=`cat "$GIT_DIR/BISECT_START"`
else
branch=master
fi
git checkout $branch || exit
;;
refs/heads/*|$_x40)
+ # This error message should only be triggered by cogito usage,
+ # and cogito users should understand it relates to cg-seek.
[ -s "$GIT_DIR/head-name" ] && die "won't bisect on seeked tree"
- echo "${head#refs/heads/}" >"$GIT_DIR/head-name"
+ echo "${head#refs/heads/}" >"$GIT_DIR/BISECT_START"
;;
*)
die "Bad HEAD - strange symbolic ref"
@@ -353,8 +355,8 @@ bisect_reset() {
return
}
case "$#" in
- 0) if [ -s "$GIT_DIR/head-name" ]; then
- branch=`cat "$GIT_DIR/head-name"`
+ 0) if [ -s "$GIT_DIR/BISECT_START" ]; then
+ branch=`cat "$GIT_DIR/BISECT_START"`
else
branch=master
fi ;;
@@ -365,7 +367,9 @@ bisect_reset() {
usage ;;
esac
if git checkout "$branch"; then
+ # Cleanup head-name if it got left by an old version of git-bisect
rm -f "$GIT_DIR/head-name"
+ rm -f "$GIT_DIR/BISECT_START"
bisect_clean_state
fi
}