You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by mp...@apache.org on 2016/04/11 20:08:49 UTC

mesos git commit: Fixed the commit message hook to wrap the variables in quotes.

Repository: mesos
Updated Branches:
  refs/heads/master 00141e4a5 -> e5f5e92a9


Fixed the commit message hook to wrap the variables in quotes.

Some symbols, e.g., '*' can be expanded by the shell altering the
original line and hence leading to false positives.

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


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

Branch: refs/heads/master
Commit: e5f5e92a90358d21570b6cb56a5c6e33e98fbf07
Parents: 00141e4
Author: Michael Park <mp...@apache.org>
Authored: Mon Apr 11 11:07:03 2016 -0700
Committer: Michael Park <mp...@apache.org>
Committed: Mon Apr 11 11:07:03 2016 -0700

----------------------------------------------------------------------
 support/hooks/commit-msg | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/e5f5e92a/support/hooks/commit-msg
----------------------------------------------------------------------
diff --git a/support/hooks/commit-msg b/support/hooks/commit-msg
index d3f10c8..0e3a4e8 100755
--- a/support/hooks/commit-msg
+++ b/support/hooks/commit-msg
@@ -10,10 +10,10 @@
 #
 # $ 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)
+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)
 
 while read LINE
 do
@@ -21,8 +21,8 @@ do
     # Since git looks for the following line and skips everything after it,
     # we also skip everything once this line is observed.
     if [ "$LINE" = "# ------------------------ >8 ------------------------" ]; then break; fi
-    if [ "$(echo -n $LINE | head -c 1)" = "#" ]; then continue; fi
-    LENGTH=$(echo $LINE | wc -c)
+    if [ "$(echo -n "$LINE" | head -c 1)" = "#" ]; then continue; fi
+    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