From: Liu Yubao <yubao.liu@gmail.com>
To: git@vger.kernel.org
Subject: hooks--pre-commit: chomp() in cygwin perl does not strip "\r"
Date: Fri, 20 Oct 2006 14:14:06 +0800 [thread overview]
Message-ID: <4538692E.6030404@gmail.com> (raw)
perl v5.8.7 built for cygwin-thread-multi-64int, its chomp() doesn't strip
trailing "\r" so that pre-commit reports "trailing whitespace" for every line.
ActiveState Perl v5.8.8 can strip "\r" and "\n" properly.
Changing
if (/\s$/) {
to
if (/[:blank:]$/) {
is also ok.
diff --git a/templates/hooks--pre-commit b/templates/hooks--pre-commit
index 723a9ef..6a55612
--- a/templates/hooks--pre-commit
+++ b/templates/hooks--pre-commit
@@ -54,7 +54,7 @@ perl -e '
}
if (s/^\+//) {
$lineno++;
- chomp;
+ s/[\r\n]+$//;
if (/\s$/) {
bad_line("trailing whitespace", $_);
}
reply other threads:[~2006-10-20 6:14 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=4538692E.6030404@gmail.com \
--to=yubao.liu@gmail.com \
--cc=git@vger.kernel.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).