Skip to content

Commit

Permalink
bisect: add enum to represent bisect returning codes
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Miriam Rubio <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>
  • Loading branch information
mirucam authored and gitster committed Feb 19, 2020
1 parent bfacfce commit 680e8a0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion bisect.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
14 changes: 13 additions & 1 deletion bisect.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 680e8a0

Please sign in to comment.