Browse code

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

Junio C Hamano authored on 06/11/2014 18:52:36
Showing 2 changed files
... ...
@@ -1141,6 +1141,9 @@ static int process_ranges_merge_commit(struct rev_info *rev, struct commit *comm
1141 1141
 	int i;
1142 1142
 	int nparents = commit_list_count(commit->parents);
1143 1143
 
1144
+	if (nparents > 1 && rev->first_parent_only)
1145
+		nparents = 1;
1146
+
1144 1147
 	diffqueues = xmalloc(nparents * sizeof(*diffqueues));
1145 1148
 	cand = xmalloc(nparents * sizeof(*cand));
1146 1149
 	parents = xmalloc(nparents * sizeof(*parents));
... ...
@@ -94,4 +94,9 @@ test_expect_success '-L ,Y (Y == nlines + 2)' '
94 94
 	test_must_fail git log -L ,$n:b.c
95 95
 '
96 96
 
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
+
97 102
 test_done