{"thread":{"id":"5961","subject":"hooks--pre-commit: chomp() in cygwin perl does not strip \"\\r\"","startedAt":"2006-10-20T06:14:06Z","lastAt":"2006-10-20T06:14:06Z","messageCount":1,"participants":["Liu Yubao"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"29294","messageId":"4538692E.6030404@gmail.com","threadId":"5961","inReplyTo":null,"subject":"hooks--pre-commit: chomp() in cygwin perl does not strip \"\\r\"","fromName":"Liu Yubao","fromEmail":"yubao.liu@gmail.com","sentAt":"2006-10-20T06:14:06Z","receivedAt":"2006-10-20T06:14:06Z","isPatch":false,"sender":{"key":"yubao.liu@gmail.com","avatar":null},"body":"perl v5.8.7 built for cygwin-thread-multi-64int, its chomp() doesn't strip\ntrailing \"\\r\" so that pre-commit reports \"trailing whitespace\" for every line.\nActiveState Perl v5.8.8 can strip \"\\r\" and \"\\n\" properly.\n\nChanging\n\tif (/\\s$/) {\nto\n\tif (/[:blank:]$/) {\nis also ok.\n\ndiff --git a/templates/hooks--pre-commit b/templates/hooks--pre-commit\nindex 723a9ef..6a55612\n--- a/templates/hooks--pre-commit\n+++ b/templates/hooks--pre-commit\n@@ -54,7 +54,7 @@ perl -e '\n         }\n         if (s/^\\+//) {\n             $lineno++;\n-           chomp;\n+           s/[\\r\\n]+$//;\n             if (/\\s$/) {\n                 bad_line(\"trailing whitespace\", $_);\n             }\n"}]}