Skip to content
Snippets Groups Projects
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
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment