File tree Expand file tree Collapse file tree 3 files changed +6
-17
lines changed Expand file tree Collapse file tree 3 files changed +6
-17
lines changed Original file line number Diff line number Diff line change @@ -1959,7 +1959,8 @@ sub validate_patch {
19591959 my ($fn , $xfer_encoding ) = @_ ;
19601960
19611961 if ($repo ) {
1962- my $validate_hook = catfile($repo -> hooks_path(),
1962+ my $hooks_path = $repo -> command_oneline(' rev-parse' , ' --git-path' , ' hooks' );
1963+ my $validate_hook = catfile($hooks_path ,
19631964 ' sendemail-validate' );
19641965 my $hook_error ;
19651966 if (-x $validate_hook ) {
Original file line number Diff line number Diff line change @@ -619,19 +619,6 @@ Return path to the git repository. Must be called on a repository instance.
619619
620620sub 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- my $abs = abs_path($dir );
633- return $abs ;
634- }
635622
636623=item wc_path ()
637624
Original file line number Diff line number Diff line change @@ -539,14 +539,15 @@ test_expect_success $PREREQ "--validate respects relative core.hooksPath path" '
539539 test_path_is_file my-hooks.ran &&
540540 cat >expect <<-EOF &&
541541 fatal: longline.patch: rejected by sendemail-validate hook
542- fatal: command ' " '" ' $PWD/ my-hooks/sendemail-validate' " '" ' died with exit code 1
542+ fatal: command ' " '" ' my-hooks/sendemail-validate' " '" ' died with exit code 1
543543 warning: no patches were sent
544544 EOF
545545 test_cmp expect actual
546546'
547547
548548test_expect_success $PREREQ " --validate respects absolute core.hooksPath path" '
549- test_config core.hooksPath "$(pwd)/my-hooks" &&
549+ hooks_path="$(pwd)/my-hooks" &&
550+ test_config core.hooksPath "$hooks_path" &&
550551 test_when_finished "rm my-hooks.ran" &&
551552 test_must_fail git send-email \
552553 --from="Example <[email protected] >" \ @@ -557,7 +558,7 @@ test_expect_success $PREREQ "--validate respects absolute core.hooksPath path" '
557558 test_path_is_file my-hooks.ran &&
558559 cat >expect <<-EOF &&
559560 fatal: longline.patch: rejected by sendemail-validate hook
560- fatal: command ' " '" ' $PWD/my-hooks /sendemail-validate' " '" ' died with exit code 1
561+ fatal: command ' " '" ' $hooks_path /sendemail-validate' " '" ' died with exit code 1
561562 warning: no patches were sent
562563 EOF
563564 test_cmp expect actual
You can’t perform that action at this time.
0 commit comments