[Cmake-commits] CMake branch, hooks, updated. 11679f83379b6cf5141cf79af56ab7ff966ef797

cmake-commits at cmake.org cmake-commits at cmake.org
Tue Apr 23 11:17:08 EDT 2013


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, hooks has been updated
       via  11679f83379b6cf5141cf79af56ab7ff966ef797 (commit)
       via  0d9698a1517db0fd37a0a0b4cff2128f3d27ee71 (commit)
       via  c530aa9375b3412ecba16dad053052500f828e2f (commit)
       via  e684969995e937e47cf60a3577dd47d361db7c5b (commit)
       via  2d9ee2a97cb41c505692d39aa172ed074c98c48e (commit)
       via  646b891d70dc244bebd0a5738626168292a16f6f (commit)
      from  5ebbe2daccbb2fc20aa8a43bf872dd2a722156b6 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=11679f83379b6cf5141cf79af56ab7ff966ef797
commit 11679f83379b6cf5141cf79af56ab7ff966ef797
Author:     Ben Boeckel <ben.boeckel at kitware.com>
AuthorDate: Tue Apr 16 12:52:37 2013 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Tue Apr 16 15:14:08 2013 -0400

    commit-msg: Remove MERGE_HEAD check from msg_is_merge
    
    When using "git commit --amend" to edit a merge commit message the
    MERGE_HEAD is long gone.  Also, some Git versions remove this file
    before the commit-msg hook is called.  In either case we should still
    allow long summary lines that start in 'Merge ' just as we do for
    'Revert '.

diff --git a/commit-msg b/commit-msg
index 1ca1c75..5b3a0bd 100755
--- a/commit-msg
+++ b/commit-msg
@@ -44,7 +44,6 @@ die() {
 # Check the commit message layout with a simple state machine.
 
 msg_is_merge() {
-	test -f "$GIT_DIR/MERGE_HEAD" &&
 	echo "$line" | grep "^Merge " >/dev/null 2>&1
 }
 

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0d9698a1517db0fd37a0a0b4cff2128f3d27ee71
commit 0d9698a1517db0fd37a0a0b4cff2128f3d27ee71
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Apr 4 13:48:59 2013 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Apr 4 13:48:59 2013 -0400

    Load project-specific "start" hooks before our checks
    
    Read from the project ".hooks-config" a configuration value
    
     hooks.start.commit-msg
     hooks.start.pre-commit
     hooks.start.prepare-commit-msg
    
    to run from our respective hook before its main checks.

diff --git a/commit-msg b/commit-msg
index b0006fa..1ca1c75 100755
--- a/commit-msg
+++ b/commit-msg
@@ -17,6 +17,9 @@
 
 . "${BASH_SOURCE%/*}/hooks-config.bash"
 
+# Start with project-specific hook.
+hooks_start commit-msg "$@"
+
 # Prepare a copy of the message:
 #  - strip comment lines
 #  - stop at "diff --git" (git commit -v)
diff --git a/hooks-config.bash b/hooks-config.bash
index 1da984d..afdbf9d 100644
--- a/hooks-config.bash
+++ b/hooks-config.bash
@@ -43,6 +43,12 @@ hooks_chain() {
 	hooks_child "$chain" "$@" || exit
 }
 
+hooks_start() {
+	hook="$1" ; shift
+	start="$(hooks_config --get hooks.start.$hook)"
+	hooks_child "$start" "$@" || exit
+}
+
 hooks_child() {
 	child="$1" ; shift
 	test -n "$child" || return 0
diff --git a/pre-commit b/pre-commit
index 5fe22bf..6496b45 100755
--- a/pre-commit
+++ b/pre-commit
@@ -17,6 +17,9 @@
 
 . "${BASH_SOURCE%/*}/hooks-config.bash"
 
+# Start with project-specific hook.
+hooks_start pre-commit "$@"
+
 die() {
 	echo 'pre-commit hook failure' 1>&2
 	echo '-----------------------' 1>&2
diff --git a/prepare-commit-msg b/prepare-commit-msg
index 9d33839..4de7f13 100755
--- a/prepare-commit-msg
+++ b/prepare-commit-msg
@@ -17,6 +17,9 @@
 
 . "${BASH_SOURCE%/*}/hooks-config.bash"
 
+# Start with project-specific hook.
+hooks_start prepare-commit-msg "$@"
+
 # Invoke the Gerrit Change-Id hook here for "git merge" because
 # it does not run the normal commit-msg hook.
 hooks_GerritId=$(git config --get hooks.GerritId)

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c530aa9375b3412ecba16dad053052500f828e2f
commit c530aa9375b3412ecba16dad053052500f828e2f
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Apr 4 13:42:50 2013 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Apr 4 13:45:52 2013 -0400

    hooks-config: Factor child execution out of hooks_chain
    
    Factor child execution into a separate "hooks_child" function so it can
    be re-used.

diff --git a/hooks-config.bash b/hooks-config.bash
index 91fb28c..1da984d 100644
--- a/hooks-config.bash
+++ b/hooks-config.bash
@@ -40,15 +40,20 @@ hooks_chain() {
 	chain=$(git config --get hooks.chain-$hook) ||
 	chain="$(hooks_config --get hooks.chain.$hook)" ||
 	eval chain="\${hooks_chain_${hook//-/_}}"
-	test -n "$chain" || return 0
-	case "$chain" in
+	hooks_child "$chain" "$@" || exit
+}
+
+hooks_child() {
+	child="$1" ; shift
+	test -n "$child" || return 0
+	case "$child" in
 	'/'*) prefix="" ;;
 	'[A-Za-z]:/'*) prefix="" ;;
 	'.'*) prefix="" ;;
 	*) prefix="./" ;;
 	esac
-	if test -x "$prefix$chain" ; then
-		exec "$prefix$chain" "$@"
+	if test -x "$prefix$child" ; then
+		"$prefix$child" "$@"
 	fi
 }
 

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e684969995e937e47cf60a3577dd47d361db7c5b
commit e684969995e937e47cf60a3577dd47d361db7c5b
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Apr 4 13:26:03 2013 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Apr 4 13:32:52 2013 -0400

    hooks-config: Read 'git config' values from project .hooks-config
    
    Allow projects to configure hooks with a 'git config'-formatted file at
    the top of their source tree called ".hooks-config".  This avoids use of
    bash-specific syntax and makes configuration declarative.

diff --git a/hooks-config.bash b/hooks-config.bash
index c857c8e..91fb28c 100644
--- a/hooks-config.bash
+++ b/hooks-config.bash
@@ -20,6 +20,16 @@ if test -z "$GIT_DIR"; then
 fi
 
 # Load hooks configuration from source tree.
+hooks_config=".hooks-config"
+if test -r "$hooks_config"; then
+	hooks_config() {
+		git config -f "$hooks_config" "$@"
+	}
+else
+	hooks_config() {
+		false
+	}
+fi
 config=".hooks-config.bash" && test -r "$config" && . "$config"
 
 # Set up the location for "this" set of hooks.
@@ -28,6 +38,7 @@ HOOKS_DIR="${BASH_SOURCE%/*}"
 hooks_chain() {
 	hook="$1" ; shift
 	chain=$(git config --get hooks.chain-$hook) ||
+	chain="$(hooks_config --get hooks.chain.$hook)" ||
 	eval chain="\${hooks_chain_${hook//-/_}}"
 	test -n "$chain" || return 0
 	case "$chain" in

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2d9ee2a97cb41c505692d39aa172ed074c98c48e
commit 2d9ee2a97cb41c505692d39aa172ed074c98c48e
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Apr 4 13:12:19 2013 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Apr 4 13:26:20 2013 -0400

    hooks-config: Subsume hooks-chain functionality
    
    Remove hooks-chain.bash and place its content in hooks-config.bash.

diff --git a/commit-msg b/commit-msg
index 238407f..b0006fa 100755
--- a/commit-msg
+++ b/commit-msg
@@ -145,5 +145,4 @@ esac
 
 #-----------------------------------------------------------------------------
 # Chain to project-specific hook.
-. "$HOOKS_DIR/hooks-chain.bash"
 hooks_chain commit-msg "$@"
diff --git a/hooks-chain.bash b/hooks-chain.bash
deleted file mode 100644
index 7aca6ce..0000000
--- a/hooks-chain.bash
+++ /dev/null
@@ -1,33 +0,0 @@
-#=============================================================================
-# Copyright 2010-2011 Kitware, Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#=============================================================================
-
-hooks_chain() {
-	hook="$1" ; shift
-	chain=$(git config --get hooks.chain-$hook) ||
-	eval chain="\${hooks_chain_${hook//-/_}}"
-	test -n "$chain" || return 0
-	case "$chain" in
-	'/'*) prefix="" ;;
-	'[A-Za-z]:/'*) prefix="" ;;
-	'.'*) prefix="" ;;
-	*) prefix="./" ;;
-	esac
-	if test -x "$prefix$chain" ; then
-		exec "$prefix$chain" "$@"
-	fi
-}
-
-# vim: set filetype=sh tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab :
diff --git a/hooks-config.bash b/hooks-config.bash
index adc35fd..c857c8e 100644
--- a/hooks-config.bash
+++ b/hooks-config.bash
@@ -25,4 +25,20 @@ config=".hooks-config.bash" && test -r "$config" && . "$config"
 # Set up the location for "this" set of hooks.
 HOOKS_DIR="${BASH_SOURCE%/*}"
 
+hooks_chain() {
+	hook="$1" ; shift
+	chain=$(git config --get hooks.chain-$hook) ||
+	eval chain="\${hooks_chain_${hook//-/_}}"
+	test -n "$chain" || return 0
+	case "$chain" in
+	'/'*) prefix="" ;;
+	'[A-Za-z]:/'*) prefix="" ;;
+	'.'*) prefix="" ;;
+	*) prefix="./" ;;
+	esac
+	if test -x "$prefix$chain" ; then
+		exec "$prefix$chain" "$@"
+	fi
+}
+
 # vim: set filetype=sh tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab :
diff --git a/pre-commit b/pre-commit
index 9d75634..5fe22bf 100755
--- a/pre-commit
+++ b/pre-commit
@@ -322,7 +322,6 @@ test -z "$bad" || die "$bad"
 
 #-----------------------------------------------------------------------------
 # Chain to project-specific hook.
-. "$HOOKS_DIR/hooks-chain.bash"
 hooks_chain pre-commit "$@"
 
 # vim: set filetype=sh tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab :
diff --git a/prepare-commit-msg b/prepare-commit-msg
index a5d4592..9d33839 100755
--- a/prepare-commit-msg
+++ b/prepare-commit-msg
@@ -27,5 +27,4 @@ esac
 
 #-----------------------------------------------------------------------------
 # Chain to project-specific hook.
-. "$HOOKS_DIR/hooks-chain.bash"
 hooks_chain prepare-commit-msg "$@"

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=646b891d70dc244bebd0a5738626168292a16f6f
commit 646b891d70dc244bebd0a5738626168292a16f6f
Author:     Chuck Atkins <chuck.atkins at kitware.com>
AuthorDate: Wed Oct 10 10:53:23 2012 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Oct 10 13:12:18 2012 -0400

    Make all hook references relative to thier location
    
    Some hooks were getting referenced directly via $GIT_DIR/hooks while at
    other times getting referenced relative via ${BASH_SOURCE%/*}.  By making
    all references relative then these hooks can reside in a different folder
    and still be daisy-chained by other hooks.

diff --git a/commit-msg b/commit-msg
index 8570266..238407f 100755
--- a/commit-msg
+++ b/commit-msg
@@ -131,7 +131,7 @@ gerrit_error() {
 }
 
 gerrit_hook() {
-	"$GIT_DIR/hooks/gerrit/commit-msg" "$@" ||
+	"$HOOKS_DIR/gerrit/commit-msg" "$@" ||
 	die 'gerrit/commit-msg failed'
 }
 
@@ -145,5 +145,5 @@ esac
 
 #-----------------------------------------------------------------------------
 # Chain to project-specific hook.
-. "$GIT_DIR/hooks/hooks-chain.bash"
+. "$HOOKS_DIR/hooks-chain.bash"
 hooks_chain commit-msg "$@"
diff --git a/hooks-config.bash b/hooks-config.bash
index a12ad96..adc35fd 100644
--- a/hooks-config.bash
+++ b/hooks-config.bash
@@ -22,4 +22,7 @@ fi
 # Load hooks configuration from source tree.
 config=".hooks-config.bash" && test -r "$config" && . "$config"
 
+# Set up the location for "this" set of hooks.
+HOOKS_DIR="${BASH_SOURCE%/*}"
+
 # vim: set filetype=sh tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab :
diff --git a/pre-commit b/pre-commit
index 834c3fe..9d75634 100755
--- a/pre-commit
+++ b/pre-commit
@@ -322,7 +322,7 @@ test -z "$bad" || die "$bad"
 
 #-----------------------------------------------------------------------------
 # Chain to project-specific hook.
-. "$GIT_DIR/hooks/hooks-chain.bash"
+. "$HOOKS_DIR/hooks-chain.bash"
 hooks_chain pre-commit "$@"
 
 # vim: set filetype=sh tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab :
diff --git a/prepare-commit-msg b/prepare-commit-msg
index 035677f..a5d4592 100755
--- a/prepare-commit-msg
+++ b/prepare-commit-msg
@@ -21,11 +21,11 @@
 # it does not run the normal commit-msg hook.
 hooks_GerritId=$(git config --get hooks.GerritId)
 case "$hooks_GerritId,$2,$3" in
-	true,merge,) "$GIT_DIR/hooks/gerrit/commit-msg" "$1" ;;
+	true,merge,) "$HOOKS_DIR/gerrit/commit-msg" "$1" ;;
 	*) ;;
 esac
 
 #-----------------------------------------------------------------------------
 # Chain to project-specific hook.
-. "$GIT_DIR/hooks/hooks-chain.bash"
+. "$HOOKS_DIR/hooks-chain.bash"
 hooks_chain prepare-commit-msg "$@"

-----------------------------------------------------------------------

Summary of changes:
 commit-msg         |    7 ++++---
 hooks-chain.bash   |   33 ---------------------------------
 hooks-config.bash  |   41 +++++++++++++++++++++++++++++++++++++++++
 pre-commit         |    4 +++-
 prepare-commit-msg |    6 ++++--
 5 files changed, 52 insertions(+), 39 deletions(-)
 delete mode 100644 hooks-chain.bash


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list