line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
6
|
|
|
6
|
|
1666
|
use 5.006; # our |
|
6
|
|
|
|
|
55
|
|
2
|
6
|
|
|
6
|
|
29
|
use strict; |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
170
|
|
3
|
6
|
|
|
6
|
|
25
|
use warnings; |
|
6
|
|
|
|
|
8
|
|
|
6
|
|
|
|
|
468
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Git::Wrapper::Plus::Refs; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.004011'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# ABSTRACT: Work with refs |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY |
12
|
|
|
|
|
|
|
|
13
|
6
|
|
|
6
|
|
712
|
use Moo qw( has ); |
|
6
|
|
|
|
|
15458
|
|
|
6
|
|
|
|
|
44
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
has 'git' => ( required => 1, is => ro => ); |
32
|
|
|
|
|
|
|
has 'support' => ( is => ro =>, lazy => 1, builder => 1 ); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub _build_support { |
35
|
4
|
|
|
4
|
|
38
|
my ( $self, ) = @_; |
36
|
4
|
|
|
|
|
1416
|
require Git::Wrapper::Plus::Support; |
37
|
4
|
|
|
|
|
122
|
return Git::Wrapper::Plus::Support->new( git => $self->git ); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub _for_each_ref { |
64
|
12
|
|
|
12
|
|
27
|
my ( $self, $refspec, $callback ) = @_; |
65
|
|
|
|
|
|
|
|
66
|
12
|
|
|
|
|
100
|
my $git_dir = $self->git->dir; |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
# git for-each-ref refs/heads/** == |
69
|
|
|
|
|
|
|
# for-each-ref refs/heads/* == |
70
|
|
|
|
|
|
|
# ls-remote refs/heads/* + exclude refs/heads/*/* |
71
|
|
|
|
|
|
|
# |
72
|
|
|
|
|
|
|
# git for-each-refs refs/heads/ == |
73
|
|
|
|
|
|
|
# ls-remote refs/heads/* |
74
|
|
|
|
|
|
|
# |
75
|
12
|
50
|
|
|
|
493
|
if ( $self->support->supports_command('for-each-ref') ) { |
76
|
|
|
|
|
|
|
## no critic (Compatibility::PerlMinimumVersionAndWhy) |
77
|
12
|
100
|
|
|
|
360
|
if ( $refspec =~ qr{\A(.*)/[*]{1,2}\z}msx ) { |
78
|
11
|
|
|
|
|
77
|
$refspec = $1; |
79
|
|
|
|
|
|
|
} |
80
|
12
|
|
|
|
|
251
|
for my $line ( $self->git->for_each_ref($refspec) ) { |
81
|
27
|
50
|
|
|
|
101344
|
if ( $line =~ qr{ \A ([^ ]+) [^\t]+ \t ( .+ ) \z }msx ) { |
82
|
27
|
|
|
|
|
124
|
$callback->( $1, $2 ); |
83
|
27
|
|
|
|
|
6836
|
next; |
84
|
|
|
|
|
|
|
} |
85
|
0
|
|
|
|
|
0
|
require Carp; |
86
|
0
|
|
|
|
|
0
|
Carp::confess( 'Regexp failed to parse a line from `git for-each-ref` :' . $line ); |
87
|
|
|
|
|
|
|
} |
88
|
12
|
|
|
|
|
67
|
return; |
89
|
|
|
|
|
|
|
} |
90
|
0
|
|
|
|
|
0
|
for my $line ( $self->git->ls_remote( $git_dir, $refspec ) ) { |
91
|
|
|
|
|
|
|
## no critic (Compatibility::PerlMinimumVersionAndWhy) |
92
|
0
|
0
|
|
|
|
0
|
if ( $line =~ qr{ \A ([^\t]+) \t ( .+ ) \z }msx ) { |
93
|
0
|
|
|
|
|
0
|
$callback->( $1, $2 ); |
94
|
0
|
|
|
|
|
0
|
next; |
95
|
|
|
|
|
|
|
} |
96
|
0
|
|
|
|
|
0
|
require Carp; |
97
|
0
|
|
|
|
|
0
|
Carp::confess( 'Regexp failed to parse a line from `git ls-remote` :' . $line ); |
98
|
|
|
|
|
|
|
} |
99
|
0
|
|
|
|
|
0
|
return; |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
sub refs { |
119
|
0
|
|
|
0
|
1
|
0
|
my ($self) = @_; |
120
|
0
|
|
|
|
|
0
|
return $self->get_ref('refs/**'); |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
sub get_ref { |
136
|
12
|
|
|
12
|
1
|
94200
|
my ( $self, $refspec ) = @_; |
137
|
12
|
|
|
|
|
26
|
my @out; |
138
|
|
|
|
|
|
|
$self->_for_each_ref( |
139
|
|
|
|
|
|
|
$refspec => sub { |
140
|
27
|
|
|
27
|
|
148
|
my ( $sha_one, $refname ) = @_; |
141
|
27
|
|
|
|
|
123
|
push @out, $self->_mk_ref( $sha_one, $refname ); |
142
|
|
|
|
|
|
|
}, |
143
|
12
|
|
|
|
|
117
|
); |
144
|
12
|
|
|
|
|
232
|
return @out; |
145
|
|
|
|
|
|
|
} |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
sub _mk_ref { |
148
|
27
|
|
|
27
|
|
62
|
my ( $self, undef, $name ) = @_; |
149
|
27
|
|
|
|
|
3010
|
require Git::Wrapper::Plus::Ref; |
150
|
27
|
|
|
|
|
953
|
return Git::Wrapper::Plus::Ref->new( |
151
|
|
|
|
|
|
|
git => $self->git, |
152
|
|
|
|
|
|
|
name => $name, |
153
|
|
|
|
|
|
|
); |
154
|
|
|
|
|
|
|
} |
155
|
6
|
|
|
6
|
|
7764
|
no Moo; |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
29
|
|
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
1; |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
__END__ |