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

[PATCH v2 3/6] bisect: use refs infrastructure for BISECT_START

From
David Turner <dturner@twopensource.com>
Date
Jun 25, 2015, 20:45 UTC
Message-ID
<1435265110-6414-3-git-send-email-dturner@twopensource.com>
In-Reply-To
<1435265110-6414-1-git-send-email-dturner@twopensource.com>

This ref needs to go through the refs backend, since some code assumes that it can be written and read as a ref.

Signed-off-by: David Turner <dturner@twopensource.com>
---
 contrib/completion/git-completion.bash | 2 +-
 git-bisect.sh                          | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 93716c4..c4d4d80 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -938,7 +938,7 @@ _git_bisect ()
 	local subcommands="start bad good skip reset visualize replay log run"
 	local subcommand="$(__git_find_on_cmdline "$subcommands")"
 	if [ -z "$subcommand" ]; then
-		if [ -f "$(__gitdir)"/BISECT_START ]; then
+		if [ git rev-parse BISECT_START 2>/dev/null ]; then
 			__gitcomp "$subcommands"
 		else
 			__gitcomp "replay start"
diff --git a/git-bisect.sh b/git-bisect.sh
index ae3fec2..8658772 100755
--- a/git-bisect.sh
+++ b/git-bisect.sh
@@ -166,7 +166,7 @@ bisect_start() {
 	#
 	echo "$start_head" >"$GIT_DIR/BISECT_START" && {
 		test "z$mode" != "z--no-checkout" ||
-		git update-ref --no-deref BISECT_HEAD "$start_head"
+		git rev-parse "$start_head" > "$GIT_DIR/BISECT_HEAD"
 	} &&
 	git rev-parse --sq-quote "$@" >"$GIT_DIR/BISECT_NAMES" &&
 	eval "$eval true" &&
@@ -399,7 +399,7 @@ bisect_clean_state() {
 	rm -f "$GIT_DIR/BISECT_RUN" &&
 	# Cleanup head-name if it got left by an old version of git-bisect
 	rm -f "$GIT_DIR/head-name" &&
-	git update-ref -d --no-deref BISECT_HEAD &&
+	rm -f "$GIT_DIR/BISECT_HEAD" &&
 	# clean up BISECT_START last
 	rm -f "$GIT_DIR/BISECT_START"
 }
-- 
2.0.4.314.gdbf7a51-twtrsrc
Previous: David TurnerNext: Junio C Hamano
Message 5 of 14 in “refs.c: add err arguments to reflog functions”
  1. 1/6 refs.c: add err arguments to reflog functionsDavid Turner, Jun 25, 2015
  2. 2/6 cherry-pick: treat CHERRY_PICK_HEAD and REVERT_HEAD as refsDavid Turner, Jun 25, 2015
  3. Junio C HamanoJun 25, 2015
  4. David TurnerJun 25, 2015
  5. 3/6 bisect: use refs infrastructure for BISECT_STARTDavid Turner, Jun 25, 2015
  6. Junio C HamanoJun 25, 2015
  7. David TurnerJun 25, 2015
  8. David TurnerJun 26, 2015
  9. 4/6 refs: add safe_create_reflog functionDavid Turner, Jun 25, 2015
  10. Junio C HamanoJun 25, 2015
  11. 5/6 git-reflog: add create and exists functionsDavid Turner, Jun 25, 2015
  12. Junio C HamanoJun 25, 2015
  13. David TurnerJun 25, 2015
  14. 6/6 git-stash: use git-reflog instead of creating filesDavid Turner, Jun 25, 2015

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.