Skip to contentSkip to conversation

bisect: "won't bisect on seeked tree"

PATCH In review Mike Galbraith 5 participants 11 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

Greetings,

I have no idea how tree became "seeked", but would love to know how to "un-seek" it so I can proceed with a bisection. Help?

-Mike

#1 lore raw
Quoted 2 lines · Mike Galbraith

I have no idea how tree became "seeked", but would love to know how to "un-seek" it so I can proceed with a bisection. Help?

I think you are already in the middle of a bisect.

Try "git bisect reset" first to get out of the current bisect before starting another one.

Signature · 1 line
Shawn.
#2 lore raw
Quoted 8 lines · Shawn O. Pearce
Quoted 2 lines · Mike Galbraith

I have no idea how tree became "seeked", but would love to know how to "un-seek" it so I can proceed with a bisection. Help?

I think you are already in the middle of a bisect.

Try "git bisect reset" first to get out of the current bisect before starting another one.

It says "We are not bisecting".

-Mike

#3 lore raw
Quoted 11 lines · Mike Galbraith
Quoted 8 lines · Shawn O. Pearce
Quoted 2 lines · Mike Galbraith

I have no idea how tree became "seeked", but would love to know how to "un-seek" it so I can proceed with a bisection. Help?

I think you are already in the middle of a bisect.

Try "git bisect reset" first to get out of the current bisect before starting another one.

It says "We are not bisecting".

Your repository is in a funny state. The file .git/BISECT_NAMES was removed but .git/head-name was not. Deleting .git/head-name should resolve the issue. But it would be interesting to know how the repository came into this state.

Signature · 1 line
Shawn.
#4 lore raw
Quoted 11 lines · Shawn O. Pearce
Quoted 10 lines · Mike Galbraith
Quoted 8 lines · Shawn O. Pearce
Quoted 2 lines · Mike Galbraith

I have no idea how tree became "seeked", but would love to know how to "un-seek" it so I can proceed with a bisection. Help?

I think you are already in the middle of a bisect.

Try "git bisect reset" first to get out of the current bisect before starting another one.

Quoted 6 lines
Quoted 1 line

It says "We are not bisecting".

Your repository is in a funny state. The file .git/BISECT_NAMES was removed but .git/head-name was not. Deleting .git/head-name should resolve the issue. But it would be interesting to know how the repository came into this state.

Bingo, thanks!

There's only one git user here, so I have a good idea who to blame... but he (me) is claiming innocence. The content of head-name was "master" fwiw.

-Mike

#5 lore raw

PATCH 1/1 Eliminate confusing "won't bisect on seeked tree" failure

In reply to Mike Galbraith

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.

---

Quoted 2 lines · Mike Galbraith

I have no idea how tree became "seeked", but would love to know how to "un-seek" it so I can proceed with a bisection. Help?

At first I thought this just needed a better error message, (the original "seeked tree" terminology came from cogito where there was a seek command). But then it occurred to me that the error should just be eliminated altogether. And that saves the tool having to explain something it can just do itself.

 git-bisect.sh |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
git-bisect.sh +1 -2
index 74715ed..1e532bc 100755
@@ -75,7 +75,6 @@ bisect_start() {
 		git checkout $branch || exit
 		;;
 	refs/heads/*|$_x40)
-		[ -s "$GIT_DIR/head-name" ] && die "won't bisect on seeked tree"
 		echo "${head#refs/heads/}" >"$GIT_DIR/head-name"
 		;;
 	*)
@@ -365,7 +364,6 @@ bisect_reset() {
 	    usage ;;
 	esac
 	if git checkout "$branch"; then
-		rm -f "$GIT_DIR/head-name"
 		bisect_clean_state
 	fi
 }
@@ -377,6 +375,7 @@ bisect_clean_state() {
 	do
 		git update-ref -d $ref $hash
 	done
+	rm -f "$GIT_DIR/head-name"
 	rm -f "$GIT_DIR/BISECT_LOG"
 	rm -f "$GIT_DIR/BISECT_NAMES"
 	rm -f "$GIT_DIR/BISECT_RUN"
Signature · 1 line
1.5.4.1
#6 lore raw

Re: [PATCH] Eliminate confusing "won't bisect on seeked tree" failure

Quoted 5 lines · Carl Worth

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 message itself refers to a Cogito "feature" and I suspect that removing the check and refusal would confuse Cogito. While I think the patch itself is Ok for us, we may want to wait a bit for a while. until Cogito users all die out.

#7 lore raw

Re: [PATCH] Eliminate confusing "won't bisect on seeked tree" failure

Quoted 2 lines · Junio C Hamano

While I think the patch itself is Ok for us, we may want to wait a bit for a while. until Cogito users all die out.

Or until they stop use Cogito. Whichever happens first. ;-)

Signature · 2 lines
Karl Hasselström, [email protected]
      www.treskal.com/kalle
#8 lore raw

Re: [PATCH] Eliminate confusing "won't bisect on seeked tree" failure

In reply to Junio C Hamano

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).

---

Quoted 4 lines · Junio C Hamano

The message itself refers to a Cogito "feature" and I suspect that removing the check and refusal would confuse Cogito. While I think the patch itself is Ok for us, we may want to wait a bit for a while. until Cogito users all die out.

To avoid confusing cogito, this version preserves the error if there is a .git/head-name file around from cg-seek, and instead uses .git/BISECT_START for the git-bisect state.

Does this seem safe enough, Junio?

I suppose this does mean that cogito won't consider the tree to be in a "seeked" state during a git-bisect session, but hopefully that's not a big problem.

Any cogito users around that really care one way or the other on this stuff?

-Carl

 git-bisect.sh |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)
git-bisect.sh +10 -6
index 74715ed..4b13388 100755
@@ -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,6 @@ bisect_reset() {
 	    usage ;;
 	esac
 	if git checkout "$branch"; then
-		rm -f "$GIT_DIR/head-name"
 		bisect_clean_state
 	fi
 }
@@ -377,6 +378,9 @@ bisect_clean_state() {
 	do
 		git update-ref -d $ref $hash
 	done
+	# 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"
 	rm -f "$GIT_DIR/BISECT_LOG"
 	rm -f "$GIT_DIR/BISECT_NAMES"
 	rm -f "$GIT_DIR/BISECT_RUN"

--
1.5.4.1

#9 lore raw

Re: [PATCH] Eliminate confusing "won't bisect on seeked tree" failure

Quoted 1 line · Carl Worth

Does this seem safe enough, Junio?

Neither the earlier one nor this one passes t6030.

#10 lore raw

Re: [PATCH] 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).

---

Quoted 1 line · Junio C Hamano

Neither the earlier one nor this one passes t6030.

Thanks. Both versions were definitely broken, and two of the three failures were a good catch of the bug I had introduced.

The third failure was simply that the test needed to be updated to track the change from head-name to BISECT_START.

And a quick "git grep head-name" of the source suggests that no other stale uses of head-name remain, (the things left in git-bisect are intentional for cogito compatibility as described above, and the things in git-rebase all refer to $DOTEST/head-name which is distinct.

Third time's the charm by chance?

-Carl

 git-bisect.sh               |   14 +++++++++-----
 t/t6030-bisect-porcelain.sh |    2 +-
 2 files changed, 10 insertions(+), 6 deletions(-)
git-bisect.sh +9 -5
index 74715ed..2c32d0b 100755
@@ -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
 }
t/t6030-bisect-porcelain.sh +1 -1
index ec71123..4908e87 100755
@@ -260,7 +260,7 @@ test_expect_success 'bisect starting with a detached HEAD' '
 	git checkout master^ &&
 	HEAD=$(git rev-parse --verify HEAD) &&
 	git bisect start &&
-	test $HEAD = $(cat .git/head-name) &&
+	test $HEAD = $(cat .git/BISECT_START) &&
 	git bisect reset &&
 	test $HEAD = $(git rev-parse --verify HEAD)
 
Signature · 1 line
1.5.4.1