Re: [PATCH v16 Part II 5/8] bisect--helper: `bisect_next_check` shell function in C
From: Stephan Beyer <hidden>
Date: 2017-11-12 19:19:54
Hi, another minor: On 10/27/2017 05:06 PM, Pranit Bauva wrote:
quoted hunk ↗ jump to hunk
@@ -264,6 +271,79 @@ static int check_and_set_terms(struct bisect_terms *terms, const char *cmd) return 0; } +static int mark_good(const char *refname, const struct object_id *oid, + int flag, void *cb_data) +{ + int *m_good = (int *)cb_data; + *m_good = 0; + return 1; +} + +static int bisect_next_check(const struct bisect_terms *terms, + const char *current_term) +{ + int missing_good = 1, missing_bad = 1, retval = 0; + const char *bad_ref = xstrfmt("refs/bisect/%s", terms->term_bad); + const char *good_glob = xstrfmt("%s-*", terms->term_good); + + if (ref_exists(bad_ref)) + missing_bad = 0; + + for_each_glob_ref_in(mark_good, good_glob, "refs/bisect/", + (void *) &missing_good); + + if (!missing_good && !missing_bad) + goto finish; + + if (!current_term) + goto fail; + + if (missing_good && !missing_bad && current_term &&
This check for "current_term" is not necessary; it can be asserted to be non-NULL, otherwise you would have jumped to "fail" Stephan