diff options
author | Maxime Dénès <mail@maximedenes.fr> | 2018-02-21 18:54:46 +0100 |
---|---|---|
committer | Maxime Dénès <mail@maximedenes.fr> | 2018-02-21 18:54:46 +0100 |
commit | 2f13806f10b2781f84417014c8018097c8e8b2ad (patch) | |
tree | bda1e7175976e5f695f058e967cc3a2b60456745 /configure.ml | |
parent | 8669a9449a11cc2e5ddeeba5b0ddc44c7a978d44 (diff) | |
parent | aab9a48b16ffbc6b697da39d314298b692447b72 (diff) |
Merge PR #6283: A pre-commit hook to magically fix whitespace issues.
Diffstat (limited to 'configure.ml')
-rw-r--r-- | configure.ml | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/configure.ml b/configure.ml index 9992e03b8..69db9407a 100644 --- a/configure.ml +++ b/configure.ml @@ -451,6 +451,22 @@ let vcs = else if dir_exists "{arch}" then "gnuarch" else "none" +(** * Git Precommit Hook *) +let _ = + let f = ".git/hooks/pre-commit" in + if vcs = "git" && dir_exists ".git/hooks" && not (Sys.file_exists f) then begin + printf "Creating pre-commit hook in %s\n" f; + let o = open_out f in + let pr s = fprintf o s in + pr "#!/bin/sh\n"; + pr "\n"; + pr "if [ -x dev/tools/pre-commit ]; then\n"; + pr " exec dev/tools/pre-commit\n"; + pr "fi\n"; + close_out o; + Unix.chmod f 0o775 + end + (** * Browser command *) let browser = |