@matheusbsbs / matheus-bagliano / commits / ad3f9a71a8
Fork 0

Add '--bisect' revision machinery argument

I personally use "git bisect visualize" all the time when I bisect, but it turns out that that is not a very flexible model. Sometimes I want to do bisection based on all commits (no pathname limiting), but then visualize the current bisection tree with just a few pathnames because I _suspect_ those pathnames are involved in the problem but am not totally sure about them. And at other times, I want to use other revision parsing logic, none of which is available with "git bisect visualize". So this adds "--bisect" as a revision parsing argument, and as a result it just works with all the normal logging tools. So now I can just do gitk --bisect --simplify-by-decoration filename-here etc. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Linus Torvalds committed Oct 27, 2009 at 11:28 UTC ad3f9a71a8200418e1da59b9712a8fde3f8c4c08
4 files changed +32 -1
builtin-rev-list.c
+2
@@ -319,6 +319,8 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
319
320 memset(&info, 0, sizeof(info));
321 info.revs = &revs;
322 + if (revs.bisect)
323 + bisect_list = 1;
324
325 quiet = DIFF_OPT_TST(&revs.diffopt, QUIET);
326 for (i = 1 ; i < argc; i++) {
builtin-rev-parse.c
+11
@@ -180,6 +180,12 @@ static int show_reference(const char *refname, const unsigned char *sha1, int fl
180 return 0;
181 }
182
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 +
189 static void show_datestring(const char *flag, const char *datestr)
190 {
191 static char buffer[100];
@@ -548,6 +554,11 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
554 for_each_ref(show_reference, NULL);
555 continue;
556 }
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 + }
562 if (!strcmp(arg, "--branches")) {
563 for_each_branch_ref(show_reference, NULL);
564 continue;
revision.c
+18 -1
@@ -994,7 +994,8 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
994 if (!strcmp(arg, "--all") || !strcmp(arg, "--branches") ||
995 !strcmp(arg, "--tags") || !strcmp(arg, "--remotes") ||
996 !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"))
999 {
1000 unkv[(*unkc)++] = arg;
1001 return 1;
@@ -1218,6 +1219,16 @@ void parse_revision_opt(struct rev_info *revs, struct parse_opt_ctx_t *ctx,
1219 ctx->argc -= n;
1220 }
1221
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 +
1232 /*
1233 * Parse revision information, filling in the "rev_info" structure,
1234 * 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
1270 handle_refs(revs, flags, for_each_branch_ref);
1271 continue;
1272 }
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 + }
1279 if (!strcmp(arg, "--tags")) {
1280 handle_refs(revs, flags, for_each_tag_ref);
1281 continue;
revision.h
+1
@@ -63,6 +63,7 @@ struct rev_info {
63 reverse:1,
64 reverse_output_stage:1,
65 cherry_pick:1,
66 + bisect:1,
67 first_parent_only:1;
68
69 /* Diff flags */