* hooks--pre-commit: chomp() in cygwin perl does not strip "\r"
@ 2006-10-20 6:14 Liu Yubao
0 siblings, 0 replies; only message in thread
From: Liu Yubao @ 2006-10-20 6:14 UTC (permalink / raw)
To: git
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", $_);
}
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2006-10-20 6:14 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-20 6:14 hooks--pre-commit: chomp() in cygwin perl does not strip "\r" Liu Yubao
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).