X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=diff.c;h=9e9cfc8b75b7b761980b0d32cb0c516ea3505ba3;hb=refs%2Fheads%2Fnext;hp=7f35e595c93a809d948580308e2bd3e90bb4b262;hpb=0c1d1ae43bf28f619a5397906a214a2e9c5ed916;p=git.git diff --git a/diff.c b/diff.c index 7f35e595..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, @@ -1989,6 +1989,9 @@ void diff_flush(struct diff_options *options) show_stats(diffstat); free(diffstat); diffstat = NULL; + 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 @@ -2005,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]); }