Merge branch 'lt/revision-bisect'
* lt/revision-bisect: Add '--bisect' revision machinery argumentmaint
commit
578e5efd46
|
@ -320,6 +320,8 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
|
||||||
|
|
||||||
memset(&info, 0, sizeof(info));
|
memset(&info, 0, sizeof(info));
|
||||||
info.revs = &revs;
|
info.revs = &revs;
|
||||||
|
if (revs.bisect)
|
||||||
|
bisect_list = 1;
|
||||||
|
|
||||||
quiet = DIFF_OPT_TST(&revs.diffopt, QUIET);
|
quiet = DIFF_OPT_TST(&revs.diffopt, QUIET);
|
||||||
for (i = 1 ; i < argc; i++) {
|
for (i = 1 ; i < argc; i++) {
|
||||||
|
|
|
@ -180,6 +180,12 @@ static int show_reference(const char *refname, const unsigned char *sha1, int fl
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int anti_reference(const char *refname, const unsigned char *sha1, int flag, void *cb_data)
|
||||||
|
{
|
||||||
|
show_rev(REVERSED, sha1, refname);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static void show_datestring(const char *flag, const char *datestr)
|
static void show_datestring(const char *flag, const char *datestr)
|
||||||
{
|
{
|
||||||
static char buffer[100];
|
static char buffer[100];
|
||||||
|
@ -548,6 +554,11 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
|
||||||
for_each_ref(show_reference, NULL);
|
for_each_ref(show_reference, NULL);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (!strcmp(arg, "--bisect")) {
|
||||||
|
for_each_ref_in("refs/bisect/bad", show_reference, NULL);
|
||||||
|
for_each_ref_in("refs/bisect/good", anti_reference, NULL);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (!strcmp(arg, "--branches")) {
|
if (!strcmp(arg, "--branches")) {
|
||||||
for_each_branch_ref(show_reference, NULL);
|
for_each_branch_ref(show_reference, NULL);
|
||||||
continue;
|
continue;
|
||||||
|
|
19
revision.c
19
revision.c
|
@ -994,7 +994,8 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
|
||||||
if (!strcmp(arg, "--all") || !strcmp(arg, "--branches") ||
|
if (!strcmp(arg, "--all") || !strcmp(arg, "--branches") ||
|
||||||
!strcmp(arg, "--tags") || !strcmp(arg, "--remotes") ||
|
!strcmp(arg, "--tags") || !strcmp(arg, "--remotes") ||
|
||||||
!strcmp(arg, "--reflog") || !strcmp(arg, "--not") ||
|
!strcmp(arg, "--reflog") || !strcmp(arg, "--not") ||
|
||||||
!strcmp(arg, "--no-walk") || !strcmp(arg, "--do-walk"))
|
!strcmp(arg, "--no-walk") || !strcmp(arg, "--do-walk") ||
|
||||||
|
!strcmp(arg, "--bisect"))
|
||||||
{
|
{
|
||||||
unkv[(*unkc)++] = arg;
|
unkv[(*unkc)++] = arg;
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -1218,6 +1219,16 @@ void parse_revision_opt(struct rev_info *revs, struct parse_opt_ctx_t *ctx,
|
||||||
ctx->argc -= n;
|
ctx->argc -= n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int for_each_bad_bisect_ref(each_ref_fn fn, void *cb_data)
|
||||||
|
{
|
||||||
|
return for_each_ref_in("refs/bisect/bad", fn, cb_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int for_each_good_bisect_ref(each_ref_fn fn, void *cb_data)
|
||||||
|
{
|
||||||
|
return for_each_ref_in("refs/bisect/good", fn, cb_data);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Parse revision information, filling in the "rev_info" structure,
|
* Parse revision information, filling in the "rev_info" structure,
|
||||||
* and removing the used arguments from the argument list.
|
* and removing the used arguments from the argument list.
|
||||||
|
@ -1259,6 +1270,12 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
|
||||||
handle_refs(revs, flags, for_each_branch_ref);
|
handle_refs(revs, flags, for_each_branch_ref);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (!strcmp(arg, "--bisect")) {
|
||||||
|
handle_refs(revs, flags, for_each_bad_bisect_ref);
|
||||||
|
handle_refs(revs, flags ^ UNINTERESTING, for_each_good_bisect_ref);
|
||||||
|
revs->bisect = 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (!strcmp(arg, "--tags")) {
|
if (!strcmp(arg, "--tags")) {
|
||||||
handle_refs(revs, flags, for_each_tag_ref);
|
handle_refs(revs, flags, for_each_tag_ref);
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -63,6 +63,7 @@ struct rev_info {
|
||||||
reverse:1,
|
reverse:1,
|
||||||
reverse_output_stage:1,
|
reverse_output_stage:1,
|
||||||
cherry_pick:1,
|
cherry_pick:1,
|
||||||
|
bisect:1,
|
||||||
first_parent_only:1;
|
first_parent_only:1;
|
||||||
|
|
||||||
/* Diff flags */
|
/* Diff flags */
|
||||||
|
|
Loading…
Reference in New Issue