From 6c69f2223394c200cce1289ac9200f781ef14da7 Mon Sep 17 00:00:00 2001 From: Pranit Bauva Date: Mon, 17 Feb 2020 09:40:39 +0100 Subject: bisect: libify `bisect_next_all` Since we want to get rid of git-bisect.sh, it would be necessary to convert those exit() calls to return statements so that errors can be reported. Emulate try catch in C by converting `exit()` to `return `. Follow POSIX conventions to return to indicate error. All the functions calling `bisect_next_all()` are already able to handle return values from it. Mentored-by: Christian Couder Mentored-by: Johannes Schindelin Signed-off-by: Pranit Bauva Signed-off-by: Tanushree Tumane Signed-off-by: Miriam Rubio Signed-off-by: Junio C Hamano --- bisect.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'bisect.h') diff --git a/bisect.h b/bisect.h index 0d9758179f..8bad8d8391 100644 --- a/bisect.h +++ b/bisect.h @@ -39,16 +39,22 @@ struct rev_list_info { * BISECT_FAILED error code: default error code. * BISECT_ONLY_SKIPPED_LEFT error code: only skipped * commits left to be tested. + * BISECT_MERGE_BASE_CHECK error code: merge base check failed. + * BISECT_NO_TESTABLE_COMMIT error code: no testable commit found. + * BISECT_INTERNAL_SUCCESS_1ST_BAD_FOUND early success code: + * first term_bad commit found. * BISECT_INTERNAL_SUCCESS_MERGE_BASE early success * code: found merge base that should be tested. - * Early success code BISECT_INTERNAL_SUCCESS_MERGE_BASE - * should be only an internal code. + * Early success codes BISECT_INTERNAL_SUCCESS_1ST_BAD_FOUND and + * BISECT_INTERNAL_SUCCESS_MERGE_BASE should be only internal codes. */ enum bisect_error { BISECT_OK = 0, BISECT_FAILED = -1, BISECT_ONLY_SKIPPED_LEFT = -2, BISECT_MERGE_BASE_CHECK = -3, + BISECT_NO_TESTABLE_COMMIT = -4, + BISECT_INTERNAL_SUCCESS_1ST_BAD_FOUND = -10, BISECT_INTERNAL_SUCCESS_MERGE_BASE = -11 }; -- cgit v1.2.3