bisect--helper: simplify exit code computation

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>

Johannes Schindelin committed Jan 12, 2023 at 16:19 UTC 7a8d7aaa47d952f255f29528359ee5e4edb7c6d2
1 file changed +1 -8
builtin/bisect.c
+1 -8
@@ -1440,12 +1440,5 @@ int cmd_bisect(int argc, const char **argv, const char *prefix)
1440 res = fn(argc, argv, prefix);
1441 }
1442
1443 - /*
1444 - * Handle early success
1445 - * From check_merge_bases > check_good_are_ancestors_of_bad > bisect_next_all
1446 - */
1447 - if ((res == BISECT_INTERNAL_SUCCESS_MERGE_BASE) || (res == BISECT_INTERNAL_SUCCESS_1ST_BAD_FOUND))
1448 - res = BISECT_OK;
1449 -
1450 - return -res;
1443 + return is_bisect_success(res) ? 0 : -res;
1444 }