X-Git-Url: https://git.octo.it/?p=git.git;a=blobdiff_plain;f=diff.c;h=9e9cfc8b75b7b761980b0d32cb0c516ea3505ba3;hp=160178367964e2c262366d6819fa26de3edb4a62;hb=162f41292167a800432fc6bbacfcd9f93a90b0c8;hpb=5e363541d0431b640e4bbbafb2941d1c64fa13c4 diff --git a/diff.c b/diff.c index 16017836..9e9cfc8b 100644 --- a/diff.c +++ b/diff.c @@ -237,7 +237,7 @@ static char *pprint_rename(const char *a, const char *b) if (a_midlen < 0) a_midlen = 0; if (b_midlen < 0) b_midlen = 0; - name = xmalloc(len_a + len_b - pfx_length - sfx_length + 7); + name = xmalloc(pfx_length + a_midlen + b_midlen + sfx_length + 7); sprintf(name, "%.*s{%.*s => %.*s}%s", pfx_length, a, a_midlen, a + pfx_length, @@ -299,6 +299,7 @@ static void diffstat_consume(void *priv, char *line, unsigned long len) static const char pluses[] = "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"; static const char minuses[]= "----------------------------------------------------------------------"; +const char mime_boundary_leader[] = "------------"; static void show_stats(struct diffstat_t* data) { @@ -1988,7 +1989,13 @@ void diff_flush(struct diff_options *options) show_stats(diffstat); free(diffstat); diffstat = NULL; - putchar(options->line_termination); + if (options->summary) + for (i = 0; i < q->nr; i++) + diff_summary(q->queue[i]); + if (options->stat_sep) + fputs(options->stat_sep, stdout); + else + putchar(options->line_termination); } for (i = 0; i < q->nr; i++) { struct diff_filepair *p = q->queue[i]; @@ -2001,7 +2008,7 @@ void diff_flush(struct diff_options *options) } for (i = 0; i < q->nr; i++) { - if (options->summary) + if (diffstat && options->summary) diff_summary(q->queue[i]); diff_free_filepair(q->queue[i]); }