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 {
1959
1959
my ($fn , $xfer_encoding ) = @_ ;
1960
1960
1961
1961
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 ,
1963
1964
' sendemail-validate' );
1964
1965
my $hook_error ;
1965
1966
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.
619
619
620
620
sub repo_path { $_ [0]-> {opts }-> {Repository } }
621
621
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
- }
635
622
636
623
=item wc_path ()
637
624
Original file line number Diff line number Diff line change @@ -539,14 +539,15 @@ test_expect_success $PREREQ "--validate respects relative core.hooksPath path" '
539
539
test_path_is_file my-hooks.ran &&
540
540
cat >expect <<-EOF &&
541
541
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
543
543
warning: no patches were sent
544
544
EOF
545
545
test_cmp expect actual
546
546
'
547
547
548
548
test_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" &&
550
551
test_when_finished "rm my-hooks.ran" &&
551
552
test_must_fail git send-email \
552
553
--from="Example <[email protected] >" \
@@ -557,7 +558,7 @@ test_expect_success $PREREQ "--validate respects absolute core.hooksPath path" '
557
558
test_path_is_file my-hooks.ran &&
558
559
cat >expect <<-EOF &&
559
560
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
561
562
warning: no patches were sent
562
563
EOF
563
564
test_cmp expect actual
You can’t perform that action at this time.
0 commit comments