diff options
-rwxr-xr-x | script/git-hooks/pre-commit-hook | 17 | ||||
-rwxr-xr-x | script/git-hooks/pre-commit-script | 17 | ||||
-rw-r--r-- | wscript | 9 |
3 files changed, 42 insertions, 1 deletions
diff --git a/script/git-hooks/pre-commit-hook b/script/git-hooks/pre-commit-hook new file mode 100755 index 00000000000..3f51254c2cf --- /dev/null +++ b/script/git-hooks/pre-commit-hook @@ -0,0 +1,17 @@ +#!/bin/sh + +set -eu + +gitdir=$(git rev-parse --show-toplevel) +if [ $? -ne 0 ] ; then + echo "git rev-parse --show-toplevel failed" + exit 1 +fi + +if [ ! -f ${gitdir}/script/git-hooks/pre-commit-script ] ; then + exit 0 +fi + +${gitdir}/script/git-hooks/pre-commit-script || exit $? + +exit 0 diff --git a/script/git-hooks/pre-commit-script b/script/git-hooks/pre-commit-script new file mode 100755 index 00000000000..22ebecec970 --- /dev/null +++ b/script/git-hooks/pre-commit-script @@ -0,0 +1,17 @@ +#!/bin/sh + +set -eu + +# +# make emacs/magit work, cf +# https://github.com/magit/magit/issues/3419 +# +unset GIT_LITERAL_PATHSPECS + +gitdir=$(git rev-parse --show-toplevel) +if [ $? -ne 0 ] ; then + echo "git rev-parse --show-toplevel failed" + exit 1 +fi + +exit 0 @@ -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') |