Install commit hook into submodules
If there are submodules, the commit hook should be installed into them, according to https://gerrit-review.googlesource.com/Documentation/dev-crafting-changes.html#git-commit-settings git submodule foreach is a no-op if there are no submodules, so just run it directly. Change-Id: I559e2786c84be9975cc082bce80b32c8e47a9fb5
This commit is contained in:
parent
dba41b2532
commit
f9340df184
@ -352,6 +352,12 @@ def set_hooks_commit_msg(remote, target_file):
|
||||
% (userhost, (":%s" % port) if port else "")
|
||||
print("Fetching commit hook from: %s" % hook_url)
|
||||
run_command_exc(CannotInstallHook, *cmd)
|
||||
# If there are submodules, the hook needs to be installed into
|
||||
# each of them.
|
||||
run_command_exc(
|
||||
CannotInstallHook,
|
||||
"git", "submodule", "foreach",
|
||||
'cp -p %s "$(git rev-parse --git-dir)/hooks/"' % target_file)
|
||||
|
||||
if not os.access(target_file, os.X_OK):
|
||||
os.chmod(target_file, os.path.stat.S_IREAD | os.path.stat.S_IEXEC)
|
||||
|
Loading…
x
Reference in New Issue
Block a user