line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Git::Repository::Plugin::Hooks; |
2
|
2
|
|
|
2
|
|
62572
|
use parent qw(Git::Repository::Plugin); |
|
2
|
|
|
|
|
242
|
|
|
2
|
|
|
|
|
19
|
|
3
|
|
|
|
|
|
|
|
4
|
2
|
|
|
2
|
|
1851
|
use 5.008005; |
|
2
|
|
|
|
|
8
|
|
5
|
2
|
|
|
2
|
|
15
|
use strict; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
28
|
|
6
|
2
|
|
|
2
|
|
5
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
35
|
|
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
8
|
use Carp qw(); |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
19
|
|
9
|
2
|
|
|
2
|
|
968
|
use File::Copy qw(); |
|
2
|
|
|
|
|
3938
|
|
|
2
|
|
|
|
|
354
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = "0.04"; |
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
30
|
sub _keywords { qw( |
14
|
|
|
|
|
|
|
install_hook |
15
|
|
|
|
|
|
|
hook_path |
16
|
|
|
|
|
|
|
) } |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub install_hook { |
19
|
1
|
|
|
1
|
1
|
440
|
my ($repo, $source, $target) = @_; |
20
|
|
|
|
|
|
|
|
21
|
1
|
|
|
|
|
4
|
my $dest = $repo->hook_path($target); |
22
|
1
|
|
|
|
|
19
|
my $copy_rv = File::Copy::copy($source, $dest); |
23
|
1
|
50
|
|
|
|
1620
|
unless ($copy_rv) { |
24
|
0
|
|
|
|
|
0
|
Carp::croak "install_hook failed: $!"; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
1
|
|
|
|
|
21
|
my $chmod_rv = chmod 0755, $dest; |
28
|
1
|
50
|
|
|
|
16
|
unless ($chmod_rv) { |
29
|
0
|
|
|
|
|
0
|
Carp::croak "install_hook failed: $!"; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub hook_path { |
34
|
2
|
|
|
2
|
1
|
48811
|
my ($repo, $target) = @_; |
35
|
2
|
|
|
|
|
9
|
return File::Spec->join($repo->git_dir, 'hooks', $target); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |
39
|
|
|
|
|
|
|
__END__ |