Skip to content

Commit 578e5ef

Browse files
committed
Merge branch 'lt/revision-bisect'
* lt/revision-bisect: Add '--bisect' revision machinery argument
2 parents b7fba06 + ad3f9a7 commit 578e5ef

File tree

4 files changed

+32
-1
lines changed

4 files changed

+32
-1
lines changed

builtin-rev-list.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,8 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
320320

321321
memset(&info, 0, sizeof(info));
322322
info.revs = &revs;
323+
if (revs.bisect)
324+
bisect_list = 1;
323325

324326
quiet = DIFF_OPT_TST(&revs.diffopt, QUIET);
325327
for (i = 1 ; i < argc; i++) {

builtin-rev-parse.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,12 @@ static int show_reference(const char *refname, const unsigned char *sha1, int fl
180180
return 0;
181181
}
182182

183+
static int anti_reference(const char *refname, const unsigned char *sha1, int flag, void *cb_data)
184+
{
185+
show_rev(REVERSED, sha1, refname);
186+
return 0;
187+
}
188+
183189
static void show_datestring(const char *flag, const char *datestr)
184190
{
185191
static char buffer[100];
@@ -548,6 +554,11 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
548554
for_each_ref(show_reference, NULL);
549555
continue;
550556
}
557+
if (!strcmp(arg, "--bisect")) {
558+
for_each_ref_in("refs/bisect/bad", show_reference, NULL);
559+
for_each_ref_in("refs/bisect/good", anti_reference, NULL);
560+
continue;
561+
}
551562
if (!strcmp(arg, "--branches")) {
552563
for_each_branch_ref(show_reference, NULL);
553564
continue;

revision.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -994,7 +994,8 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
994994
if (!strcmp(arg, "--all") || !strcmp(arg, "--branches") ||
995995
!strcmp(arg, "--tags") || !strcmp(arg, "--remotes") ||
996996
!strcmp(arg, "--reflog") || !strcmp(arg, "--not") ||
997-
!strcmp(arg, "--no-walk") || !strcmp(arg, "--do-walk"))
997+
!strcmp(arg, "--no-walk") || !strcmp(arg, "--do-walk") ||
998+
!strcmp(arg, "--bisect"))
998999
{
9991000
unkv[(*unkc)++] = arg;
10001001
return 1;
@@ -1218,6 +1219,16 @@ void parse_revision_opt(struct rev_info *revs, struct parse_opt_ctx_t *ctx,
12181219
ctx->argc -= n;
12191220
}
12201221

1222+
static int for_each_bad_bisect_ref(each_ref_fn fn, void *cb_data)
1223+
{
1224+
return for_each_ref_in("refs/bisect/bad", fn, cb_data);
1225+
}
1226+
1227+
static int for_each_good_bisect_ref(each_ref_fn fn, void *cb_data)
1228+
{
1229+
return for_each_ref_in("refs/bisect/good", fn, cb_data);
1230+
}
1231+
12211232
/*
12221233
* Parse revision information, filling in the "rev_info" structure,
12231234
* 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
12591270
handle_refs(revs, flags, for_each_branch_ref);
12601271
continue;
12611272
}
1273+
if (!strcmp(arg, "--bisect")) {
1274+
handle_refs(revs, flags, for_each_bad_bisect_ref);
1275+
handle_refs(revs, flags ^ UNINTERESTING, for_each_good_bisect_ref);
1276+
revs->bisect = 1;
1277+
continue;
1278+
}
12621279
if (!strcmp(arg, "--tags")) {
12631280
handle_refs(revs, flags, for_each_tag_ref);
12641281
continue;

revision.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ struct rev_info {
6363
reverse:1,
6464
reverse_output_stage:1,
6565
cherry_pick:1,
66+
bisect:1,
6667
first_parent_only:1;
6768

6869
/* Diff flags */

0 commit comments

Comments
 (0)