On Fri, Jun 26, 2015 at 6:58 PM, Matthieu Moy <[email protected]> wrote:
>
> static int for_each_bad_bisect_ref(const char *submodule, each_ref_fn fn,
> void *cb_data)
> {
> - return for_each_ref_in_submodule(submodule, "refs/bisect/bad", fn,
> cb_data);
> + struct strbuf bisect_refs = STRBUF_INIT;
> + int status;
> + strbuf_addf(&bisect_refs, "refs/bisect/%s", name_bad);
> + status = for_each_ref_in_submodule(submodule, bisect_refs.buf, fn,
> cb_data);
> + strbuf_release(&bisect_refs);
> + return status;
> }
>
> static int for_each_good_bisect_ref(const char *submodule, each_ref_fn fn,
> void *cb_data)
> {
> - return for_each_ref_in_submodule(submodule, "refs/bisect/good", fn,
> cb_data);
> + struct strbuf bisect_refs = STRBUF_INIT;
> + int status;
> + strbuf_addf(&bisect_refs, "refs/bisect/%s", name_good);
> + status = for_each_ref_in_submodule(submodule, bisect_refs.buf, fn,
> cb_data);
> + strbuf_release(&bisect_refs);
> + return status;
> }
I wonder if it would not be better to just have:
static int for_each_bisect_ref(const char *submodule, each_ref_fn fn,
const char *term, void *cb_data)
{
struct strbuf bisect_refs = STRBUF_INIT;
int status;
strbuf_addf(&bisect_refs, "refs/bisect/%s", term);
status = for_each_ref_in_submodule(submodule, bisect_refs.buf,
fn, cb_data);
strbuf_release(&bisect_refs);
return status;
}
This way it can be used with either name_good, name_bad or "skip" as
the term argument.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html