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

[PATCH v2 5/7] bisect: change read_bisect_terms parameters

From
Antoine Delaite <antoine.delaite@ensimag.grenoble-inp.fr>
Date
Jun 10, 2015, 19:01 UTC
Message-ID
<1433962918-6536-1-git-send-email-antoine.delaite@ensimag.grenoble-inp.fr>
From: Louis Stuber <stuberl@ensimag.grenoble-inp.fr>

The function reads BISECT_TERMS and stores it at the adress given in parameters (instead of global variables name_bad and name_good).

This allows to use the function outside bisect.c.
Signed-off-by: Antoine Delaite <antoine.delaite@ensimag.grenoble-inp.fr>
Signed-off-by: Louis Stuber <stuberl@ensimag.grenoble-inp.fr>
---
 bisect.c |   15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/bisect.c b/bisect.c
index eaa85b6..7afd335 100644
--- a/bisect.c
+++ b/bisect.c
@@ -908,12 +908,11 @@ static void show_diff_tree(const char *prefix, struct commit *commit)
 }
 
 /*
- * The terms used for this bisect session are stored in
- * BISECT_TERMS: it can be bad/good or new/old.
- * We read them and store them to adapt the messages
- * accordingly. Default is bad/good.
+ * The terms used for this bisect session are stored in BISECT_TERMS.
+ * We read them and store them to adapt the messages accordingly.
+ * Default is bad/good.
  */
-void read_bisect_terms(void)
+void read_bisect_terms(const char **read_bad, const char **read_good)
 {
 	struct strbuf str = STRBUF_INIT;
 	const char *filename = git_path("BISECT_TERMS");
@@ -924,9 +923,9 @@ void read_bisect_terms(void)
 			strerror(errno));
 	} else {
 		strbuf_getline(&str, fp, '\n');
-		name_bad = strbuf_detach(&str, NULL);
+		*read_bad = strbuf_detach(&str, NULL);
 		strbuf_getline(&str, fp, '\n');
-		name_good = strbuf_detach(&str, NULL);
+		*read_good = strbuf_detach(&str, NULL);
 	}
 	strbuf_release(&str);
 	fclose(fp);
@@ -948,7 +947,7 @@ int bisect_next_all(const char *prefix, int no_checkout)
 	const unsigned char *bisect_rev;
 	char bisect_rev_hex[GIT_SHA1_HEXSZ + 1];
 
-	read_bisect_terms();
+	read_bisect_terms(&name_bad, &name_good);
 	if (read_bisect_refs())
 		die("reading bisect refs failed");
 
-- 
1.7.1
Next: Antoine Delaite
Message 1 of 23 in “bisect: change read_bisect_terms parameters”
  1. 5/7 bisect: change read_bisect_terms parametersAntoine Delaite, Jun 10, 2015
  2. 6/7 revision: fix rev-list --bisect in old/new modeAntoine Delaite, Jun 10, 2015
  3. 7/7 bisect: allows any terms set by userAntoine Delaite, Jun 10, 2015
  4. Junio C HamanoJun 10, 2015
  5. Junio C HamanoJun 10, 2015
  6. Matthieu MoyJun 11, 2015
  7. Junio C HamanoJun 11, 2015
  8. Matthieu MoyJun 11, 2015
  9. Junio C HamanoJun 11, 2015
  10. Matthieu MoyJun 11, 2015
  11. Louis-Alexandre StuberJun 14, 2015
  12. 7/7 bisect: allows any terms set by userAntoine Delaite, Jun 14, 2015
  13. Matthieu MoyJun 15, 2015
  14. Junio C HamanoJun 15, 2015
  15. 7/7 bisect: allows any terms set by userAntoine Delaite, Jun 16, 2015
  16. Matthieu MoyJun 17, 2015
  17. 7/7 bisect: allows any terms set by userAntoine Delaite, Jun 17, 2015
  18. Matthieu MoyJun 17, 2015
  19. 7/7 bisect: allows any terms set by userAntoine Delaite, Jun 14, 2015
  20. 7/7 bisect: allows any terms set by userAntoine Delaite, Jun 14, 2015
  21. Matthieu MoyJun 15, 2015
  22. Matthieu MoyJun 15, 2015
  23. 7/7 bisect: allows any terms set by userAntoine Delaite, Jun 16, 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.