]> git.ipfire.org Git - thirdparty/git.git/commitdiff
send-email: move "hooks_path" invocation to git-send-email.perl
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Wed, 26 May 2021 11:21:07 +0000 (13:21 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 27 May 2021 00:00:59 +0000 (09:00 +0900)
Move the newly added "hooks_path" API in Git.pm to its only user in
git-send-email.perl. This was added in c8243933c74 (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 <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-send-email.perl
perl/Git.pm

index 175da07d9469d14584050f3fe5706b5e7db0ec0b..a454020f0174f7bf881aebaab1d848cada54a28d 100755 (executable)
@@ -1949,7 +1949,8 @@ sub validate_patch {
        my ($fn, $xfer_encoding) = @_;
 
        if ($repo) {
-               my $validate_hook = catfile($repo->hooks_path(),
+               my $hooks_path = $repo->command_oneline('rev-parse', '--git-path', 'hooks');
+               my $validate_hook = catfile($hooks_path,
                                            'sendemail-validate');
                my $hook_error;
                if (-x $validate_hook) {
index df6280ebab58ec7e36702a85cdc935ac3c3d9bac..02eacef0c2a4a43058a74dda4cebe1ae16bdd2eb 100644 (file)
@@ -619,18 +619,6 @@ 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');
-       return $dir;
-}
 
 =item wc_path ()