Skip to content

Commit 1d34c50

Browse files
committed
format-patch: add a blank line between notes and diffstat
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 <[email protected]>
1 parent d84cef1 commit 1d34c50

File tree

1 file changed

+21
-10
lines changed

1 file changed

+21
-10
lines changed

log-tree.c

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -727,27 +727,38 @@ int log_tree_diff_flush(struct rev_info *opt)
727727
}
728728

729729
if (opt->loginfo && !opt->no_commit_id) {
730-
/* When showing a verbose header (i.e. log message),
731-
* and not in --pretty=oneline format, we would want
732-
* an extra newline between the end of log and the
733-
* output for readability.
734-
*/
735730
show_log(opt);
736731
if ((opt->diffopt.output_format & ~DIFF_FORMAT_NO_OUTPUT) &&
737732
opt->verbose_header &&
738733
opt->commit_format != CMIT_FMT_ONELINE) {
734+
/*
735+
* When showing a verbose header (i.e. log message),
736+
* and not in --pretty=oneline format, we would want
737+
* an extra newline between the end of log and the
738+
* diff/diffstat output for readability.
739+
*/
739740
int pch = DIFF_FORMAT_DIFFSTAT | DIFF_FORMAT_PATCH;
740741
if (opt->diffopt.output_prefix) {
741742
struct strbuf *msg = NULL;
742743
msg = opt->diffopt.output_prefix(&opt->diffopt,
743744
opt->diffopt.output_prefix_data);
744745
fwrite(msg->buf, msg->len, 1, stdout);
745746
}
746-
if (!opt->shown_dashes) {
747-
if ((pch & opt->diffopt.output_format) == pch)
748-
printf("---");
749-
putchar('\n');
750-
}
747+
748+
/*
749+
* We may have shown three-dashes line early
750+
* between notes and the log message, in which
751+
* case we only want a blank line after the
752+
* notes without (an extra) three-dashes line.
753+
* Otherwise, we show the three-dashes line if
754+
* we are showing the patch with diffstat, but
755+
* in that case, there is no extra blank line
756+
* after the three-dashes line.
757+
*/
758+
if (!opt->shown_dashes &&
759+
(pch & opt->diffopt.output_format) == pch)
760+
printf("---");
761+
putchar('\n');
751762
}
752763
}
753764
diff_flush(&opt->diffopt);

0 commit comments

Comments
 (0)