[Libreoffice-commits] core.git: 2 commits - .git-hooks/commit-msg

Luboš Luňák l.lunak at suse.cz
Fri Mar 1 10:38:00 PST 2013


 .git-hooks/commit-msg |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

New commits:
commit b3553246c6e1e444681ef5cc2987d693edc01f12
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Fri Mar 1 19:31:56 2013 +0100

    grep actually doesn't normally know \t, but [:blank:] is [ \t]
    
    Change-Id: Ie9bf8ea60f1c0595aa3ac2e0f9b3e6505af30e6c

diff --git a/.git-hooks/commit-msg b/.git-hooks/commit-msg
index 637b149..e3dfe69 100755
--- a/.git-hooks/commit-msg
+++ b/.git-hooks/commit-msg
@@ -35,7 +35,7 @@ test "" = "$(grep '^Signed-off-by: ' "$1" |
 
 # Check that the first line exists, and is not an asterisk
 
-if [ -z "`head -n 1 $1 | grep -v '^[ \t]*\*$'`" ] ; then
+if [ -z "`head -n 1 $1 | grep -v '^[[:blank:]]*\*$'`" ] ; then
     abort "$1" "Please provide the general description on the first line."
 fi
 
commit 86b49aa44e54d3dba3f0ae82b312ce4af95ce528
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Fri Mar 1 19:18:38 2013 +0100

    warn about commit messages with accidental comments
    
    The comment provided by git starts lines with '# ' (space or tab),
    so warn if a line starts with # not followed by a space. It's most
    likely something like '#ifdef UNX' or AOO's '#i103131#'. We already
    have commits where git silently stripped off such lines.
    
    Change-Id: Ic366d8ee64207edb8bb2fb1ef3a6a192f55872d8

diff --git a/.git-hooks/commit-msg b/.git-hooks/commit-msg
index fa0b2e2..637b149 100755
--- a/.git-hooks/commit-msg
+++ b/.git-hooks/commit-msg
@@ -62,6 +62,14 @@ if [ -n "`sed '/^#/,$d' $1 | grep '^[[:space:]]\+\*.*:'`" -a -z "`grep '^\*' $1`
     abort "$1" "Please don't use whitespace in front of '* file: Description.' entries."
 fi
 
+# Check that lines do not start with '#<something>' (possibly accidental commit,
+# such as starting the message with '#ifdef', git commits start with '#<whitespace>'.
+
+if [ -n "`grep '^#[^[:blank:]]' $1`" ] ; then
+    abort "$1" "Possible accidental comment in the commit message (leading # without space)."
+fi
+
+
 #------------------ copied gerrit commit-msg hook to handle ChangeId -->
 # From Gerrit Code Review 2.3
 #


More information about the Libreoffice-commits mailing list