| 1 | package Git::Gitalist::Repository; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use Moose; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 2 | with qw( | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | Git::Gitalist::HasUtils | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | Git::Gitalist::Serializable | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 2 | ▶ | use Method::Signatures; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 2 | ▶ | use MooseX::Types::Common::String qw/NonEmptySimpleStr/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 2 | ▶ | use MooseX::Types::Moose qw/Str Maybe Bool HashRef ArrayRef/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 2 | ▶ | use MooseX::Types::DateTime qw/DateTime/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 2 | ▶ | use MooseX::Types::Path::Class qw/Dir/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 2 | ▶ | use Git::Gitalist::Types qw/SHA1/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 2 | ▶ | use aliased 'DateTime' => 'DT'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 2 | ▶ | use List::MoreUtils qw/any zip/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 2 | ▶ | use Encode qw/decode/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 2 | ▶ | use if $^O ne 'MSWin32' => 'I18N::Langinfo', qw/langinfo CODESET/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 2 | ▶ | use Git::Gitalist::Object::Blob; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 2 | ▶ | use Git::Gitalist::Object::Tree; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 2 | ▶ | use Git::Gitalist::Object::Commit; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 2 | ▶ | use Git::Gitalist::Object::Tag; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 2 | ▶ | use Git::Gitalist::Head; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 2 | ▶ | use Git::Gitalist::Tag; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 2 | our $SHA1RE = qr/[0-9a-fA-F]{40}/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 2 | has name => ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | isa => NonEmptySimpleStr, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | required => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 2 | has path => ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | isa => Dir, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | required => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | coerce => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | traits => ['DoNotSerialize'], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 2 | has description => ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | isa => Str, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | lazy_build => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 2 | has owner => ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | isa => NonEmptySimpleStr, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | lazy_build => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 2 | has last_change => ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | isa => Maybe[DateTime], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | lazy_build => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | has is_bare => ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | isa => Bool, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | lazy => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 1 | ▶ | default => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 1 | -d $_[0]->path->parent->subdir($_[0]->name) | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 2 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 2 | has heads => ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | isa => ArrayRef['Git::Gitalist::Head'], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | lazy_build => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 2 | has tags => ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | isa => ArrayRef['Git::Gitalist::Tag'], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | lazy_build => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 2 | has references => ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | isa => HashRef[ArrayRef[Str]], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | lazy_build => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 3 | ▶ | around BUILDARGS => method($orig: $class, $dir, Str $override_name = '') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=12 SCAR=29.8
Branch: 5 branches
Condition33%1/3
$Method::Signatures::mutc{"cache"}{"Str"} ||= "Method::Signatures"->_make_constraint("Str")
MC/DC0%0/2
$Method::Signatures::mutc{"cache"}{"Str"} ||= "Method::Signatures"->_make_constraint("Str")
$Method::Signatures::mutc{"cache"}{"Str"}
"Method::Signatures"->_make_constraint("Str")
Truth table33%1/3
A ||= B
A= $Method::Signatures::mutc{"cache"}{"Str"}B= "Method::Signatures"->_make_constraint("Str")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 2 | ▶ | $dir = Path::Class::dir($dir) unless ref $dir; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | # Allows us to be called as Repository->new($dir) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | # Last path component becomes $self->name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | # Full path to git objects becomes $self->path | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 2 | my $name = $dir->dir_list(-1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 2 | ▶ | if(-f $dir->file('.git', 'HEAD')) { # Non-bare repo above .git | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | $dir = $dir->subdir('.git'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | $name = $dir->dir_list(-2, 1); # .../name/.git | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | } elsif('.git' eq $dir->dir_list(-1)) { # Non-bare repo in .git | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | $name = $dir->dir_list(-2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 2 | ▶ | confess("Can't find a git repository at " . $dir) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | unless -f $dir->file('HEAD'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 2 | ▶ | return $class->$orig(name => $override_name || $name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$override_name || $name
MC/DC0%0/2
$override_name || $name
$override_name
$name
Truth table33%1/3
A || B
A= $override_nameB= $name
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | path => $dir); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 2 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 2 | ▶ | method BUILD($args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.1
Subroutine
BUILD: called CC=4 SCAR=14.1
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 2 | $self->$_() for qw/last_change owner description /; # Ensure to build early. | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | ## Public methods | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 2 | ▶ | method head_hash (Str $head?) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.3
Subroutine
head_hash: called CC=7 SCAR=20.5
Branch: 2 branches
Condition50%3/6
scalar @_ > 0 and not +($Method::Signatures::mutc{"cache"}{"Str"} ||= "Method::Signatures"->_make_constraint("Str"))->check($head)
$Method::Signatures::mutc{"cache"}{"Str"} ||= "Method::Signatures"->_make_constraint("Str")
MC/DC0%0/2
scalar @_ > 0 and not +($Method::Signatures::mutc{"cache"}{"Str"} ||= "Method::Signatures"->_make_constraint("Str"))->check($head)
scalar @_ > 0
not +($Method::Signatures::mutc{"cache"}{"Str"} ||= "Method::Signatures"->_make_constraint("Str"))->check($head)
MC/DC0%0/2
$Method::Signatures::mutc{"cache"}{"Str"} ||= "Method::Signatures"->_make_constraint("Str")
$Method::Signatures::mutc{"cache"}{"Str"}
"Method::Signatures"->_make_constraint("Str")
Truth table66%2/3
A and not(B)
A= scalar @_ > 0B= not +($Method::Signatures::mutc{"cache"}{"Str"} ||= "Method::Signatures"->_make_constraint("Str"))->check($head)
Truth table33%1/3
A ||= B
A= $Method::Signatures::mutc{"cache"}{"Str"}B= "Method::Signatures"->_make_constraint("Str")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 5 | ▶ | my $output = $self->run_cmd(qw/rev-parse --verify/, $head || 'HEAD' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$head || 'HEAD'
MC/DC100%1/1
$head || 'HEAD'
$head
Truth table100%2/2
A
A= $head
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 5 | ▶ | confess("No such head: " . $head) unless defined $output; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 5 | my($sha1) = $output =~ /^($SHA1RE)$/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 5 | return $sha1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 2 | ▶ | method get_object (MooseX::Types::Common::String::NonEmptySimpleStr $sha1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.2
Subroutine
get_object: called CC=6 SCAR=18.8
Branch: 3 branches
Condition66%2/3
$Method::Signatures::mutc{"cache"}{"MooseX::Types::Common::String::NonEmptySimpleStr"} ||= "Method::Signatures"->_make_constraint("MooseX::Types::Common::String::NonEmptySimpleStr")
MC/DC0%0/2
$Method::Signatures::mutc{"cache"}{"MooseX::Types::Common::String::NonEmptySimpleStr"} ||= "Method::Signatures"->_make_constraint("MooseX::Types::Common::String::NonEmptySimpleStr")
$Method::Signatures::mutc{"cache"}{"MooseX::Types::Common::String::NonEmptySimpleStr"}
"Method::Signatures"->_make_constraint("MooseX::Types::Common::String::NonEmptySimpleStr")
Truth table66%2/3
A ||= B
A= $Method::Signatures::mutc{"cache"}{"MooseX::Types::Common::String::NonEmptySimpleStr"}B= "Method::Signatures"->_make_constraint("MooseX::Types::Common::String::NonEmptySimpleStr")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 4 | ▶ | unless (is_SHA1($sha1)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | $sha1 = $self->head_hash($sha1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 4 | my $type = $self->run_cmd('cat-file', '-t', $sha1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 4 | chomp($type); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 4 | my $class = 'Git::Gitalist::Object::' . ucfirst($type); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 4 | $class->new( | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | repository => $self, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | sha1 => $sha1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | type => $type, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | ▶ | method list_revs ( MooseX::Types::Common::String::NonEmptySimpleStr :$sha1!, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=5.1
Subroutine
list_revs: not called CC=28 SCAR=66.4
Branch: 2 branches
Condition0%0/3
$Method::Signatures::mutc{"cache"}{"MooseX::Types::Common::String::NonEmptySimpleStr"} ||= "Method::Signatures"->_make_constraint("MooseX::Types::Common::String::NonEmptySimpleStr")
MC/DC0%0/2
$Method::Signatures::mutc{"cache"}{"MooseX::Types::Common::String::NonEmptySimpleStr"} ||= "Method::Signatures"->_make_constraint("MooseX::Types::Common::String::NonEmptySimpleStr")
$Method::Signatures::mutc{"cache"}{"MooseX::Types::Common::String::NonEmptySimpleStr"}
"Method::Signatures"->_make_constraint("MooseX::Types::Common::String::NonEmptySimpleStr")
Truth table0%0/3
A ||= B
A= $Method::Signatures::mutc{"cache"}{"MooseX::Types::Common::String::NonEmptySimpleStr"}B= "Method::Signatures"->_make_constraint("MooseX::Types::Common::String::NonEmptySimpleStr")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | ▶ | Int :$count?, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
exists $args{"count"} and not +($Method::Signatures::mutc{"cache"}{"Int"} ||= "Method::Signatures"->_make_constraint("Int"))->check($count)
$Method::Signatures::mutc{"cache"}{"Int"} ||= "Method::Signatures"->_make_constraint("Int")
MC/DC0%0/2
exists $args{"count"} and not +($Method::Signatures::mutc{"cache"}{"Int"} ||= "Method::Signatures"->_make_constraint("Int"))->check($count)
exists $args{"count"}
not +($Method::Signatures::mutc{"cache"}{"Int"} ||= "Method::Signatures"->_make_constraint("Int"))->check($count)
MC/DC0%0/2
$Method::Signatures::mutc{"cache"}{"Int"} ||= "Method::Signatures"->_make_constraint("Int")
$Method::Signatures::mutc{"cache"}{"Int"}
"Method::Signatures"->_make_constraint("Int")
Truth table0%0/3
A and not(B)
A= exists $args{"count"}B= not +($Method::Signatures::mutc{"cache"}{"Int"} ||= "Method::Signatures"->_make_constraint("Int"))->check($count)
Truth table0%0/3
A ||= B
A= $Method::Signatures::mutc{"cache"}{"Int"}B= "Method::Signatures"->_make_constraint("Int")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | ▶ | Int :$skip?, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
exists $args{"skip"} and not +($Method::Signatures::mutc{"cache"}{"Int"} ||= "Method::Signatures"->_make_constraint("Int"))->check($skip)
$Method::Signatures::mutc{"cache"}{"Int"} ||= "Method::Signatures"->_make_constraint("Int")
MC/DC0%0/2
exists $args{"skip"} and not +($Method::Signatures::mutc{"cache"}{"Int"} ||= "Method::Signatures"->_make_constraint("Int"))->check($skip)
exists $args{"skip"}
not +($Method::Signatures::mutc{"cache"}{"Int"} ||= "Method::Signatures"->_make_constraint("Int"))->check($skip)
MC/DC0%0/2
$Method::Signatures::mutc{"cache"}{"Int"} ||= "Method::Signatures"->_make_constraint("Int")
$Method::Signatures::mutc{"cache"}{"Int"}
"Method::Signatures"->_make_constraint("Int")
Truth table0%0/3
A and not(B)
A= exists $args{"skip"}B= not +($Method::Signatures::mutc{"cache"}{"Int"} ||= "Method::Signatures"->_make_constraint("Int"))->check($skip)
Truth table0%0/3
A ||= B
A= $Method::Signatures::mutc{"cache"}{"Int"}B= "Method::Signatures"->_make_constraint("Int")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | ▶ | HashRef :$search?, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
exists $args{"search"} and not +($Method::Signatures::mutc{"cache"}{"HashRef"} ||= "Method::Signatures"->_make_constraint("HashRef"))->check($search)
$Method::Signatures::mutc{"cache"}{"HashRef"} ||= "Method::Signatures"->_make_constraint("HashRef")
MC/DC0%0/2
exists $args{"search"} and not +($Method::Signatures::mutc{"cache"}{"HashRef"} ||= "Method::Signatures"->_make_constraint("HashRef"))->check($search)
exists $args{"search"}
not +($Method::Signatures::mutc{"cache"}{"HashRef"} ||= "Method::Signatures"->_make_constraint("HashRef"))->check($search)
MC/DC0%0/2
$Method::Signatures::mutc{"cache"}{"HashRef"} ||= "Method::Signatures"->_make_constraint("HashRef")
$Method::Signatures::mutc{"cache"}{"HashRef"}
"Method::Signatures"->_make_constraint("HashRef")
Truth table0%0/3
A and not(B)
A= exists $args{"search"}B= not +($Method::Signatures::mutc{"cache"}{"HashRef"} ||= "Method::Signatures"->_make_constraint("HashRef"))->check($search)
Truth table0%0/3
A ||= B
A= $Method::Signatures::mutc{"cache"}{"HashRef"}B= "Method::Signatures"->_make_constraint("HashRef")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | ▶ | MooseX::Types::Common::String::NonEmptySimpleStr :$file? ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition0%0/6
exists $args{"file"} and not +($Method::Signatures::mutc{"cache"}{"MooseX::Types::Common::String::NonEmptySimpleStr"} ||= "Method::Signatures"->_make_constraint("MooseX::Types::Common::String::NonEmptySimpleStr"))->check($file)
$Method::Signatures::mutc{"cache"}{"MooseX::Types::Common::String::NonEmptySimpleStr"} ||= "Method::Signatures"->_make_constraint("MooseX::Types::Common::String::NonEmptySimpleStr")
MC/DC0%0/2
exists $args{"file"} and not +($Method::Signatures::mutc{"cache"}{"MooseX::Types::Common::String::NonEmptySimpleStr"} ||= "Method::Signatures"->_make_constraint("MooseX::Types::Common::String::NonEmptySimpleStr"))->check($file)
exists $args{"file"}
not +($Method::Signatures::mutc{"cache"}{"MooseX::Types::Common::String::NonEmptySimpleStr"} ||= "Method::Signatures"->_make_constraint("MooseX::Types::Common::String::NonEmptySimpleStr"))->check($file)
MC/DC0%0/2
$Method::Signatures::mutc{"cache"}{"MooseX::Types::Common::String::NonEmptySimpleStr"} ||= "Method::Signatures"->_make_constraint("MooseX::Types::Common::String::NonEmptySimpleStr")
$Method::Signatures::mutc{"cache"}{"MooseX::Types::Common::String::NonEmptySimpleStr"}
"Method::Signatures"->_make_constraint("MooseX::Types::Common::String::NonEmptySimpleStr")
Truth table0%0/3
A and not(B)
A= exists $args{"file"}B= not +($Method::Signatures::mutc{"cache"}{"MooseX::Types::Common::String::NonEmptySimpleStr"} ||= "Method::Signatures"->_make_constraint("MooseX::Types::Common::String::NonEmptySimpleStr"))->check($file)
Truth table0%0/3
A ||= B
A= $Method::Signatures::mutc{"cache"}{"MooseX::Types::Common::String::NonEmptySimpleStr"}B= "Method::Signatures"->_make_constraint("MooseX::Types::Common::String::NonEmptySimpleStr")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | ▶ | $sha1 = $self->head_hash($sha1) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$sha1 and $sha1 =~ /$Git::Gitalist::Repository::SHA1RE/
MC/DC0%0/2
$sha1 and $sha1 =~ /$Git::Gitalist::Repository::SHA1RE/
$sha1
$sha1 =~ /$Git::Gitalist::Repository::SHA1RE/
Truth table0%0/3
A and B
A= $sha1B= $sha1 =~ /$Git::Gitalist::Repository::SHA1RE/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | if !$sha1 || $sha1 !~ $SHA1RE; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | my @search_opts; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | ▶ | if ($search and exists $search->{text}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$search and exists $search->{"text"}
MC/DC0%0/2
$search and exists $search->{"text"}
$search
exists $search->{"text"}
Truth table0%0/3
A and B
A= $searchB= exists $search->{"text"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | $search->{type} = 'grep' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | ▶ | if $search->{type} eq 'commit'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | @search_opts = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | # This seems a little fragile ... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | qq[--$search->{type}=$search->{text}], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | '--regexp-ignore-case', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | ▶ | $search->{regexp} ? '--extended-regexp' : '--fixed-strings' | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | ▶ | my $output = $self->run_cmd( | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 'rev-list', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | '--header', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | (defined $count ? "--max-count=$count" : ()), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | (defined $skip ? "--skip=$skip" : ()), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | @search_opts, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | $sha1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | '--', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | ($file ? $file : ()), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | ▶ | return unless $output; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | my @revs = $self->_parse_rev_list($output); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | return @revs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | ▶ | method snapshot (MooseX::Types::Common::String::NonEmptySimpleStr :$sha1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=5.1
Subroutine
snapshot: not called CC=10 SCAR=45.8
Branch: 1 branch
Condition0%0/6
exists $args{"sha1"} and not +($Method::Signatures::mutc{"cache"}{"MooseX::Types::Common::String::NonEmptySimpleStr"} ||= "Method::Signatures"->_make_constraint("MooseX::Types::Common::String::NonEmptySimpleStr"))->check($sha1)
$Method::Signatures::mutc{"cache"}{"MooseX::Types::Common::String::NonEmptySimpleStr"} ||= "Method::Signatures"->_make_constraint("MooseX::Types::Common::String::NonEmptySimpleStr")
MC/DC0%0/2
exists $args{"sha1"} and not +($Method::Signatures::mutc{"cache"}{"MooseX::Types::Common::String::NonEmptySimpleStr"} ||= "Method::Signatures"->_make_constraint("MooseX::Types::Common::String::NonEmptySimpleStr"))->check($sha1)
exists $args{"sha1"}
not +($Method::Signatures::mutc{"cache"}{"MooseX::Types::Common::String::NonEmptySimpleStr"} ||= "Method::Signatures"->_make_constraint("MooseX::Types::Common::String::NonEmptySimpleStr"))->check($sha1)
MC/DC0%0/2
$Method::Signatures::mutc{"cache"}{"MooseX::Types::Common::String::NonEmptySimpleStr"} ||= "Method::Signatures"->_make_constraint("MooseX::Types::Common::String::NonEmptySimpleStr")
$Method::Signatures::mutc{"cache"}{"MooseX::Types::Common::String::NonEmptySimpleStr"}
"Method::Signatures"->_make_constraint("MooseX::Types::Common::String::NonEmptySimpleStr")
Truth table0%0/3
A and not(B)
A= exists $args{"sha1"}B= not +($Method::Signatures::mutc{"cache"}{"MooseX::Types::Common::String::NonEmptySimpleStr"} ||= "Method::Signatures"->_make_constraint("MooseX::Types::Common::String::NonEmptySimpleStr"))->check($sha1)
Truth table0%0/3
A ||= B
A= $Method::Signatures::mutc{"cache"}{"MooseX::Types::Common::String::NonEmptySimpleStr"}B= "Method::Signatures"->_make_constraint("MooseX::Types::Common::String::NonEmptySimpleStr")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | ▶ | MooseX::Types::Common::String::NonEmptySimpleStr :$format | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition0%0/6
exists $args{"format"} and not +($Method::Signatures::mutc{"cache"}{"MooseX::Types::Common::String::NonEmptySimpleStr"} ||= "Method::Signatures"->_make_constraint("MooseX::Types::Common::String::NonEmptySimpleStr"))->check($format)
$Method::Signatures::mutc{"cache"}{"MooseX::Types::Common::String::NonEmptySimpleStr"} ||= "Method::Signatures"->_make_constraint("MooseX::Types::Common::String::NonEmptySimpleStr")
MC/DC0%0/2
exists $args{"format"} and not +($Method::Signatures::mutc{"cache"}{"MooseX::Types::Common::String::NonEmptySimpleStr"} ||= "Method::Signatures"->_make_constraint("MooseX::Types::Common::String::NonEmptySimpleStr"))->check($format)
exists $args{"format"}
not +($Method::Signatures::mutc{"cache"}{"MooseX::Types::Common::String::NonEmptySimpleStr"} ||= "Method::Signatures"->_make_constraint("MooseX::Types::Common::String::NonEmptySimpleStr"))->check($format)
MC/DC0%0/2
$Method::Signatures::mutc{"cache"}{"MooseX::Types::Common::String::NonEmptySimpleStr"} ||= "Method::Signatures"->_make_constraint("MooseX::Types::Common::String::NonEmptySimpleStr")
$Method::Signatures::mutc{"cache"}{"MooseX::Types::Common::String::NonEmptySimpleStr"}
"Method::Signatures"->_make_constraint("MooseX::Types::Common::String::NonEmptySimpleStr")
Truth table0%0/3
A and not(B)
A= exists $args{"format"}B= not +($Method::Signatures::mutc{"cache"}{"MooseX::Types::Common::String::NonEmptySimpleStr"} ||= "Method::Signatures"->_make_constraint("MooseX::Types::Common::String::NonEmptySimpleStr"))->check($format)
Truth table0%0/3
A ||= B
A= $Method::Signatures::mutc{"cache"}{"MooseX::Types::Common::String::NonEmptySimpleStr"}B= "Method::Signatures"->_make_constraint("MooseX::Types::Common::String::NonEmptySimpleStr")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | # TODO - only valid formats are 'tar' and 'zip' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | my $formats = { tgz => 'tar', zip => 'zip' }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | ▶ | unless (exists $formats->{$format}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | die("No such format: $format"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | $format = $formats->{$format}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | my $name = $self->name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | $name =~ s,([^/])/*\.git$,$1,; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | my $filename = $name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | $filename .= "-$sha1.$format"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | $name =~ s/\047/\047\\\047\047/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | my @cmd = ('archive', "--format=$format", "--prefix=$name/", $sha1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | return ($filename, $self->run_cmd_fh(@cmd)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | # TODO - support compressed archives | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | ## BUILDERS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 2 | ▶ | method _build_util { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
_build_util: called CC=2 SCAR=7.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 2 | Git::Gitalist::Util->new( | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | repository => $self, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 2 | ▶ | method _build_description { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
_build_description: called CC=3 SCAR=11.1
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 2 | my $description = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 2 | eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 2 | $description = $self->path->file('description')->slurp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 2 | utf8::decode($description); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 2 | chomp $description; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 2 | ▶ | $description = "Unnamed repository, edit the .git/description file to set a description" | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | if $description eq "Unnamed repository; edit this file 'description' to name the repository."; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 2 | return $description; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 2 | ▶ | method _build_owner { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
_build_owner: called CC=4 SCAR=14.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 2 | ▶ | return 'system' if $^O =~ 'MSWin32'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 2 | my ($gecos, $name) = map { decode(langinfo(CODESET()), $_) } (getpwuid $self->path->stat->uid)[6,0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 2 | $gecos =~ s/,+$//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 2 | ▶ | return length($gecos) ? $gecos : $name; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 2 | ▶ | method _build_last_change { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
_build_last_change: called CC=3 SCAR=11.1
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 2 | my $last_change; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 2 | my $output = $self->run_cmd( | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | qw{ for-each-ref --format=%(committer) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | --sort=-committerdate --count=1 refs/heads | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 2 | ▶ | if (my ($epoch, $tz) = $output =~ /\s(\d+)\s+([+-]\d+)$/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 2 | my $dt = DT->from_epoch(epoch => $epoch); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 2 | $dt->set_time_zone($tz); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 2 | $last_change = $dt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 2 | return $last_change; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 2 | ▶ | method _build_heads { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
_build_heads: called CC=3 SCAR=11.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 1 | my @revlines = $self->run_cmd_list(qw/for-each-ref --sort=-committerdate /, '--format=%(objectname)%00%(refname)%00%(committer)', 'refs/heads'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 1 | my @ret; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 1 | for my $line (@revlines) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 2 | push @ret, Git::Gitalist::Head->new($line); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 1 | return \@ret; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 2 | ▶ | method _build_tags { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
_build_tags: called CC=2 SCAR=7.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 1 | my @revlines = $self->run_cmd_list('for-each-ref', | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | '--sort=-creatordate', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | '--format=%(objectname) %(objecttype) %(refname) %(*objectname) %(*objecttype) %(subject)%00%(creator)', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 'refs/tags' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | return [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 1 | map Git::Gitalist::Tag->new($_), | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | grep Git::Gitalist::Tag::is_valid_tag($_), @revlines | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 2 | ▶ | method _build_references { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
_build_references: called CC=5 SCAR=16.4
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | # 5dc01c595e6c6ec9ccda4f6f69c131c0dd945f8c refs/tags/v2.6.11 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | # c39ae07f393806ccf406ef966e9a15afc43cc36a refs/tags/v2.6.11^{} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 1 | ▶ | my @reflist = $self->run_cmd_list(qw(show-ref --dereference)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 1 | my %refs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 1 | for (@reflist) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 3 | ▶ | push @{$refs{$1}}, $2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | if m!^($SHA1RE)\srefs/(.*)$!; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 1 | return \%refs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | ## Private methods | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | ▶ | method _parse_rev_list ($output) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=4.1
Subroutine
_parse_rev_list: not called CC=3 SCAR=20.7
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | return | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 0 | map $self->get_gpp_object($_), | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | grep is_SHA1($_), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | map split(/\n/, $_, 6), split /\0/, $output; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 2 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||