You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by me...@apache.org on 2016/01/04 09:00:13 UTC

[1/2] mesos git commit: Added commit message guidelines to docs.

Repository: mesos
Updated Branches:
  refs/heads/master 5b145adea -> db767fa01


Added commit message guidelines to docs.

Review: https://reviews.apache.org/r/41584/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/be058aaa
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/be058aaa
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/be058aaa

Branch: refs/heads/master
Commit: be058aaa86d60e9cfa96e4d8a1a5edbb96e7c27d
Parents: 5b145ad
Author: Artem Harutyunyan <ar...@mesosphere.io>
Authored: Sun Jan 3 23:45:57 2016 -0800
Committer: Adam B <ad...@mesosphere.io>
Committed: Sun Jan 3 23:45:57 2016 -0800

----------------------------------------------------------------------
 docs/submitting-a-patch.md | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/be058aaa/docs/submitting-a-patch.md
----------------------------------------------------------------------
diff --git a/docs/submitting-a-patch.md b/docs/submitting-a-patch.md
index f0048f5..50361a9 100644
--- a/docs/submitting-a-patch.md
+++ b/docs/submitting-a-patch.md
@@ -49,6 +49,7 @@ layout: documentation
 4. Divide your change into one or more Git commits. Each commit should represent a single logical (atomic) change to the Mesos source code: this makes your changes easier to review. For more information, see the [reviewer guidelines](effective-code-reviewing.md).
     1. Try to avoid including other, unrelated cleanups (e.g., typo fixes or style nits) in the same commit that makes functional changes. While typo fixes are great, including them in the same commit as functional changes makes the commit history harder to read.
     2. Developers often make incremental commits to save their progress when working on a change, and then "rewrite history" (e.g., using `git rebase -i`) to create a clean set of commits once the change is ready to be reviewed.
+    3. Commit messages should be in past tense. The first sentence should summarize the change; it should start with a capital letter, not exceed 72 characters and end in a period.
 
 5. Make sure to pull in any changes that have been committed to master branch. Using Git, do this via something like:
     1. `git checkout master`


[2/2] mesos git commit: Partially enforced commit message guidelines with a hook.

Posted by me...@apache.org.
Partially enforced commit message guidelines with a hook.

Review: https://reviews.apache.org/r/41586/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/db767fa0
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/db767fa0
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/db767fa0

Branch: refs/heads/master
Commit: db767fa011d2d8686521c913e51ef479fbe99c94
Parents: be058aa
Author: Artem Harutyunyan <ar...@mesosphere.io>
Authored: Sun Jan 3 23:46:46 2016 -0800
Committer: Adam B <ad...@mesosphere.io>
Committed: Sun Jan 3 23:59:09 2016 -0800

----------------------------------------------------------------------
 bootstrap                |  4 ++++
 support/hooks/commit-msg | 31 +++++++++++++++++++++++++++++++
 2 files changed, 35 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/db767fa0/bootstrap
----------------------------------------------------------------------
diff --git a/bootstrap b/bootstrap
index 89d986f..ea71ff2 100755
--- a/bootstrap
+++ b/bootstrap
@@ -19,6 +19,10 @@ if test ! -e .git/hooks/post-rewrite; then
   ln -s ../../support/hooks/post-rewrite .git/hooks/post-rewrite
 fi
 
+if test ! -e .git/hooks/commit-msg; then
+  ln -s ../../support/hooks/commit-msg .git/hooks/commit-msg
+fi
+
 if test ! -e .gitignore; then
   ln -s .gitignore-template .gitignore
 fi

http://git-wip-us.apache.org/repos/asf/mesos/blob/db767fa0/support/hooks/commit-msg
----------------------------------------------------------------------
diff --git a/support/hooks/commit-msg b/support/hooks/commit-msg
new file mode 100755
index 0000000..5845398
--- /dev/null
+++ b/support/hooks/commit-msg
@@ -0,0 +1,31 @@
+#!/bin/bash
+#
+# A hook script to verify commit message format. Called by "git commit"
+# with one argument, the name of the file that has the commit message.
+# The hook exits with non-zero status after issuing an appropriate
+# message if it wants to stop the commit. The hook is allowed to edit the
+# commit message file.
+#
+# To enable this hook, run `bootstrap` or do this from the root of the repo:
+#
+# $ ln -s ../../support/hooks/commit-msg .git/hooks/commit-msg
+
+FIRST_LINE=$(head -n 1 $1)
+LAST_CHAR=$(echo -n $FIRST_LINE | tail -c 1)
+FIRST_CHAR=$(echo -n $FIRST_LINE | head -c 1)
+
+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 "72" ]; 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
+fi