Skip to content

Commit f88851c

Browse files
Ikkegitster
authored andcommitted
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 <[email protected]> Helped-by: Eric Sunshine <[email protected]> Signed-off-by: Kevin Daudt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 282616c commit f88851c

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

Documentation/rev-list-options.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,8 @@ parents) and `--max-parents=-1` (negative numbers denote no upper limit).
119119
because merges into a topic branch tend to be only about
120120
adjusting to updated upstream from time to time, and
121121
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.
123124

124125
--not::
125126
Reverses the meaning of the '{caret}' prefix (or lack thereof)
@@ -177,7 +178,7 @@ ifndef::git-rev-list[]
177178
Pretend as if the bad bisection ref `refs/bisect/bad`
178179
was listed and as if it was followed by `--not` and the good
179180
bisection refs `refs/bisect/good-*` on the command
180-
line.
181+
line. Cannot be combined with --first-parent.
181182
endif::git-rev-list[]
182183

183184
--stdin::
@@ -558,7 +559,7 @@ outputs 'midpoint', the output of the two commands
558559
would be of roughly the same length. Finding the change which
559560
introduces a regression is thus reduced to a binary search: repeatedly
560561
generate and test new 'midpoint's until the commit chain is of length
561-
one.
562+
one. Cannot be combined with --first-parent.
562563

563564
--bisect-vars::
564565
This calculates the same as `--bisect`, except that refs in

revision.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2273,6 +2273,9 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s
22732273
if (!revs->reflog_info && revs->grep_filter.use_reflog_filter)
22742274
die("cannot use --grep-reflog without --walk-reflogs");
22752275

2276+
if (revs->first_parent_only && revs->bisect)
2277+
die(_("--first-parent is incompatible with --bisect"));
2278+
22762279
return left;
22772280
}
22782281

t/t6000-rev-list-misc.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,8 @@ test_expect_success 'symleft flag bit is propagated down from tag' '
7373
test_cmp expect actual
7474
'
7575

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+
7680
test_done

0 commit comments

Comments
 (0)