git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] allow a single form feed in pre commit hook
@ 2007-12-18 10:09 Hannes Eder
  0 siblings, 0 replies; 4+ messages in thread
From: Hannes Eder @ 2007-12-18 10:09 UTC (permalink / raw)
  To: git

It's not uncommon to have a line with a single form feed in it, e.g.
the default GPL COPYING and also in .c files and others. Attached
patch allows this in the pre-commit hook.

-Hannes

diff --git a/templates/hooks--pre-commit b/templates/hooks--pre-commit
index 7092bae..a759f92 100644
--- a/templates/hooks--pre-commit
+++ b/templates/hooks--pre-commit
@@ -55,7 +55,7 @@ perl -e '
 	if (s/^\+//) {
 	    $lineno++;
 	    chomp;
-	    if (/\s$/) {
+	    if (!/^\f$/ && /\s$/) {
 		bad_line("trailing whitespace", $_);
 	    }
 	    if (/^\s* \t/) {

^ permalink raw reply related	[flat|nested] 4+ messages in thread
* [PATCH] allow a single form feed in pre commit hook
@ 2007-12-18  9:47 Hannes Eder
  2007-12-18 10:18 ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Hannes Eder @ 2007-12-18  9:47 UTC (permalink / raw)
  To: git

[-- Attachment #1: Type: text/plain, Size: 187 bytes --]

It's not uncommon to have a lines with a single form feed in it, e.g.
the default GPL COPYING and also in .c files and others. Attached
patch allows this in the pre-commit hook.

-Hannes

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: pre-commit-hook-allow-form-feed-200712181.patch --]
[-- Type: text/x-diff; name=pre-commit-hook-allow-form-feed-200712181.patch, Size: 591 bytes --]

From 454ede83f7a45741d825f0b6cbdb0be2ac235fdb Mon Sep 17 00:00:00 2001
From: Hannes Eder <Hannes@HannesEder.net>
Date: Tue, 18 Dec 2007 10:21:11 +0100
Subject: [PATCH] allow a lines with just one form feed in pre-commit hook


diff --git a/templates/hooks--pre-commit b/templates/hooks--pre-commit
index 7092bae..a759f92 100644
--- a/templates/hooks--pre-commit
+++ b/templates/hooks--pre-commit
@@ -55,7 +55,7 @@ perl -e '
 	if (s/^\+//) {
 	    $lineno++;
 	    chomp;
-	    if (/\s$/) {
+	    if (!/^\f$/ && /\s$/) {
 		bad_line("trailing whitespace", $_);
 	    }
 	    if (/^\s* \t/) {

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-12-18 10:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-18 10:09 [PATCH] allow a single form feed in pre commit hook Hannes Eder
  -- strict thread matches above, loose matches on Subject: below --
2007-12-18  9:47 Hannes Eder
2007-12-18 10:18 ` Junio C Hamano
2007-12-18 10:27   ` Jakub Narebski

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).