hooks--pre-commit: chomp() in cygwin perl does not strip "\r"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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", $_);
            }
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]