[PATCH 1/6] bisect--helper: simplify exit code computation
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- Dec 15, 2022, 09:47 UTC
- Message-ID
- <patch-1.6-c8c648e4b8c-20221215T094038Z-avarab@gmail.com>
- In-Reply-To
- <cover-0.6-00000000000-20221215T094038Z-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.rc2.1048.g0e5493b8d5b