Set up commit hook only if master project

If someone is building Pistache from source as a subproject they are not
going to commit any changes from there, and setting up the pre-commit
hook is pointless.
It is now also optional, since git is not stictly needed to build the
library, and if you don't have git installed you are probably not going
to commit.
parent 91510e35
......@@ -107,4 +107,9 @@ if get_option('PISTACHE_BUILD_DOCS')
subdir('docs')
endif
run_command('git', 'config', '--local', 'core.hooksPath', '.hooks')
\ No newline at end of file
if not meson.is_subproject()
git = find_program('git', required: false)
if git.found()
run_command(git, 'config', '--local', 'core.hooksPath', meson.source_root()/'.hooks')
endif
endif
Markdown is supported
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