combine-diff: do not punt on removed or added files.
When we remove a file, the parents' contents are all removed so
it is not that interesting to show all of them, but the fact it
was removed when all parents had it *is* unusual. When we add a
file, similarly the fact it was added when no parent wanted it
*is* unusual, and in addition the result matters, so show it.
Signed-off-by: Junio C Hamano <junkio@cox.net>
int show_combined_diff(struct combine_diff_path *elem, int num_parent,
@ -665,27 +671,26 @@ int show_combined_diff(struct combine_diff_path *elem, int num_parent,
@@ -665,27 +671,26 @@ int show_combined_diff(struct combine_diff_path *elem, int num_parent,
if (*cp == '\n')
cnt++;
}
if (result[size-1] != '\n')
if (size && result[size-1] != '\n')
cnt++; /* incomplete line */
sline = xcalloc(cnt+1, sizeof(*sline));
ep = result;
sline[0].bol = result;
for (lno = 0; lno <= cnt; lno++) {
sline[lno].lost_tail = &sline[lno].lost_head;
sline[lno].flag = 0;
}
for (lno = 0, cp = result; cp - result < size; cp++) {
@ -750,7 +755,6 @@ int show_combined_diff(struct combine_diff_path *elem, int num_parent,
@@ -750,7 +755,6 @@ int show_combined_diff(struct combine_diff_path *elem, int num_parent,