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  bc6d41f4d2c9b0c4645aaf6be4d92429bf52fab6 (commit)
       via  f635fab3cc88bbba7fc4b58e8def08a630346237 (commit)
      from  5d4166083669297e2930ad6d23150e17edcb4eac (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=bc6d41f4d2c9b0c4645aaf6be4d92429bf52fab6
commit bc6d41f4d2c9b0c4645aaf6be4d92429bf52fab6
Author:     Brad King <brad.k...@kitware.com>
AuthorDate: Wed Jan 26 13:56:06 2011 -0500
Commit:     Brad King <brad.k...@kitware.com>
CommitDate: Wed Jan 26 13:56:06 2011 -0500

    pre-commit: Disallow submodule rewind
    
    Reject commits that rewind a submodule relative to any parent (HEAD or
    MERGE_HEAD).

diff --git a/pre-commit b/pre-commit
index 3b90108..f46cf5d 100755
--- a/pre-commit
+++ b/pre-commit
@@ -249,6 +249,31 @@ to checkout the current version of the submodule in your 
work tree.
 Test your changes again to see if they still work with the module.
 Finally, try the commit again.
 '
+       return 1
+}
+
+check_module_rewind() {
+       parent_name="$1"
+       parent_commit="$2"
+       base=$(GIT_DIR="$file/.git" \
+              git merge-base $src_obj $dst_obj 2>/dev/null) || base=''
+       test "$base" != "$dst_obj" && return
+       parent_short=$(short_commit "$parent_commit")
+       src_short=$(GIT_DIR="$file/.git" short_commit "$src_obj")
+       dst_short=$(GIT_DIR="$file/.git" short_commit "$dst_obj")
+       echo 'This commit would rewind a submodule link:
+
+  "'"$file"'"  '"$src_short => $dst_short"'
+
+from the newer version in '"$parent_name"' ('"$parent_short"').  Run
+
+  git reset '"$parent_name"' -- "'"$file"'"
+  git submodule update -- "'"$file"'"
+
+to checkout the newer version of the submodule in your work tree.
+Then try the commit again.
+'
+       return 1
 }
 
 diffs=$(git diff-index --cached $against -- |
@@ -267,7 +292,28 @@ while read src_mode dst_mode src_obj dst_obj status file; 
do
 done
 test -n "$diffs_module" && echo "$diffs_module" |
 while read src_mode dst_mode src_obj dst_obj status file; do
-       check_module
+       check_module_rewind HEAD "$against" &&
+       check_module ||
+       break
+done
+)
+test -z "$bad" || die "$bad"
+
+#-----------------------------------------------------------------------------
+# Merge checks.
+if test -n "$merge_head"; then
+       merge_diffs=$(git diff-index --cached $merge_head -- |
+                     sed -n '/^:[^:]/ {s/^://;p;}')
+else
+       merge_diffs=''
+fi
+merge_diffs_normal=$(echo "$merge_diffs" | grep -v '^...... 160000')
+merge_diffs_module=$(echo "$merge_diffs" | grep    '^...... 160000')
+bad=$(
+test -n "$merge_diffs_module" && echo "$merge_diffs_module" |
+while read src_mode dst_mode src_obj dst_obj status file; do
+       check_module_rewind MERGE_HEAD "$merge_head" ||
+       break
 done
 )
 test -z "$bad" || die "$bad"

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f635fab3cc88bbba7fc4b58e8def08a630346237
commit f635fab3cc88bbba7fc4b58e8def08a630346237
Author:     Brad King <brad.k...@kitware.com>
AuthorDate: Wed Jan 26 13:47:38 2011 -0500
Commit:     Brad King <brad.k...@kitware.com>
CommitDate: Wed Jan 26 13:47:38 2011 -0500

    pre-commit: Allow merged submodule updates
    
    If "git merge" brings in a submodule update then allow it without
    requiring the extra step added in commit 48e72dd1 (Check submodules
    staged with other changes, 2010-08-10).

diff --git a/pre-commit b/pre-commit
index d6aedb2..3b90108 100755
--- a/pre-commit
+++ b/pre-commit
@@ -56,6 +56,9 @@ else
        against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
 fi
 
+# Merge ("git commit" after "git merge" with conflicts or --no-commit)
+merge_head=$(git rev-parse -q --verify MERGE_HEAD) || merge_head=''
+
 # Disallow non-ascii file names.  The printable range starts at the
 # space character and ends with tilde.
 if test "$(git diff --cached --name-only --diff-filter=A -z $against |
@@ -209,6 +212,11 @@ check_module() {
        enabled=$(git config --get --bool hooks.submodule) || enabled=true
        test "$enabled" = "false" && return
 
+       # Allow merged submodule updates.
+       test -n "$merge_head" &&
+       merge_obj=$(git rev-parse -q --verify "$merge_head:$file") &&
+       test "$merge_obj" = "$dst_obj" && return
+
        # Allow module-only commits without extra work.
        test -z "$diffs_normal" && return
 

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

Summary of changes:
 pre-commit |   56 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 55 insertions(+), 1 deletions(-)


hooks/post-receive
-- 
CMake
_______________________________________________
Cmake-commits mailing list
Cmake-commits@cmake.org
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-commits

Reply via email to