{"thread":{"id":"11338","subject":"[PATCH] allow a single form feed in pre commit hook","startedAt":"2007-12-18T09:47:27Z","lastAt":"2007-12-18T10:27:52Z","messageCount":3,"participants":["Hannes Eder","Junio C Hamano","Jakub Narebski"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"63580","messageId":"5d2716640712180147x36aa3178ja8658e30842c4e52@mail.gmail.com","threadId":"11338","inReplyTo":null,"subject":"[PATCH] allow a single form feed in pre commit hook","fromName":"Hannes Eder","fromEmail":"hannes.eder@gmail.com","sentAt":"2007-12-18T09:47:27Z","receivedAt":"2007-12-18T09:47:27Z","isPatch":true,"sender":{"key":"hannes.eder@gmail.com","avatar":null},"body":"It's not uncommon to have a lines with a single form feed in it, e.g.\nthe default GPL COPYING and also in .c files and others. Attached\npatch allows this in the pre-commit hook.\n\n-Hannes\n\n\nFrom 454ede83f7a45741d825f0b6cbdb0be2ac235fdb Mon Sep 17 00:00:00 2001\nFrom: Hannes Eder <Hannes@HannesEder.net>\nDate: Tue, 18 Dec 2007 10:21:11 +0100\nSubject: [PATCH] allow a lines with just one form feed in pre-commit hook\n\n\ndiff --git a/templates/hooks--pre-commit b/templates/hooks--pre-commit\nindex 7092bae..a759f92 100644\n--- a/templates/hooks--pre-commit\n+++ b/templates/hooks--pre-commit\n@@ -55,7 +55,7 @@ perl -e '\n \tif (s/^\\+//) {\n \t    $lineno++;\n \t    chomp;\n-\t    if (/\\s$/) {\n+\t    if (!/^\\f$/ && /\\s$/) {\n \t\tbad_line(\"trailing whitespace\", $_);\n \t    }\n \t    if (/^\\s* \\t/) {\n"},{"id":"63585","messageId":"7v4peg1f33.fsf@gitster.siamese.dyndns.org","threadId":"11338","inReplyTo":"5d2716640712180147x36aa3178ja8658e30842c4e52@mail.gmail.com","subject":"Re: [PATCH] allow a single form feed in pre commit hook","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-12-18T10:18:08Z","receivedAt":"2007-12-18T10:18:08Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Hannes Eder\" <hannes.eder@gmail.com> writes:\n\n> It's not uncommon to have a lines with a single form feed in it, e.g.\n> the default GPL COPYING and also in .c files and others. Attached\n> patch allows this in the pre-commit hook.\n\nHmm.  The current trend is to get rid of the whitespace checks from this\nhook and enrich git-diff --check and git-apply --whitespace=error.\n\nI've been planning to add a new whitespace error rule that allows ^M at\nthe end of line, post 1.5.4.  Another rule that allows a lone ^L would\nmatch what you are doing here, and it would be a good addition as well.\n"},{"id":"63586","messageId":"m3prx4paam.fsf@roke.D-201","threadId":"11338","inReplyTo":"7v4peg1f33.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] allow a single form feed in pre commit hook","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2007-12-18T10:27:52Z","receivedAt":"2007-12-18T10:27:52Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> \"Hannes Eder\" <hannes.eder@gmail.com> writes:\n> \n> > It's not uncommon to have a lines with a single form feed in it, e.g.\n> > the default GPL COPYING and also in .c files and others. Attached\n> > patch allows this in the pre-commit hook.\n> \n> Hmm.  The current trend is to get rid of the whitespace checks from this\n> hook and enrich git-diff --check and git-apply --whitespace=error.\n> \n> I've been planning to add a new whitespace error rule that allows ^M at\n> the end of line, post 1.5.4.  Another rule that allows a lone ^L would\n> match what you are doing here, and it would be a good addition as well.\n \nThere probably should also be 'trailing-empty-lines' rule; also\n'eol-at-eof' could be useful as well (ensuring that final line ends\nwith newline character).\n\nBy the way, the check in pre-commit hook also checks for merge\nconflict markers.  Those are not whitespace errors, but are quite\nsimilar.  It would be nice to have this also .gitattributes\ncontrolled, to avoid false positoves for changes in\nDocumentation/*.txt; althought perhaps more strict checking would be\nenough...\n\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"}]}