git/list[1] front-page[2] threads[3] people[4] search[5] about
wed 2026-10-07 17:22 UTC

[PATCH v2 2/2] rev-parse: use selected alternate terms too look up refs

From
JRJonas Rebmann <kernel@schlaraffenlan.de>
Date
Mar 23, 2026, 22:49 UTC
Message-ID
<20260323-bisect-terms-v2-2-8d6bdb2c9c7e@schlaraffenlan.de>
In-Reply-To
<20260323-bisect-terms-v2-0-8d6bdb2c9c7e@schlaraffenlan.de>

An old/new bisect will name refs "refs/bisect/old" (or new) accordingly so the hardcoded "refs/bisect/bad" (and good) yields no results in a bisect using alternate terms.

Use the current bisect_terms to make rev-parse --bisect work in an alternate term bisect.

Signed-off-by: Jonas Rebmann <kernel@schlaraffenlan.de>
---
 builtin/rev-parse.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c
index 01a62800e8..f20f0554ed 100644
--- a/builtin/rev-parse.c
+++ b/builtin/rev-parse.c
@@ -10,6 +10,7 @@
 #include "builtin.h"
 
 #include "abspath.h"
+#include "bisect.h"
 #include "config.h"
 #include "commit.h"
 #include "environment.h"
@@ -940,11 +941,14 @@ int cmd_rev_parse(int argc,
 				continue;
 			}
 			if (!strcmp(arg, "--bisect")) {
+				char *term_bad = NULL;
+				char *term_good = NULL;
 				struct refs_for_each_ref_options opts = { 0 };
-				opts.prefix = "refs/bisect/bad";
+				read_bisect_terms(&term_bad, &term_good);
+				opts.prefix = xstrfmt("refs/bisect/%s", term_bad);
 				refs_for_each_ref_ext(get_main_ref_store(the_repository),
 						      show_reference, NULL, &opts);
-				opts.prefix = "refs/bisect/good";
+				opts.prefix = xstrfmt("refs/bisect/%s", term_good);
 				refs_for_each_ref_ext(get_main_ref_store(the_repository),
 						      anti_reference, NULL, &opts);
 				continue;
-- 
2.53.0
Previous: Jonas RebmannNext: Phillip Wood
Message 3 of 9 in “Avoid hardcoded "good"/"bad" bisect terms”
  1. 0/2 Avoid hardcoded "good"/"bad" bisect termsJonas Rebmann, Mar 23, 2026
  2. 1/2 bisect: use selected alternate terms in status outputJonas Rebmann, Mar 23, 2026
  3. 2/2 rev-parse: use selected alternate terms too look up refsJonas Rebmann, Mar 23, 2026
  4. Phillip WoodMar 24, 2026
  5. Phillip WoodMar 24, 2026
  6. Jonas RebmannMar 24, 2026
  7. Junio C HamanoMar 24, 2026
  8. Phillip WoodMar 24, 2026
  9. Junio C HamanoMar 24, 2026

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.