@matheusbsbs / matheus-bagliano / commits / 304b5af64f
Fork 0

Clean up "git log" format with DIFF_FORMAT_NO_OUTPUT

This fixes an unnecessary empty line that we add to the log message when we generate diffs, but don't actually end up printing any due to having DIFF_FORMAT_NO_OUTPUT set. This can happen with pickaxe or with rename following. The reason is that we normally add an empty line between the commit and the diff, but we do that even for the case where we've then suppressed the actual printing of the diff. This also updates a couple of tests that assumed the extraneous empty line would exist at the end of output. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Lars Hjemli <hjemli@gmail.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Linus Torvalds committed Oct 9, 2007 at 09:35 UTC 304b5af64f9b5a6b5e9455e2dcab381c568452b6
3 files changed +3 -3
log-tree.c
+2 -1
@@ -321,7 +321,8 @@ int log_tree_diff_flush(struct rev_info *opt)
321 * output for readability.
322 */
323 show_log(opt, opt->diffopt.msg_sep);
324 - if (opt->verbose_header &&
324 + if ((opt->diffopt.output_format & ~DIFF_FORMAT_NO_OUTPUT) &&
325 + opt->verbose_header &&
326 opt->commit_format != CMIT_FMT_ONELINE) {
327 int pch = DIFF_FORMAT_DIFFSTAT | DIFF_FORMAT_PATCH;
328 if ((pch & opt->diffopt.output_format) == pch)
t/t3900-i18n-commit.sh
+1 -1
@@ -8,7 +8,7 @@ test_description='commit and log output encodings'
8 . ./test-lib.sh
9
10 compare_with () {
11 - git show -s $1 | sed -e '1,/^$/d' -e 's/^ //' -e '$d' >current &&
11 + git show -s $1 | sed -e '1,/^$/d' -e 's/^ //' >current &&
12 git diff current "$2"
13 }
14
t/t4013/diff.log_-SF_master
-1
@@ -4,5 +4,4 @@ Author: A U Thor <author@example.com>
4 Date: Mon Jun 26 00:02:00 2006 +0000
5
6 Third
7 -
7 $