LowLevel.pm

filter: Statementstmt 95.0% 38 / 40 Branchbran 66.6% 8 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod 100% 2 / 2 totaltotal 90.3% 56 / 62 CC 7 SCAR 10.3
CC
7
Cov
88%
__ANON__
4.2
BUILD
4.1
BEGIN
1.0
CRAP 2.8
« LowLevel/Reference.pm ↑ Summary LowLevel/Commit.pm »
1 package Git::LowLevel;
2 # ABSTRACT: LowLevel Blob/Tree/Commit operations on a GIT Repository
3 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 4 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 4 ▶use MooseX::Privacy;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 4 ▶use Git::LowLevel::Reference;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9  
10  
11 4 has 'git_dir' => (is => 'ro', isa => 'Str', required => 1);
12  
13 4 has 'gitcmd' => (is => 'rw', isa=>'Str', default=>'git');
14  
15 4 has 'bare' => (is => 'rw', default=>0, traits => [qw/Private/]);
16  
17  
18  
19  
20 9 ▶private_method _isGit => sub {
Subroutine __ANON__: called CC=4 SCAR=14.4
21 9 my $self = shift;
22  
23 9 ▶ return 0 unless -d $self->git_dir();
Branch: 1 branch
BranchTrueFalseTotal
unless -d $self->git_dir 0 9 9
24  
25 9 ▶ if (-d $self->git_dir . "/.git")
Branch: 1 branch
BranchTrueFalseTotal
if (-d $self->git_dir . '/.git') 8 1 9
26 {
27 8 $self->bare(0);
28 8 return 1;
29 }
30 1 my $help=readpipe("cd " . $self->git_dir . "; " . $self->gitcmd() . ' rev-parse --git-dir 1>/dev/null 2> /dev/null;echo $?');
31 1 chomp($help);
32  
33 1 ▶ if ($help == 0)
Branch: 1 branch
BranchTrueFalseTotal
if ($help == 0) 0 1 1
34 {
35 0 $self->bare(1);
36 0 return 1;
37 }
38  
39 1 return 0;
40 4 };
41  
42 9 ▶sub BUILD {
Subroutine BUILD: called CC=4 SCAR=14.0
Pod documented
43 9 my $self = shift;
44  
45 9 ▶ die("directory does not exist (".$self->git_dir . " )") unless -d $self->git_dir();
Branch: 1 branch
BranchTrueFalseTotal
unless -d $self->git_dir 0 9 9
46 9 ▶ die("directory is not a git repository (" .$self->git_dir . " )") unless $self->_isGit();
Branch: 1 branch
BranchTrueFalseTotal
unless $self->_isGit 1 8 9
47  
48 #update gitcmd attribute
49 8 $self->gitcmd($self->gitcmd . ' --git-dir='.$self->git_dir());
50 8 ▶ if ($self->bare()==0)
Branch: 1 branch
BranchTrueFalseTotal
if ($self->bare == 0) 8 0 8
51 {
52 8 $self->gitcmd($self->gitcmd . "/.git");
53 }
54  
55 };
56  
57  
58 sub getReference
59 7 ▶{
Subroutine getReference: called CC=1 SCAR=0.0
Pod documented
60 7 my $self = shift;
61 7 my $ref = shift;
62  
63 7 return Git::LowLevel::Reference->new(repository=>$self, reference=>$ref);
64 }
65  
66  
67  
68 4 1;
69  
70 __END__
« LowLevel/Reference.pm ↑ Summary LowLevel/Commit.pm »