You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by vi...@apache.org on 2016/04/05 01:21:07 UTC
mesos git commit: Extended Commit Message Hook to check every line
for length.
Repository: mesos
Updated Branches:
refs/heads/master 40b84e085 -> 509c32f32
Extended Commit Message Hook to check every line for length.
Previously only the first line was checked for length.
Review: https://reviews.apache.org/r/45603/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/509c32f3
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/509c32f3
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/509c32f3
Branch: refs/heads/master
Commit: 509c32f326110ebf488540a46e85f7ca88910952
Parents: 40b84e0
Author: Joerg Schad <jo...@mesosphere.io>
Authored: Mon Apr 4 16:20:50 2016 -0700
Committer: Vinod Kone <vi...@gmail.com>
Committed: Mon Apr 4 16:20:50 2016 -0700
----------------------------------------------------------------------
support/hooks/commit-msg | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/509c32f3/support/hooks/commit-msg
----------------------------------------------------------------------
diff --git a/support/hooks/commit-msg b/support/hooks/commit-msg
index 51b22a0..d3d5415 100755
--- a/support/hooks/commit-msg
+++ b/support/hooks/commit-msg
@@ -10,21 +10,25 @@
#
# $ ln -s ../../support/hooks/commit-msg .git/hooks/commit-msg
+COMMIT_MESSAGE=$(cat $1)
FIRST_LINE=$(head -n 1 $1)
LAST_CHAR=$(echo -n $FIRST_LINE | tail -c 1)
FIRST_CHAR=$(echo -n $FIRST_LINE | head -c 1)
+for LINE in $COMMIT_MESSAGE
+do
+ LENGTH=$(echo $LINE | wc -c)
+ if [ "$LENGTH" -gt "73" ]; then
+ echo >&2 "Error: No line in the commit message summary may exceed 72 characters."
+ exit 1
+ fi
+done
+
if [[ ! "$FIRST_CHAR" =~ [A-Z] ]]; then
echo >&2 "Error: Commit message summary (the first line) must start with a capital letter."
exit 1
fi
-LENGTH=$(echo $FIRST_LINE | wc -c)
-if [ "$LENGTH" -gt "73" ]; then
- echo >&2 "Error: Commit message summary (the first line) must not exceed 72 characters."
- exit 1
-fi
-
if [ "$LAST_CHAR" != "." ]; then
echo >&2 "Error: Commit message summary (the first line) must end in a period."
exit 1