Thread (27 messages) flat view 27 messages, 5 authors, 2016-06-15

Re: [PATCH v7 3/5] bisect: simplify the addition of new bisect terms

From: Eric Sunshine <hidden>
Date: 2016-06-15 23:05:28

On Tue, Jun 23, 2015 at 8:54 AM, Matthieu Moy [off-list ref] wrote:
quoted hunk ↗ jump to hunk
diff --git a/revision.c b/revision.c
index 3ff8723..f22923f 100644
--- a/revision.c
+++ b/revision.c
@@ -2076,14 +2079,32 @@ void parse_revision_opt(struct rev_info *revs, struct parse_opt_ctx_t *ctx,
        ctx->argc -= n;
 }

+extern void read_bisect_terms(const char **bad, const char **good);
+
 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_buf = STRBUF_INIT;
+       const char *bisect_refs_str;
+       int status;
+       strbuf_addstr(&bisect_refs_buf, "refs/bisect/");
+       strbuf_addstr(&bisect_refs_buf, name_bad);
A single strbuf_addf() rather than two strbuf_addstr()s?
+       bisect_refs_str = strbuf_detach(&bisect_refs_buf, NULL);
+       status = for_each_ref_in_submodule(submodule, bisect_refs_str, fn, cb_data);
+       free((char *)bisect_refs_str);
Why the above rather than the simpler?

    strbuf_addstr(&bisect_refs, ...);
    status = for_each_ref_in_submodule(submodule, bisect_refs.buf, fn, cb_data);
    strbuf_release(&bisect_refs);

What am I missing?
+       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_buf = STRBUF_INIT;
+       const char *bisect_refs_str;
+       int status;
+       strbuf_addstr(&bisect_refs_buf, "refs/bisect/");
+       strbuf_addstr(&bisect_refs_buf, name_bad);
+       bisect_refs_str = strbuf_detach(&bisect_refs_buf, NULL);
+       status = for_each_ref_in_submodule(submodule, bisect_refs_str, fn, cb_data);
+       free((char *)bisect_refs_str);
Ditto.
+       return status;
 }
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help