From: y@vger.kernel.org
To: git@vger.kernel.org
Cc: "SZEDER Gábor" <szeder@ira.uka.de>
Subject: [BUG] apply: test for trailing whitespace & no new line bug
Date: Mon, 22 Jun 2009 13:49:26 +0200 [thread overview]
Message-ID: <1245671366-23528-1-git-send-email-y> (raw)
In-Reply-To: <y>
From: SZEDER Gábor <szeder@ira.uka.de>
If a patch adds a new line to the end of a file and this line ends
with trailing whitespace but has no newline, then 'git apply
--whitespace=fix' does not remove the trailing whitespace from that
line.
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
---
Noticed last week, but couldn't fix it myself during the weekend.
t/t4124-apply-ws-rule.sh | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/t/t4124-apply-ws-rule.sh b/t/t4124-apply-ws-rule.sh
index f83322e..0db9b59 100755
--- a/t/t4124-apply-ws-rule.sh
+++ b/t/t4124-apply-ws-rule.sh
@@ -148,4 +148,22 @@ do
done
done
+create_patch () {
+ sed -e "s/_/ /" <<-\EOF
+ diff --git a/target b/target
+ index e69de29..8bd6648 100644
+ --- a/target
+ +++ b/target
+ @@ -0,0 +1 @@
+ +A line with trailing whitespace and no newline_
+ \ No newline at end of file
+ EOF
+}
+
+test_expect_failure 'trailing whitespace & no newline at the end of file' '
+ >target &&
+ create_patch | git apply --whitespace=fix - &&
+ git diff --check -- target
+'
+
test_done
--
1.6.3.2.370.g6bb4.dirty
next reply other threads:[~2009-06-22 11:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-22 11:49 y [this message]
-- strict thread matches above, loose matches on Subject: below --
2009-06-22 11:49 [BUG] apply: test for trailing whitespace & no new line bug y
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1245671366-23528-1-git-send-email-y \
--to=y@vger.kernel.org \
--cc=git@vger.kernel.org \
--cc=szeder@ira.uka.de \
/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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).