Skip to content
Snippets Groups Projects
Commit bfba7121 authored by Amin Bandali's avatar Amin Bandali
Browse files

build: Make sure the 'hooks' directory for each submodule exists

git-init may not create the hooks directory with the default sample
hooks in some scenarios, for example if the user has set the
init.templateDir configuration option in their global git config, and
if that directory does not include a hooks subdirectory then no hooks
directory will be created by git-init, including for clones and
submodule initializations.

Change-Id: I09ce586fd36d3db9224bbbeed5d7721d6635ea7b
parent 8618a0f5
Branches
Tags
No related merge requests found
...@@ -392,15 +392,18 @@ def run_init(): ...@@ -392,15 +392,18 @@ def run_init():
subprocess.run(["git", "submodule", "update", "--init"], check=True) subprocess.run(["git", "submodule", "update", "--init"], check=True)
subprocess.run(["git", "submodule", "foreach", subprocess.run(["git", "submodule", "foreach",
"git checkout master && git pull"], check=True) "git checkout master && git pull"], check=True)
for name in module_names: for name in module_names:
copy_file("./scripts/commit-msg", ".git/modules/"+name+"/hooks") hooks_dir = ".git/modules/" + name + "/hooks"
if not os.path.exists(hooks_dir):
os.makedirs(hooks_dir)
copy_file("./scripts/commit-msg", hooks_dir + "/commit-msg")
module_names_to_format = ['daemon', 'client-qt', 'plugins'] module_names_to_format = ['daemon', 'client-qt', 'plugins']
for name in module_names_to_format: for name in module_names_to_format:
execute_script( hooks_dir = ".git/modules/" + name + "/hooks"
['./scripts/format.sh --install %(path)s'], execute_script(['./scripts/format.sh --install %(path)s'],
{"path": ".git/modules/" + name + "/hooks"} {"path": hooks_dir})
)
def copy_file(src, dest): def copy_file(src, dest):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment