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

Is reserving the branch name "bisect" a good thing?

From
Llinux@horizon.com <linux@horizon.com>
Date
Dec 2, 2005, 23:25 UTC
Message-ID
<20051202232555.13082.qmail@science.horizon.com>

Just wondering... most of the "magic" references are in $GIT_DIR directly, and ALL_CAPS. "git bisect start" begins with "rm -f $GIT_DIR/refs/heads/bisect", which could catch someone trying to implement a bisection algorithm in their own code.

Would it be better if "git bisect" followed that rule as well? Otherwise, we really should document the reserved word.

Either that, or use refs/bisect/current and avoid the issue entirely.
Something like (untested):
diff --git a/git-bisect.sh b/git-bisect.sh
index 68838f3..19a8f36 100755
--- a/git-bisect.sh
+++ b/git-bisect.sh
@@ -50,7 +50,7 @@ bisect_start() {
 	head=$(GIT_DIR="$GIT_DIR" git-symbolic-ref HEAD) ||
 	die "Bad HEAD - I need a symbolic ref"
 	case "$head" in
-	refs/heads/bisect*)
+	BISECT*)
 		git checkout master || exit
 		;;
 	refs/heads/*)
@@ -63,7 +63,7 @@ bisect_start() {
 	#
 	# Get rid of any old bisect state
 	#
-	rm -f "$GIT_DIR/refs/heads/bisect"
+	rm -f "$GIT_DIR/BISECT"
 	rm -rf "$GIT_DIR/refs/bisect/"
 	mkdir "$GIT_DIR/refs/bisect"
 	{
@@ -146,10 +146,10 @@ bisect_next() {
 	fi
 	nr=$(eval "git-rev-list $rev $good -- $(cat $GIT_DIR/BISECT_NAMES)" | wc -l) || exit
 	echo "Bisecting: $nr revisions left to test after this"
-	echo "$rev" > "$GIT_DIR/refs/heads/new-bisect"
-	git checkout new-bisect || exit
-	mv "$GIT_DIR/refs/heads/new-bisect" "$GIT_DIR/refs/heads/bisect" &&
-	GIT_DIR="$GIT_DIR" git-symbolic-ref HEAD refs/heads/bisect
+	echo "$rev" > "$GIT_DIR/NEW-BISECT"
+	git checkout NEW-BISECT || exit
+	mv "$GIT_DIR/NEW-BISECT" "$GIT_DIR/BISECT" &&
+	GIT_DIR="$GIT_DIR" git-symbolic-ref HEAD BISECT
 	git-show-branch "$rev"
 }
 
@@ -172,7 +172,7 @@ bisect_reset() {
 	esac
 	git checkout "$branch" &&
 	rm -fr "$GIT_DIR/refs/bisect"
-	rm -f "$GIT_DIR/refs/heads/bisect"
+	rm -f "$GIT_DIR/BISECT"
 	rm -f "$GIT_DIR/BISECT_LOG"
 }
 
Next: Junio C Hamano
Message 1 of 4 in “Is reserving the branch name "bisect" a good thing?”
  1. linux@horizon.comDec 2, 2005
  2. Junio C HamanoDec 2, 2005
  3. linux@horizon.comDec 3, 2005
  4. Junio C HamanoDec 3, 2005

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.