rev-list: refuse --first-parent combined with --bisect

rev-list --bisect is used by git bisect, but never together with --first-parent. Because rev-list --bisect together with --first-parent is not handled currently, and even leads to segfaults, refuse to use both options together. Because this is not supported, it makes little sense to use git log --bisect --first parent either, because refs/heads/bad is not limited to the first parent chain. Helped-by: Junio C. Hamano <gitster@pobox.com> Helped-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Kevin Daudt <me@ikke.info> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Kevin Daudt committed Mar 19, 2015 at 23:14 UTC f88851c6376f0b2a4cf87c061a848e4ae4438e0a
3 files changed +11 -3
Documentation/rev-list-options.txt
+4 -3
@@ -119,7 +119,8 @@ parents) and `--max-parents=-1` (negative numbers denote no upper limit).
119 because merges into a topic branch tend to be only about
120 adjusting to updated upstream from time to time, and
121 this option allows you to ignore the individual commits
122 - brought in to your history by such a merge.
122 + brought in to your history by such a merge. Cannot be
123 + combined with --bisect.
124
125 --not::
126 Reverses the meaning of the '{caret}' prefix (or lack thereof)
@@ -177,7 +178,7 @@ ifndef::git-rev-list[]
178 Pretend as if the bad bisection ref `refs/bisect/bad`
179 was listed and as if it was followed by `--not` and the good
180 bisection refs `refs/bisect/good-*` on the command
180 - line.
181 + line. Cannot be combined with --first-parent.
182 endif::git-rev-list[]
183
184 --stdin::
@@ -558,7 +559,7 @@ outputs 'midpoint', the output of the two commands
559 would be of roughly the same length. Finding the change which
560 introduces a regression is thus reduced to a binary search: repeatedly
561 generate and test new 'midpoint's until the commit chain is of length
561 -one.
562 +one. Cannot be combined with --first-parent.
563
564 --bisect-vars::
565 This calculates the same as `--bisect`, except that refs in
revision.c
+3
@@ -2273,6 +2273,9 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s
2273 if (!revs->reflog_info && revs->grep_filter.use_reflog_filter)
2274 die("cannot use --grep-reflog without --walk-reflogs");
2275
2276 + if (revs->first_parent_only && revs->bisect)
2277 + die(_("--first-parent is incompatible with --bisect"));
2278 +
2279 return left;
2280 }
2281
t/t6000-rev-list-misc.sh
+4
@@ -73,4 +73,8 @@ test_expect_success 'symleft flag bit is propagated down from tag' '
73 test_cmp expect actual
74 '
75
76 +test_expect_success '--bisect and --first-parent can not be combined' '
77 + test_must_fail git rev-list --bisect --first-parent HEAD
78 +'
79 +
80 test_done