summaryrefslogtreecommitdiff
path: root/wscript
diff options
context:
space:
mode:
authorRalph Boehme <slow at samba.org>2018-04-10 13:04:27 +0200
committerJeremy Allison <jra@samba.org>2018-04-26 01:09:27 +0200
commit8649e216650de85cd73eda64caa2e338d59582d5 (patch)
tree65a7ec5a85a2caafc4ce453682f21a10f40e31da /wscript
parenta6fade4e10760284ef56abf45d3fa70038091cbe (diff)
downloadsamba-8649e216650de85cd73eda64caa2e338d59582d5.tar.gz
Add a wrapper script as git pre-commit hook
When developer mode is enabled, the wrapper script "script/git-hooks/pre-commit-hook" gets installed as .git/hooks/pre-commit and calls "script/git-hooks/pre-commit-script". This way we can later modify the "script/git-hooks/pre-commit-script" without the need to ever change the installed commit hook itself. Signed-off-by: Ralph Boehme <slow at samba.org> Reviewed-by: Martin Schwenke <martin at meltin.net> Reviewed-by: Jeremy Allison <jra at samba.org>
Diffstat (limited to 'wscript')
-rw-r--r--wscript9
1 files changed, 8 insertions, 1 deletions
diff --git a/wscript b/wscript
index b45146c31b2..dbfc1210f7f 100644
--- a/wscript
+++ b/wscript
@@ -10,7 +10,7 @@ import sys, os, tempfile
sys.path.insert(0, srcdir+"/buildtools/wafsamba")
import wafsamba, Options, samba_dist, samba_git, Scripting, Utils, samba_version
import Logs, samba_utils
-
+import shutil
samba_dist.DIST_DIRS('.')
samba_dist.DIST_BLACKLIST('.gitignore .bzrignore source4/selftest/provisions')
@@ -106,6 +106,13 @@ def configure(conf):
if Options.options.developer:
conf.ADD_CFLAGS('-DDEVELOPER -DDEBUG_PASSWORD')
conf.env.DEVELOPER = True
+ # if we are in a git tree without a pre-commit hook, install a
+ # simple default.
+ pre_commit_hook = os.path.join(srcdir, '.git/hooks/pre-commit')
+ if (os.path.isdir(os.path.dirname(pre_commit_hook)) and
+ not os.path.exists(pre_commit_hook)):
+ shutil.copy(os.path.join(srcdir, 'script/git-hooks/pre-commit-hook'),
+ pre_commit_hook)
conf.ADD_EXTRA_INCLUDES('#include/public #source4 #lib #source4/lib #source4/include #include #lib/replace')