diff options
author | Luboš Luňák <l.lunak@suse.cz> | 2013-03-01 19:18:38 +0100 |
---|---|---|
committer | Luboš Luňák <l.lunak@suse.cz> | 2013-03-01 19:37:34 +0100 |
commit | 86b49aa44e54d3dba3f0ae82b312ce4af95ce528 (patch) | |
tree | 42c2e254d6eb6f87716f79de722be7b13ac5e5ad /.git-hooks/commit-msg | |
parent | 74e40fbbbdb0b09f6529a26984f942a3d4b788bc (diff) |
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
Diffstat (limited to '.git-hooks/commit-msg')
-rwxr-xr-x | .git-hooks/commit-msg | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/.git-hooks/commit-msg b/.git-hooks/commit-msg index fa0b2e20aea8..637b1498ad66 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 # |