git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Clueless bisect error message

From
Jeff King <peff@peff.net>
Date
Oct 11, 2006, 09:14 UTC
Message-ID
<20061011091411.GA21527@coredump.intra.peff.net>
In-Reply-To
<7v1wpfuv9d.fsf@assigned-by-dhcp.cox.net>
On Wed, Oct 11, 2006 at 01:11:42AM -0700, Junio C Hamano wrote:
> But I suspect that doing either of these things would harm
> Cogito users.  After cg-seek the user is not "in the middle of
> another bisect", and if we run "git bisect --reset" when we see
> head-name, it would probably break it too.

Maybe expand head-name to include a "reason" field? Unfortunately we can't just stick it in the same file and remain compatible with all versions, so we'll have to use a new file. Something like:

-- >8 -- git-bisect: use head-reason to explain use of head-name

Since many different programs may use head-name to indicate that the working tree should not be modified, head-reason gives them a chance to explain what they're doing. This can improve the accuracy of error messages (such as won't bisect a seeked tree).

Signed-off-by: Jeff King <peff@peff.net>
---
Alternatively, the actual message to show the user could be placed in
head-reason. I think it makes more sense as it is, as it provides the
ability for the message to say "can't X because of Y" in plain English.

And of course we need cogito to start supporting this (but we print something sane for older versions with don't support head-reason).

 git-bisect.sh |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)
diff --git a/git-bisect.sh b/git-bisect.sh
index 06a8d26..9f49dd3 100755
--- a/git-bisect.sh
+++ b/git-bisect.sh
@@ -57,8 +57,21 @@ bisect_start() {
 		git checkout $branch || exit
 		;;
 	refs/heads/*)
-		[ -s "$GIT_DIR/head-name" ] && die "won't bisect on seeked tree"
+		if [ -s "$GIT_DIR/head-name" ]; then
+		    case "$(cat "$GIT_DIR/head-reason" 2>/dev/null)" in
+		    bisect)
+			die "You are already in the middle of another bisect!"
+			;;
+		    seek)
+			die "You can't bisect a seeked tree!"
+			;;
+		    *)
+			die "head-name already exists"
+			;;
+		    esac
+		fi
 		echo "$head" | sed 's#^refs/heads/##' >"$GIT_DIR/head-name"
+		echo bisect >"$GIT_DIR/head-reason"
 		;;
 	*)
 		die "Bad HEAD - strange symbolic ref"
@@ -182,6 +195,7 @@ bisect_reset() {
 	git checkout "$branch" &&
 	rm -fr "$GIT_DIR/refs/bisect"
 	rm -f "$GIT_DIR/refs/heads/bisect" "$GIT_DIR/head-name"
+	rm -f "$GIT_DIR/head-reason"
 	rm -f "$GIT_DIR/BISECT_LOG"
 	rm -f "$GIT_DIR/BISECT_NAMES"
 }
-- 
1.4.2.3.g2c59-dirty



> 
> -
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous: Nguyen Thai Ngoc DuyNext: Krzysztof Halasa
Message 6 of 8 in “Clueless bisect error message”
  1. Nguyen Thai Ngoc DuyOct 11, 2006
  2. Junio C HamanoOct 11, 2006
  3. Nguyen Thai Ngoc DuyOct 11, 2006
  4. Junio C HamanoOct 11, 2006
  5. Nguyen Thai Ngoc DuyOct 11, 2006
  6. Jeff KingOct 11, 2006
  7. Krzysztof HalasaOct 11, 2006
  8. Jeff KingOct 11, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.