From: Stefan Beller <sbeller@google.com>
To: sbeller@google.com
Cc: git@vger.kernel.org, gitster@pobox.com, torvalds@linux-foundation.org
Subject: [PATCH] diff: correct newline in summary for renamed files
Date: Wed, 27 Sep 2017 14:58:52 -0700 [thread overview]
Message-ID: <20170927215852.20163-1-sbeller@google.com> (raw)
In-Reply-To: <CAGZ79kbCgTNaunfneWHP3xkLeXwW72CZZWs7Sv8A7QL_UYE_HQ@mail.gmail.com>
From: Linus Torvalds <torvalds@linux-foundation.org>
In 146fdb0dfe (diff.c: emit_diff_symbol learns about DIFF_SYMBOL_SUMMARY,
2017-06-29), the conversion from direct printing to the symbol emission
dropped the new line character for renamed, copied and rewritten files.
Add the emission of a newline, add a test for this case.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Stefan Beller <sbeller@google.com>
---
Linus, I assumed your sign off for the original patch. Thanks for spotting.
Adding the mode change to t4016 seems like the easiest way to test it.
Thanks,
Stefan
diff.c | 1 +
t/t4016-diff-quote.sh | 2 ++
2 files changed, 3 insertions(+)
diff --git a/diff.c b/diff.c
index 3c6a3e0faa..653bb2e72e 100644
--- a/diff.c
+++ b/diff.c
@@ -5272,6 +5272,7 @@ static void show_mode_change(struct diff_options *opt, struct diff_filepair *p,
strbuf_addch(&sb, ' ');
quote_c_style(p->two->path, &sb, NULL, 0);
}
+ strbuf_addch(&sb, '\n');
emit_diff_symbol(opt, DIFF_SYMBOL_SUMMARY,
sb.buf, sb.len, 0);
strbuf_release(&sb);
diff --git a/t/t4016-diff-quote.sh b/t/t4016-diff-quote.sh
index 9c48e5c2c9..514056dd10 100755
--- a/t/t4016-diff-quote.sh
+++ b/t/t4016-diff-quote.sh
@@ -30,6 +30,7 @@ test_expect_success setup '
git add . &&
git commit -m initial &&
git mv "$P0.0" "R$P0.0" &&
+ chmod a+x "R$P0.0" &&
git mv "$P0.1" "R$P1.0" &&
git mv "$P0.2" "R$P2.0" &&
git mv "$P0.3" "R$P3.0" &&
@@ -47,6 +48,7 @@ cat >expect <<\EOF
rename pathname.2 => Rpathname with SP.0 (100%)
rename "pathname\twith HT.2" => Rpathname with SP.1 (100%)
rename pathname.0 => Rpathname.0 (100%)
+ mode change 100644 => 100755
rename "pathname\twith HT.0" => Rpathname.1 (100%)
EOF
'
--
2.14.0.rc0.3.g6c2e499285
next prev parent reply other threads:[~2017-09-27 21:58 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-27 18:15 diffstat summary mode change bug Linus Torvalds
2017-09-27 20:40 ` Stefan Beller
2017-09-27 21:02 ` Linus Torvalds
2017-09-27 21:09 ` Stefan Beller
2017-09-27 21:58 ` Stefan Beller [this message]
2017-09-27 22:04 ` [PATCH] diff: correct newline in summary for renamed files Linus Torvalds
2017-09-27 22:09 ` Jeff King
2017-09-27 22:32 ` Jeff King
2017-09-27 22:39 ` Stefan Beller
2017-09-27 22:49 ` Jeff King
2017-09-27 22:51 ` Stefan Beller
2017-09-27 23:15 ` Jonathan Nieder
2017-09-27 23:49 ` Ramsay Jones
2017-09-27 23:57 ` Stefan Beller
2017-09-28 0:39 ` Jeff King
2017-09-28 4:14 ` Junio C Hamano
2017-09-28 0:35 ` Jeff King
2017-09-27 22:34 ` Stefan Beller
2017-09-28 4:12 ` diffstat summary mode change bug Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170927215852.20163-1-sbeller@google.com \
--to=sbeller@google.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).