Skip to content

Commit

Permalink
format-patch: add a blank line between notes and diffstat
Browse files Browse the repository at this point in the history
The last line of the note text comes immediately before the diffstat
block, making the latter unnecessarily harder to view.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Junio C Hamano committed Nov 13, 2012
1 parent d84cef1 commit 1d34c50
Showing 1 changed file with 21 additions and 10 deletions.
31 changes: 21 additions & 10 deletions log-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -727,27 +727,38 @@ int log_tree_diff_flush(struct rev_info *opt)
}

if (opt->loginfo && !opt->no_commit_id) {
/* When showing a verbose header (i.e. log message),
* and not in --pretty=oneline format, we would want
* an extra newline between the end of log and the
* output for readability.
*/
show_log(opt);
if ((opt->diffopt.output_format & ~DIFF_FORMAT_NO_OUTPUT) &&
opt->verbose_header &&
opt->commit_format != CMIT_FMT_ONELINE) {
/*
* When showing a verbose header (i.e. log message),
* and not in --pretty=oneline format, we would want
* an extra newline between the end of log and the
* diff/diffstat output for readability.
*/
int pch = DIFF_FORMAT_DIFFSTAT | DIFF_FORMAT_PATCH;
if (opt->diffopt.output_prefix) {
struct strbuf *msg = NULL;
msg = opt->diffopt.output_prefix(&opt->diffopt,
opt->diffopt.output_prefix_data);
fwrite(msg->buf, msg->len, 1, stdout);
}
if (!opt->shown_dashes) {
if ((pch & opt->diffopt.output_format) == pch)
printf("---");
putchar('\n');
}

/*
* We may have shown three-dashes line early
* between notes and the log message, in which
* case we only want a blank line after the
* notes without (an extra) three-dashes line.
* Otherwise, we show the three-dashes line if
* we are showing the patch with diffstat, but
* in that case, there is no extra blank line
* after the three-dashes line.
*/
if (!opt->shown_dashes &&
(pch & opt->diffopt.output_format) == pch)
printf("---");
putchar('\n');
}
}
diff_flush(&opt->diffopt);
Expand Down

0 comments on commit 1d34c50

Please sign in to comment.