[PATCH v3 06/13] bisect: add enum to represent bisect returning codes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

Create an enum called `bisect_error` with the bisecting return codes
to use in `bisect.c` libification process.

Change bisect_next_all() to make it return this enum.

Mentored-by: Christian Couder <chriscool@xxxxxxxxxxxxx>
Signed-off-by: Miriam Rubio <mirucam@xxxxxxxxx>
---
 bisect.c |  2 +-
 bisect.h | 14 +++++++++++++-
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/bisect.c b/bisect.c
index 83cb5b3a98..e4573c7ba1 100644
--- a/bisect.c
+++ b/bisect.c
@@ -945,7 +945,7 @@ void read_bisect_terms(const char **read_bad, const char **read_good)
  * If no_checkout is non-zero, the bisection process does not
  * checkout the trial commit but instead simply updates BISECT_HEAD.
  */
-int bisect_next_all(struct repository *r, const char *prefix, int no_checkout)
+enum bisect_error bisect_next_all(struct repository *r, const char *prefix, int no_checkout)
 {
 	struct rev_info revs;
 	struct commit_list *tried;
diff --git a/bisect.h b/bisect.h
index 4e69a11ea8..c921ead02c 100644
--- a/bisect.h
+++ b/bisect.h
@@ -31,7 +31,19 @@ struct rev_list_info {
 	const char *header_prefix;
 };
 
-int bisect_next_all(struct repository *r,
+/*
+ * enum bisect_error represents the following return codes:
+ * BISECT_OK: success code. Internally, it means that next
+ * commit has been found (and possibly checked out) and it
+ * should be tested.
+ * BISECT_FAILED error code: default error code.
+ */
+enum bisect_error {
+	BISECT_OK = 0,
+	BISECT_FAILED = -1
+};
+
+enum bisect_error bisect_next_all(struct repository *r,
 		    const char *prefix,
 		    int no_checkout);
 
-- 
2.25.0




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux