line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Git::Class::Cmd; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
51130
|
use Module::Find (); |
|
3
|
|
|
|
|
4220
|
|
|
3
|
|
|
|
|
63
|
|
4
|
3
|
|
|
3
|
|
1730
|
use Moo; with (Module::Find::findsubmod 'Git::Class::Role'); |
|
3
|
|
|
|
|
37767
|
|
|
3
|
|
|
|
|
19
|
|
5
|
3
|
|
|
3
|
|
6795
|
use MRO::Compat; |
|
3
|
|
|
|
|
5365
|
|
|
3
|
|
|
|
|
79
|
|
6
|
3
|
|
|
3
|
|
2320
|
use Path::Tiny; |
|
3
|
|
|
|
|
35971
|
|
|
3
|
|
|
|
|
5842
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
has no_capture => (is => 'rw'); |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
has '_git' => ( |
11
|
|
|
|
|
|
|
is => 'rw', |
12
|
|
|
|
|
|
|
# isa => 'Str|Undef', |
13
|
|
|
|
|
|
|
init_arg => 'exec_path', |
14
|
|
|
|
|
|
|
builder => '_find_git', |
15
|
|
|
|
|
|
|
); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# predicate doesn't work in this case |
18
|
12
|
50
|
|
12
|
1
|
304
|
sub is_available { shift->_git ? 1 : 0 } |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub _find_git { |
21
|
3
|
|
|
3
|
|
741
|
my $self = shift; |
22
|
|
|
|
|
|
|
|
23
|
3
|
|
|
|
|
12
|
my $file = $ENV{GIT_EXEC_PATH}; |
24
|
|
|
|
|
|
|
|
25
|
3
|
50
|
33
|
|
|
19
|
return $file if $file && -f $file; |
26
|
|
|
|
|
|
|
|
27
|
3
|
|
|
|
|
26
|
require Config; |
28
|
3
|
|
50
|
|
|
58
|
my $path_sep = $Config::Config{path_sep} || ';'; |
29
|
|
|
|
|
|
|
|
30
|
3
|
|
50
|
|
|
55
|
foreach my $path ( split /$path_sep/, ($ENV{PATH} || '') ) { |
31
|
12
|
50
|
66
|
|
|
1341
|
return 'git' if path($path, 'git')->is_file |
|
|
|
66
|
|
|
|
|
32
|
|
|
|
|
|
|
|| path($path, 'git.cmd')->is_file |
33
|
|
|
|
|
|
|
|| path($path, 'git.exe')->is_file; |
34
|
|
|
|
|
|
|
} |
35
|
0
|
|
|
|
|
0
|
return; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub git { |
39
|
10
|
|
|
10
|
1
|
7725
|
my $self = shift; |
40
|
|
|
|
|
|
|
|
41
|
10
|
50
|
|
|
|
84
|
unless ($self->is_available) { |
42
|
0
|
|
|
|
|
0
|
$self->_error("git binary is not available"); |
43
|
0
|
|
|
|
|
0
|
return; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
10
|
|
|
|
|
20
|
my %git_options; |
47
|
10
|
|
|
|
|
40
|
while(ref $_[0] eq 'HASH') { |
48
|
0
|
|
|
|
|
0
|
my $href = shift; |
49
|
0
|
|
|
|
|
0
|
%git_options = (%git_options, %{$href}); |
|
0
|
|
|
|
|
0
|
|
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
10
|
|
|
|
|
84
|
my ($options, @args) = $self->_get_options(@_); |
53
|
10
|
|
|
|
|
23
|
my $cmd = shift @args; |
54
|
|
|
|
|
|
|
|
55
|
10
|
50
|
|
|
|
86
|
$self->_execute( |
56
|
|
|
|
|
|
|
$self->_git, |
57
|
|
|
|
|
|
|
$self->_prepare_options(\%git_options), |
58
|
|
|
|
|
|
|
($cmd ? ($cmd) : ()), |
59
|
|
|
|
|
|
|
$self->_prepare_options($options), |
60
|
|
|
|
|
|
|
@args, |
61
|
|
|
|
|
|
|
); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
1; |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
__END__ |