The branch, v4-15-test has been updated via eb8518e4fb8 wscript: fix installing pre-commit with 'git worktree' via f9ed3a8cb95 script/bisect-test.py: add support git worktree via 24c95d2523f wafsamba: add support git worktree to vcs_dir_contents() from f834da87269 VERSION: Bump version up to Samba 4.15.0rc3...
https://git.samba.org/?p=samba.git;a=shortlog;h=v4-15-test - Log ----------------------------------------------------------------- commit eb8518e4fb828337a331779fbac14a25b0761d45 Author: Stefan Metzmacher <me...@samba.org> Date: Wed Aug 11 13:26:41 2021 +0200 wscript: fix installing pre-commit with 'git worktree' .git is not always a directory, with 'git worktree' it's a file. 'git rev-parse --git-path hooks' is the generic way to find the patch for the githooks. Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Andreas Schneider <a...@samba.org> Autobuild-User(master): Stefan Metzmacher <me...@samba.org> Autobuild-Date(master): Thu Aug 12 08:56:13 UTC 2021 on sn-devel-184 (cherry picked from commit 8858cf72af1cc15784749e58f184559a839dd4ef) Autobuild-User(v4-15-test): Stefan Metzmacher <me...@samba.org> Autobuild-Date(v4-15-test): Thu Aug 12 12:03:18 UTC 2021 on sn-devel-184 commit f9ed3a8cb95551bb30a1f8ecf4030a3f701176c7 Author: Stefan Metzmacher <me...@samba.org> Date: Wed Aug 11 13:26:41 2021 +0200 script/bisect-test.py: add support git worktree .git is not always a directory, with 'git worktree' it's a file. Note we could also use 'git rev-parse --show-toplevel', but that's a patch for another day. Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Andreas Schneider <a...@samba.org> (cherry picked from commit c7f85146cb50795afcbb1c607e87d163d241c79a) commit 24c95d2523fd686025bcb7cab88ee2335fab2241 Author: Stefan Metzmacher <me...@samba.org> Date: Wed Aug 11 13:26:41 2021 +0200 wafsamba: add support git worktree to vcs_dir_contents() .git is not always a directory, with 'git worktree' it's a file. Note we could also use 'git rev-parse --show-toplevel', but that's a patch for another day. Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Andreas Schneider <a...@samba.org> (cherry picked from commit 2e2d2eaa10499537c9af07dd866ac8e613c3da02) ----------------------------------------------------------------------- Summary of changes: buildtools/wafsamba/samba_dist.py | 2 +- script/bisect-test.py | 2 +- wscript | 20 +++++++++++++++----- 3 files changed, 17 insertions(+), 7 deletions(-) Changeset truncated at 500 lines: diff --git a/buildtools/wafsamba/samba_dist.py b/buildtools/wafsamba/samba_dist.py index c211a94d3db..0218cad6271 100644 --- a/buildtools/wafsamba/samba_dist.py +++ b/buildtools/wafsamba/samba_dist.py @@ -109,7 +109,7 @@ def vcs_dir_contents(path): """ repo = path while repo != "/": - if os.path.isdir(os.path.join(repo, ".git")): + if os.path.exists(os.path.join(repo, ".git")): ls_files_cmd = [ 'git', 'ls-files', '--full-name', os.path.relpath(path, repo) ] cwd = None diff --git a/script/bisect-test.py b/script/bisect-test.py index b87df54ac09..7c5cd635f58 100755 --- a/script/bisect-test.py +++ b/script/bisect-test.py @@ -48,7 +48,7 @@ def find_git_root(): '''get to the top of the git repo''' p = os.getcwd() while p != '/': - if os.path.isdir(os.path.join(p, ".git")): + if os.path.exists(os.path.join(p, ".git")): return p p = os.path.abspath(os.path.join(p, '..')) return None diff --git a/wscript b/wscript index ee7daa953b2..d8220b35095 100644 --- a/wscript +++ b/wscript @@ -141,11 +141,21 @@ def configure(conf): 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(Context.g_module.top, '.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(Context.g_module.top, 'script/git-hooks/pre-commit-hook'), - pre_commit_hook) + # we need git for 'waf dist' + githooksdir = None + conf.find_program('git', var='GIT') + if 'GIT' in conf.env: + githooksdir = conf.CHECK_COMMAND('%s rev-parse --git-path hooks' % conf.env.GIT[0], + msg='Finding githooks directory', + define=None, + on_target=False) + if githooksdir and os.path.isdir(githooksdir): + pre_commit_hook = os.path.join(githooksdir, 'pre-commit') + if not os.path.exists(pre_commit_hook): + Logs.info("Installing script/git-hooks/pre-commit-hook as %s" % + pre_commit_hook) + shutil.copy(os.path.join(Context.g_module.top, 'script/git-hooks/pre-commit-hook'), + pre_commit_hook) conf.ADD_EXTRA_INCLUDES('#include/public #source4 #lib #source4/lib #source4/include #include #lib/replace') -- Samba Shared Repository