From: Junio C Hamano Date: Wed, 12 Aug 2015 21:09:53 +0000 (-0700) Subject: Merge branch 'ad/bisect-cleanup' X-Git-Tag: v2.6.0-rc0~79 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/71cc60070f9d41765e58468e467352d2f008abfb?ds=inline;hp=-c Merge branch 'ad/bisect-cleanup' Code and documentation clean-up to "git bisect". * ad/bisect-cleanup: bisect: don't mix option parsing and non-trivial code bisect: simplify the addition of new bisect terms bisect: replace hardcoded "bad|good" by variables Documentation/bisect: revise overall content Documentation/bisect: move getting help section to the end bisect: correction of typo --- 71cc60070f9d41765e58468e467352d2f008abfb diff --combined revision.c index cf60c5d817,60a6f7c884..5350139599 --- a/revision.c +++ b/revision.c @@@ -18,9 -18,13 +18,13 @@@ #include "commit-slab.h" #include "dir.h" #include "cache-tree.h" + #include "bisect.h" volatile show_early_output_fn_t show_early_output; + static const char *term_bad; + static const char *term_good; + char *path_name(const struct name_path *path, const char *name) { const struct name_path *p; @@@ -361,8 -365,8 +365,8 @@@ static int everybody_uninteresting(stru list = list->next; if (commit->object.flags & UNINTERESTING) continue; - if (interesting_cache) - *interesting_cache = commit; + + *interesting_cache = commit; return 0; } return 1; @@@ -1996,10 -2000,10 +2000,10 @@@ static int handle_revision_opt(struct r } else if (!strcmp(arg, "--full-history")) { revs->simplify_history = 0; } else if (!strcmp(arg, "--relative-date")) { - revs->date_mode = DATE_RELATIVE; + revs->date_mode.type = DATE_RELATIVE; revs->date_mode_explicit = 1; } else if ((argcount = parse_long_opt("date", argv, &optarg))) { - revs->date_mode = parse_date_format(optarg); + parse_date_format(optarg, &revs->date_mode); revs->date_mode_explicit = 1; return argcount; } else if (!strcmp(arg, "--log-size")) { @@@ -2076,14 -2080,23 +2080,23 @@@ void parse_revision_opt(struct rev_inf ctx->argc -= n; } + static int for_each_bisect_ref(const char *submodule, each_ref_fn fn, void *cb_data, const char *term) { + 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; + } + 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); + return for_each_bisect_ref(submodule, fn, cb_data, term_bad); } 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); + return for_each_bisect_ref(submodule, fn, cb_data, term_good); } static int handle_revision_pseudo_opt(const char *submodule, @@@ -2112,6 -2125,7 +2125,7 @@@ handle_refs(submodule, revs, *flags, for_each_branch_ref_submodule); clear_ref_exclusion(&revs->ref_excludes); } else if (!strcmp(arg, "--bisect")) { + read_bisect_terms(&term_bad, &term_good); handle_refs(submodule, revs, *flags, for_each_bad_bisect_ref); handle_refs(submodule, revs, *flags ^ (UNINTERESTING | BOTTOM), for_each_good_bisect_ref); revs->bisect = 1;