changeset 28013:e529b5f1b9e3

check-commit: check for double-addition of blank lines Previously, we were only checking for a blank line being added next to an existing one. Now we also check for two being added at the same time.
author Matt Mackall <mpm@selenic.com>
date Fri, 05 Feb 2016 16:54:01 -0600
parents 897b2fcf079f
children 83fc0c055664
files contrib/check-commit tests/test-contrib-check-commit.t
diffstat 2 files changed, 9 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/check-commit	Fri Feb 05 16:52:02 2016 -0600
+++ b/contrib/check-commit	Fri Feb 05 16:54:01 2016 -0600
@@ -34,7 +34,7 @@
      "summary keyword should be most user-relevant one-word command or topic"),
     (afterheader + r".*\.\s*\n", "don't add trailing period on summary line"),
     (afterheader + r".{79,}", "summary line too long (limit is 78)"),
-    (r"\n\+\n \n", "adds double empty line"),
+    (r"\n\+\n( |\+)\n", "adds double empty line"),
     (r"\n \n\+\n", "adds double empty line"),
     (r"\n\+[ \t]+def [a-z]+_[a-z]", "adds a function with foo_bar naming"),
 ]
--- a/tests/test-contrib-check-commit.t	Fri Feb 05 16:52:02 2016 -0600
+++ b/tests/test-contrib-check-commit.t	Fri Feb 05 16:54:01 2016 -0600
@@ -87,6 +87,10 @@
   > @@ -599,7 +599,7 @@
   >          if opts.get('all'):
   >  
+  > 
+  > +
+  > + some = otherjunk
+  > +
   > +
   > + def blah_blah(x):
   > +     pass
@@ -102,10 +106,10 @@
    This has no topic and ends with a period.
   7: don't add trailing period on summary line
    This has no topic and ends with a period.
-  15: adds double empty line
-   +
-  16: adds a function with foo_bar naming
-   + def blah_blah(x):
   19: adds double empty line
    +
+  20: adds a function with foo_bar naming
+   + def blah_blah(x):
+  23: adds double empty line
+   +
   [1]