Browse Source

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
maint
Junio C Hamano 10 years ago
parent
commit
64b9326460
  1. 3
      line-log.c
  2. 5
      t/t4211-line-log.sh

3
line-log.c

@ -1141,6 +1141,9 @@ static int process_ranges_merge_commit(struct rev_info *rev, struct commit *comm @@ -1141,6 +1141,9 @@ static int process_ranges_merge_commit(struct rev_info *rev, struct commit *comm
int i;
int nparents = commit_list_count(commit->parents);

if (nparents > 1 && rev->first_parent_only)
nparents = 1;

diffqueues = xmalloc(nparents * sizeof(*diffqueues));
cand = xmalloc(nparents * sizeof(*cand));
parents = xmalloc(nparents * sizeof(*parents));

5
t/t4211-line-log.sh

@ -94,4 +94,9 @@ test_expect_success '-L ,Y (Y == nlines + 2)' ' @@ -94,4 +94,9 @@ test_expect_success '-L ,Y (Y == nlines + 2)' '
test_must_fail git log -L ,$n:b.c
'

test_expect_success '-L with --first-parent and a merge' '
git checkout parallel-change &&
git log --first-parent -L 1,1:b.c
'

test_done

Loading…
Cancel
Save