Skip to content

Commit 64b9326

Browse files
committed
Merge branch 'tm/line-log-first-parent'
"git log --first-parent -L..." used to crash. * tm/line-log-first-parent: line-log: fix crash when --first-parent is used
2 parents a1671dd + a8787c5 commit 64b9326

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

line-log.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,6 +1141,9 @@ static int process_ranges_merge_commit(struct rev_info *rev, struct commit *comm
11411141
int i;
11421142
int nparents = commit_list_count(commit->parents);
11431143

1144+
if (nparents > 1 && rev->first_parent_only)
1145+
nparents = 1;
1146+
11441147
diffqueues = xmalloc(nparents * sizeof(*diffqueues));
11451148
cand = xmalloc(nparents * sizeof(*cand));
11461149
parents = xmalloc(nparents * sizeof(*parents));

t/t4211-line-log.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,9 @@ test_expect_success '-L ,Y (Y == nlines + 2)' '
9494
test_must_fail git log -L ,$n:b.c
9595
'
9696

97+
test_expect_success '-L with --first-parent and a merge' '
98+
git checkout parallel-change &&
99+
git log --first-parent -L 1,1:b.c
100+
'
101+
97102
test_done

0 commit comments

Comments
 (0)