line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
6
|
|
|
6
|
|
2833
|
use 5.008; # utf8 |
|
6
|
|
|
|
|
28
|
|
|
6
|
|
|
|
|
278
|
|
2
|
6
|
|
|
6
|
|
37
|
use strict; |
|
6
|
|
|
|
|
19
|
|
|
6
|
|
|
|
|
246
|
|
3
|
6
|
|
|
6
|
|
38
|
use warnings; |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
211
|
|
4
|
6
|
|
|
6
|
|
1132
|
use utf8; |
|
6
|
|
|
|
|
25
|
|
|
6
|
|
|
|
|
69
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
package Git::Wrapper::Plus::Refs; |
7
|
|
|
|
|
|
|
$Git::Wrapper::Plus::Refs::VERSION = '0.004010'; |
8
|
|
|
|
|
|
|
# ABSTRACT: Work with refs |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY |
11
|
|
|
|
|
|
|
|
12
|
6
|
|
|
6
|
|
1555
|
use Moo qw( has ); |
|
6
|
|
|
|
|
17910
|
|
|
6
|
|
|
|
|
149
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
has 'git' => ( required => 1, is => ro => ); |
31
|
|
|
|
|
|
|
has 'support' => ( is => ro =>, lazy => 1, builder => 1 ); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub _build_support { |
34
|
4
|
|
|
4
|
|
2365
|
my ( $self, ) = @_; |
35
|
4
|
|
|
|
|
53
|
require Git::Wrapper::Plus::Support; |
36
|
4
|
|
|
|
|
254
|
return Git::Wrapper::Plus::Support->new( git => $self->git ); |
37
|
|
|
|
|
|
|
} |
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
|
|
|
|
|
|
|
sub _for_each_ref { |
63
|
12
|
|
|
12
|
|
42
|
my ( $self, $refspec, $callback ) = @_; |
64
|
|
|
|
|
|
|
|
65
|
12
|
|
|
|
|
163
|
my $git_dir = $self->git->dir; |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
# git for-each-ref refs/heads/** == |
68
|
|
|
|
|
|
|
# for-each-ref refs/heads/* == |
69
|
|
|
|
|
|
|
# ls-remote refs/heads/* + exclude refs/heads/*/* |
70
|
|
|
|
|
|
|
# |
71
|
|
|
|
|
|
|
# git for-each-refs refs/heads/ == |
72
|
|
|
|
|
|
|
# ls-remote refs/heads/* |
73
|
|
|
|
|
|
|
# |
74
|
12
|
50
|
|
|
|
482
|
if ( $self->support->supports_command('for-each-ref') ) { |
75
|
|
|
|
|
|
|
## no critic (Compatibility::PerlMinimumVersionAndWhy) |
76
|
12
|
100
|
|
|
|
1161
|
if ( $refspec =~ qr{\A(.*)/[*]{1,2}\z}msx ) { |
77
|
11
|
|
|
|
|
149
|
$refspec = $1; |
78
|
|
|
|
|
|
|
} |
79
|
12
|
|
|
|
|
361
|
for my $line ( $self->git->for_each_ref($refspec) ) { |
80
|
27
|
50
|
|
|
|
258762
|
if ( $line =~ qr{ \A ([^ ]+) [^\t]+ \t ( .+ ) \z }msx ) { |
81
|
27
|
|
|
|
|
421
|
$callback->( $1, $2 ); |
82
|
27
|
|
|
|
|
14738
|
next; |
83
|
|
|
|
|
|
|
} |
84
|
0
|
|
|
|
|
0
|
require Carp; |
85
|
0
|
|
|
|
|
0
|
Carp::confess( 'Regexp failed to parse a line from `git for-each-ref` :' . $line ); |
86
|
|
|
|
|
|
|
} |
87
|
12
|
|
|
|
|
160
|
return; |
88
|
|
|
|
|
|
|
} |
89
|
0
|
|
|
|
|
0
|
for my $line ( $self->git->ls_remote( $git_dir, $refspec ) ) { |
90
|
|
|
|
|
|
|
## no critic (Compatibility::PerlMinimumVersionAndWhy) |
91
|
0
|
0
|
|
|
|
0
|
if ( $line =~ qr{ \A ([^\t]+) \t ( .+ ) \z }msx ) { |
92
|
0
|
|
|
|
|
0
|
$callback->( $1, $2 ); |
93
|
0
|
|
|
|
|
0
|
next; |
94
|
|
|
|
|
|
|
} |
95
|
0
|
|
|
|
|
0
|
require Carp; |
96
|
0
|
|
|
|
|
0
|
Carp::confess( 'Regexp failed to parse a line from `git ls-remote` :' . $line ); |
97
|
|
|
|
|
|
|
} |
98
|
0
|
|
|
|
|
0
|
return; |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
sub refs { |
118
|
0
|
|
|
0
|
1
|
0
|
my ($self) = @_; |
119
|
0
|
|
|
|
|
0
|
return $self->get_ref('refs/**'); |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
sub get_ref { |
135
|
12
|
|
|
12
|
1
|
215400
|
my ( $self, $refspec ) = @_; |
136
|
12
|
|
|
|
|
39
|
my @out; |
137
|
|
|
|
|
|
|
$self->_for_each_ref( |
138
|
|
|
|
|
|
|
$refspec => sub { |
139
|
27
|
|
|
27
|
|
263
|
my ( $sha_one, $refname ) = @_; |
140
|
27
|
|
|
|
|
333
|
push @out, $self->_mk_ref( $sha_one, $refname ); |
141
|
|
|
|
|
|
|
}, |
142
|
12
|
|
|
|
|
311
|
); |
143
|
12
|
|
|
|
|
601
|
return @out; |
144
|
|
|
|
|
|
|
} |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
sub _mk_ref { |
147
|
27
|
|
|
27
|
|
100
|
my ( $self, undef, $name ) = @_; |
148
|
27
|
|
|
|
|
7024
|
require Git::Wrapper::Plus::Ref; |
149
|
27
|
|
|
|
|
2232
|
return Git::Wrapper::Plus::Ref->new( |
150
|
|
|
|
|
|
|
git => $self->git, |
151
|
|
|
|
|
|
|
name => $name, |
152
|
|
|
|
|
|
|
); |
153
|
|
|
|
|
|
|
} |
154
|
6
|
|
|
6
|
|
7967
|
no Moo; |
|
6
|
|
|
|
|
15
|
|
|
6
|
|
|
|
|
35
|
|
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
1; |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
__END__ |