Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPranit Bauva <pranit.bauva@gmail.com>2020-02-17 11:40:36 +0300
committerJunio C Hamano <gitster@pobox.com>2020-02-19 20:37:14 +0300
commitcdd4dc2d6a3e420178100efc780a987495a1a3bd (patch)
tree2c3dfea5fd2a94667a4b549b35da4627adfc7aea /bisect.h
parente8e3ce67185fd493a07d84a5ce21b469701f8f64 (diff)
bisect: libify `check_merge_bases` and its dependents
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(<positive-value>)` to `return <negative-value>`. Follow POSIX conventions to return <negative-value> to indicate error. In `check_merge_bases()` there is an early success special case, so we have introduced special error code BISECT_INTERNAL_SUCCESS_MERGE_BASE (-11) which indicates early success. This BISECT_INTERNAL_SUCCESS_MERGE_BASE is converted back to BISECT_OK (0) in `check_good_are_ancestors_of_bad()`. Update all callers to handle the error returns. Mentored-by: Christian Couder <chriscool@tuxfamily.org> Mentored by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Pranit Bauva <pranit.bauva@gmail.com> Signed-off-by: Tanushree Tumane <tanushreetumane@gmail.com> Signed-off-by: Miriam Rubio <mirucam@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'bisect.h')
-rw-r--r--bisect.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/bisect.h b/bisect.h
index 19d90e4870..f68ae85376 100644
--- a/bisect.h
+++ b/bisect.h
@@ -39,11 +39,16 @@ 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_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.
*/
enum bisect_error {
BISECT_OK = 0,
BISECT_FAILED = -1,
- BISECT_ONLY_SKIPPED_LEFT = -2
+ BISECT_ONLY_SKIPPED_LEFT = -2,
+ BISECT_INTERNAL_SUCCESS_MERGE_BASE = -11
};
enum bisect_error bisect_next_all(struct repository *r,