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 <gitster@pobox.com>
Junio C Hamano committed
Nov 13, 2012 at 10:09 UTC
1d34c50f132d2234bd70956ef99b2b94786d43dd
1 file changed
+21
-10
log-tree.c
+21
-10
@@ -727,15 +727,16 @@ int log_tree_diff_flush(struct rev_info *opt)
727
}
728
729
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
- */
730
show_log(opt);
731
if ((opt->diffopt.output_format & ~DIFF_FORMAT_NO_OUTPUT) &&
732
opt->verbose_header &&
733
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
+ */
740
int pch = DIFF_FORMAT_DIFFSTAT | DIFF_FORMAT_PATCH;
741
if (opt->diffopt.output_prefix) {
742
struct strbuf *msg = NULL;
@@ -743,11 +744,21 @@ int log_tree_diff_flush(struct rev_info *opt)
744
opt->diffopt.output_prefix_data);
745
fwrite(msg->buf, msg->len, 1, stdout);
746
}
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');
762
}
763
}
764
diff_flush(&opt->diffopt);