Skip to content

Commit 722f53c

Browse files
committed
Merge branch 'cw/bisect'
* cw/bisect: Eliminate confusing "won't bisect on seeked tree" failure
2 parents d87aa32 + b577bb9 commit 722f53c

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

git-bisect.sh

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,18 @@ bisect_start() {
6767
die "Bad HEAD - I need a HEAD"
6868
case "$head" in
6969
refs/heads/bisect)
70-
if [ -s "$GIT_DIR/head-name" ]; then
71-
branch=`cat "$GIT_DIR/head-name"`
70+
if [ -s "$GIT_DIR/BISECT_START" ]; then
71+
branch=`cat "$GIT_DIR/BISECT_START"`
7272
else
7373
branch=master
7474
fi
7575
git checkout $branch || exit
7676
;;
7777
refs/heads/*|$_x40)
78+
# This error message should only be triggered by cogito usage,
79+
# and cogito users should understand it relates to cg-seek.
7880
[ -s "$GIT_DIR/head-name" ] && die "won't bisect on seeked tree"
79-
echo "${head#refs/heads/}" >"$GIT_DIR/head-name"
81+
echo "${head#refs/heads/}" >"$GIT_DIR/BISECT_START"
8082
;;
8183
*)
8284
die "Bad HEAD - strange symbolic ref"
@@ -353,8 +355,8 @@ bisect_reset() {
353355
return
354356
}
355357
case "$#" in
356-
0) if [ -s "$GIT_DIR/head-name" ]; then
357-
branch=`cat "$GIT_DIR/head-name"`
358+
0) if [ -s "$GIT_DIR/BISECT_START" ]; then
359+
branch=`cat "$GIT_DIR/BISECT_START"`
358360
else
359361
branch=master
360362
fi ;;
@@ -365,7 +367,9 @@ bisect_reset() {
365367
usage ;;
366368
esac
367369
if git checkout "$branch"; then
370+
# Cleanup head-name if it got left by an old version of git-bisect
368371
rm -f "$GIT_DIR/head-name"
372+
rm -f "$GIT_DIR/BISECT_START"
369373
bisect_clean_state
370374
fi
371375
}

t/t6030-bisect-porcelain.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ test_expect_success 'bisect starting with a detached HEAD' '
260260
git checkout master^ &&
261261
HEAD=$(git rev-parse --verify HEAD) &&
262262
git bisect start &&
263-
test $HEAD = $(cat .git/head-name) &&
263+
test $HEAD = $(cat .git/BISECT_START) &&
264264
git bisect reset &&
265265
test $HEAD = $(git rev-parse --verify HEAD)
266266

0 commit comments

Comments
 (0)