From c8243933c74e0bebcc617f750ae3990ecca47759 Mon Sep 17 00:00:00 2001 From: Robert Foss Date: Tue, 23 Mar 2021 18:33:27 +0100 Subject: git-send-email: Respect core.hooksPath setting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 867ad08a261 (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 Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano --- perl/Git.pm | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'perl') diff --git a/perl/Git.pm b/perl/Git.pm index 02eacef0c2..73ebbf80cc 100644 --- a/perl/Git.pm +++ b/perl/Git.pm @@ -619,6 +619,19 @@ Return path to the git repository. Must be called on a repository instance. sub repo_path { $_[0]->{opts}->{Repository} } +=item hooks_path () + +Return path to the hooks directory. Must be called on a repository instance. + +=cut + +sub hooks_path { + my ($self) = @_; + + my $dir = $self->command_oneline('rev-parse', '--git-path', 'hooks'); + my $abs = abs_path($dir); + return $abs; +} =item wc_path () -- cgit v1.2.3