line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Git::Repository::Plugin::Info; |
2
|
3
|
|
|
3
|
|
93579
|
use parent qw(Git::Repository::Plugin); |
|
3
|
|
|
|
|
512
|
|
|
3
|
|
|
|
|
19
|
|
3
|
|
|
|
|
|
|
|
4
|
3
|
|
|
3
|
|
2448
|
use 5.008005; |
|
3
|
|
|
|
|
6
|
|
5
|
3
|
|
|
3
|
|
19
|
use strict; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
40
|
|
6
|
3
|
|
|
3
|
|
9
|
use warnings; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
588
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = "0.04"; |
9
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
54
|
sub _keywords { qw( |
11
|
|
|
|
|
|
|
is_bare |
12
|
|
|
|
|
|
|
has_ref |
13
|
|
|
|
|
|
|
has_branch |
14
|
|
|
|
|
|
|
has_tag |
15
|
|
|
|
|
|
|
) } |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub is_bare { |
18
|
2
|
|
|
2
|
1
|
79126
|
my $repo = shift; |
19
|
2
|
|
|
|
|
5
|
return _bool_config($repo, 'core.bare'); |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub has_ref { |
23
|
12
|
|
|
12
|
1
|
89384
|
my $repo = shift; |
24
|
12
|
|
|
|
|
25
|
my $ref_name = shift; |
25
|
12
|
|
|
|
|
58
|
$repo->run('show-ref', '--verify', '--quiet', $ref_name); |
26
|
12
|
|
|
|
|
89013
|
return ($? == 0); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub has_branch { |
30
|
4
|
|
|
4
|
1
|
8
|
my $repo = shift; |
31
|
4
|
|
|
|
|
7
|
my $branch_name = shift; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# normalize branch name to prevent ambiguous matches to tags, etc. |
34
|
4
|
100
|
|
|
|
21
|
unless (index($branch_name, 'refs/heads/') == 0) { |
35
|
2
|
|
|
|
|
7
|
$branch_name = 'refs/heads/' . $branch_name; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
4
|
|
|
|
|
10
|
return $repo->has_ref($branch_name); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub has_tag { |
42
|
4
|
|
|
4
|
1
|
8
|
my $repo = shift; |
43
|
4
|
|
|
|
|
9
|
my $tag_name = shift; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
# normalize tag name to prevent ambiguous matches to tags, etc. |
46
|
4
|
100
|
|
|
|
22
|
unless (index($tag_name, 'refs/tags/') == 0) { |
47
|
2
|
|
|
|
|
8
|
$tag_name = 'refs/tags/' . $tag_name; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
4
|
|
|
|
|
14
|
return $repo->has_ref($tag_name); |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub _bool_config { |
54
|
2
|
|
|
2
|
|
4
|
my $repo = shift; |
55
|
2
|
|
|
|
|
5
|
my $key = shift; |
56
|
2
|
|
|
|
|
5
|
my $bare = $repo->run('config', '--bool', $key); |
57
|
2
|
|
|
|
|
10390
|
return ($bare eq 'true'); |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
1; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
__END__ |