Commit f635fab3 authored by Brad King's avatar Brad King
Browse files

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).
parent 5d416608
......@@ -56,6 +56,9 @@ else
# 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
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment