git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH v1] git-send-email: Respect core.hooksPath setting
@ 2021-03-22 16:20 Robert Foss
  2021-03-22 16:46 ` Ævar Arnfjörð Bjarmason
  0 siblings, 1 reply; 3+ messages in thread
From: Robert Foss @ 2021-03-22 16:20 UTC (permalink / raw)
  To: Junio C Hamano, git
  Cc: Drew DeVault, Rafael Aquini, Marcelo Arenas Belón,
	Robert Foss

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
v2.9, 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>
---


This patch does not include a test for this bug fix.
This is entirely due to me not being able to think up a way
to test this. So I'm very much open to suggestions.


 git-send-email.perl | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 1f425c0809..3934dceb70 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1942,8 +1942,9 @@ sub validate_patch {
 	my ($fn, $xfer_encoding) = @_;
 
 	if ($repo) {
-		my $validate_hook = catfile(catdir($repo->repo_path(), 'hooks'),
-					    'sendemail-validate');
+		my $hook_path = $repo->command('rev-parse', '--git-path', 'hooks');
+		chomp($hook_path);
+		my $validate_hook = catfile($hook_path, 'sendemail-validate');
 		my $hook_error;
 		if (-x $validate_hook) {
 			my $target = abs_path($fn);
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-03-22 21:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-22 16:20 [PATCH v1] git-send-email: Respect core.hooksPath setting Robert Foss
2021-03-22 16:46 ` Ævar Arnfjörð Bjarmason
2021-03-22 21:13   ` Robert Foss

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).