git-send-email: Respect core.hooksPath setting

get-send-email currently makes the assumption that the
'sendemail-validate' hook exists inside of the repository.

Since the introduction of 'core.hooksPath' configuration option in
867ad08a26 (hooks: allow customizing where the hook directory is,
2016-05-04), this is no longer true.

Instead of assuming a hardcoded repo relative path, query
git for the actual path of the hooks directory.

Signed-off-by: Robert Foss <robert.foss@linaro.org>
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Robert Foss
2021-03-23 18:33:27 +01:00
committed by Junio C Hamano
parent 1424303384
commit c8243933c7
3 changed files with 46 additions and 1 deletions

View File

@@ -1942,7 +1942,7 @@ sub validate_patch {
my ($fn, $xfer_encoding) = @_;
if ($repo) {
my $validate_hook = catfile(catdir($repo->repo_path(), 'hooks'),
my $validate_hook = catfile($repo->hooks_path(),
'sendemail-validate');
my $hook_error;
if (-x $validate_hook) {