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

[PATCH v2 1/6] bisect--helper: simplify exit code computation

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Jan 12, 2023, 15:19 UTC
Message-ID
<patch-v2-1.6-32c45bbf851-20230112T151651Z-avarab@gmail.com>
In-Reply-To
<cover-v2-0.6-00000000000-20230112T151651Z-avarab@gmail.com>
From: Johannes Schindelin <johannes.schindelin@gmx.de>

We _already_ have a function to determine whether a given `enum bisect_error` value is non-zero but still _actually_ indicates success.

Let's use it instead of duplicating the logic.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 builtin/bisect.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/builtin/bisect.c b/builtin/bisect.c
index cc9483e8515..09505fc4dce 100644
--- a/builtin/bisect.c
+++ b/builtin/bisect.c
@@ -1440,12 +1440,5 @@ int cmd_bisect(int argc, const char **argv, const char *prefix)
 		res = fn(argc, argv, prefix);
 	}
 
-	/*
-	 * Handle early success
-	 * From check_merge_bases > check_good_are_ancestors_of_bad > bisect_next_all
-	 */
-	if ((res == BISECT_INTERNAL_SUCCESS_MERGE_BASE) || (res == BISECT_INTERNAL_SUCCESS_1ST_BAD_FOUND))
-		res = BISECT_OK;
-
-	return -res;
+	return is_bisect_success(res) ? 0 : -res;
 }
-- 
2.39.0.1215.g1ba3f685d4f
Previous: Ævar Arnfjörð BjarmasonNext: Ævar Arnfjörð Bjarmason
Message 11 of 16 in “bisect: follow-up fixes from js/bisect-in-c”
  1. 0/6 bisect: follow-up fixes from js/bisect-in-cÆvar Arnfjörð Bjarmason, Dec 15, 2022
  2. 1/6 bisect--helper: simplify exit code computationÆvar Arnfjörð Bjarmason, Dec 15, 2022
  3. 2/6 bisect--helper: make the order consistently `argc, argv`Ævar Arnfjörð Bjarmason, Dec 15, 2022
  4. 3/6 bisect: verify that a bogus option won't try to start a bisectionÆvar Arnfjörð Bjarmason, Dec 15, 2022
  5. 4/6 bisect run: fix the error messageÆvar Arnfjörð Bjarmason, Dec 15, 2022
  6. Đoàn Trần Công DanhDec 15, 2022
  7. 5/6 bisect: remove Cogito-related codeÆvar Arnfjörð Bjarmason, Dec 15, 2022
  8. 6/6 bisect: no longer try to clean up left-over `.git/head-name` filesÆvar Arnfjörð Bjarmason, Dec 15, 2022
  9. Christian CouderDec 15, 2022
  10. 0/6 bisect: follow-up fixes from js/bisect-in-cÆvar Arnfjörð Bjarmason, Jan 12, 2023
  11. 1/6 bisect--helper: simplify exit code computationÆvar Arnfjörð Bjarmason, Jan 12, 2023
  12. 2/6 bisect--helper: make the order consistently `argc, argv`Ævar Arnfjörð Bjarmason, Jan 12, 2023
  13. 3/6 bisect: verify that a bogus option won't try to start a bisectionÆvar Arnfjörð Bjarmason, Jan 12, 2023
  14. 5/6 bisect: remove Cogito-related codeÆvar Arnfjörð Bjarmason, Jan 12, 2023
  15. 6/6 bisect: no longer try to clean up left-over `.git/head-name` filesÆvar Arnfjörð Bjarmason, Jan 12, 2023
  16. 4/6 bisect run: fix the error messageÆvar Arnfjörð Bjarmason, Jan 12, 2023

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.