bisect: simplify the addition of new bisect terms
We create a file BISECT_TERMS in the repository .git to be read during a bisection. There's no user-interface yet, but "git bisect" works if terms other than old/new or bad/good are set in .git/BISECT_TERMS. The fonctions to be changed if we add new terms are quite few. In git-bisect.sh: check_and_set_terms bisect_voc Co-authored-by: Louis Stuber <stuberl@ensimag.grenoble-inp.fr> Tweaked-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Antoine Delaite <antoine.delaite@ensimag.grenoble-inp.fr> Signed-off-by: Louis Stuber <stuberl@ensimag.grenoble-inp.fr> Signed-off-by: Valentin Duperray <Valentin.Duperray@ensimag.imag.fr> Signed-off-by: Franck Jonas <Franck.Jonas@ensimag.imag.fr> Signed-off-by: Lucien Kong <Lucien.Kong@ensimag.imag.fr> Signed-off-by: Thomas Nguy <Thomas.Nguy@ensimag.imag.fr> Signed-off-by: Huynh Khoi Nguyen Nguyen <Huynh-Khoi-Nguyen.Nguyen@ensimag.imag.fr> Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
43f9d9f3a6
commit
cb46d630ba
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