Skip to content

Commit 7cbc045

Browse files
avargitster
authored andcommitted
send-email: move "hooks_path" invocation to git-send-email.perl
Move the newly added "hooks_path" API in Git.pm to its only user in git-send-email.perl. This was added in c824393 (git-send-email: Respect core.hooksPath setting, 2021-03-23), meaning that it hasn't yet made it into a non-rc release of git. The consensus with Git.pm is that we need to be considerate of out-of-tree users who treat it as a public documented interface. We should therefore be less willing to add new functionality to it, least we be stuck supporting it after our own uses for it disappear. In this case the git-send-email.perl hook invocation will probably be replaced by a future "git hook run" command, and in the commit preceding this one the "hooks_path" become nothing but a trivial wrapper for "rev-parse --git-path hooks" anyway (with no Cwd::abs_path() call), so let's just inline this command in git-send-email.perl itself. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2815326 commit 7cbc045

File tree

2 files changed

+2
-13
lines changed

2 files changed

+2
-13
lines changed

git-send-email.perl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1949,7 +1949,8 @@ sub validate_patch {
19491949
my ($fn, $xfer_encoding) = @_;
19501950

19511951
if ($repo) {
1952-
my $validate_hook = catfile($repo->hooks_path(),
1952+
my $hooks_path = $repo->command_oneline('rev-parse', '--git-path', 'hooks');
1953+
my $validate_hook = catfile($hooks_path,
19531954
'sendemail-validate');
19541955
my $hook_error;
19551956
if (-x $validate_hook) {

perl/Git.pm

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -619,18 +619,6 @@ Return path to the git repository. Must be called on a repository instance.
619619

620620
sub repo_path { $_[0]->{opts}->{Repository} }
621621

622-
=item hooks_path ()
623-
624-
Return path to the hooks directory. Must be called on a repository instance.
625-
626-
=cut
627-
628-
sub hooks_path {
629-
my ($self) = @_;
630-
631-
my $dir = $self->command_oneline('rev-parse', '--git-path', 'hooks');
632-
return $dir;
633-
}
634622

635623
=item wc_path ()
636624

0 commit comments

Comments
 (0)