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
This commit is contained in:
18
revision.c
18
revision.c
@ -18,9 +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;
|
||||
@ -2076,14 +2080,23 @@ void parse_revision_opt(struct rev_info *revs, struct parse_opt_ctx_t *ctx,
|
||||
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 @@ static int handle_revision_pseudo_opt(const char *submodule,
|
||||
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;
|
||||
|
Reference in New Issue
Block a user