git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Is reserving the branch name "bisect" a good thing?
@ 2005-12-02 23:25 linux
  2005-12-02 23:44 ` Junio C Hamano
  2005-12-03 13:41 ` linux
  0 siblings, 2 replies; 4+ messages in thread
From: linux @ 2005-12-02 23:25 UTC (permalink / raw)
  To: git; +Cc: linux

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"
 }
 

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-12-03 19:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-02 23:25 Is reserving the branch name "bisect" a good thing? linux
2005-12-02 23:44 ` Junio C Hamano
2005-12-03 13:41 ` linux
2005-12-03 19:15   ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).