[PATCH] check-commit: reject double-blank lines at the top level

Matt Mackall mpm at selenic.com
Fri Feb 5 17:58:45 EST 2016


On Fri, 2016-02-05 at 16:11 -0500, Augie Fackler wrote:
> On Thu, Feb 04, 2016 at 08:15:59PM +0000, Martijn Pieters wrote:
> > # HG changeset patch
> > # User Martijn Pieters <mjpieters at fb.com>
> > # Date 1454616950 0
> > #      Thu Feb 04 20:15:50 2016 +0000
> > # Node ID 45449d6428804e2441ecb8ae5727079e62557876
> > # Parent  b1878a8f4543825e3f4052dc54323c2a0dbc46f1
> > check-commit: reject double-blank lines at the top level
> 
> Sure, queued.
> 
> > 
> > diff --git a/contrib/check-commit b/contrib/check-commit
> > --- a/contrib/check-commit
> > +++ b/contrib/check-commit
> > @@ -37,6 +37,8 @@
> >      (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"),
> > +    (r'\n\n\n(def|class)', 'Use just one blank line between top-level '
> > +     'functions and class definitions'),

Check-commit runs against diffs and should only be looking at metadata and
newly-introduced changes. So when it's looking at the diff part of the diff, it
should probably only be looking at lines starting with "+". I'm going to drop
this version, I've mailed out a suggested replacement.

-- 
Mathematics is the supreme nostalgia of our time.



More information about the Mercurial-devel mailing list