]> git.ipfire.org Git - thirdparty/git.git/commitdiff
bisect--helper: simplify exit code computation
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Thu, 12 Jan 2023 15:19:09 +0000 (16:19 +0100)
committerJunio C Hamano <gitster@pobox.com>
Fri, 13 Jan 2023 22:17:13 +0000 (14:17 -0800)
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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/bisect.c

index cc9483e85155f7d4f46f3f2440be855dd403fa85..09505fc4dceffd4a8c406604712230d38b9ae605 100644 (file)
@@ -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;
 }