GitGot/Command/gc.pm

filter: Statementstmt 93.3% 28 / 30 Branchbran 83.3% 5 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 88.8% 8 / 9 Podpod n/a totaltotal 91.1% 41 / 45 CC 5 SCAR 7.0
CC
5
Cov
92%
_execute
3.1
__ANON__
3.0
__ANON__
2.0
CRAP 2.0
« GitGot/Command/do.pm ↑ Summary GitGot/Repositories.pm »
1 package App::GitGot::Command::gc;
2 16 our $AUTHORITY = 'cpan:GENEHACK';
3 16 $App::GitGot::Command::gc::VERSION = '1.339';
4 # ABSTRACT: Run the 'gc' command to garbage collect in git repos
5 16 ▶use 5.014;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 16 ▶use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 16 ▶use Try::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 16 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 16 extends 'App::GitGot::Command';
12 16 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 # incremental output looks nicer for this command...
15 16 STDOUT->autoflush(1);
16 2 ▶sub _use_io_page { 0 }
Subroutine _use_io_page: called CC=1 SCAR=0.0
17  
18 2 ▶sub _execute {
Subroutine _execute: called CC=3 SCAR=11.2
19 2 my( $self, $opt, $args ) = @_;
20  
21 2 my $max_len = $self->max_length_of_an_active_repo_label;
22  
23 2 REPO: for my $repo ( $self->active_repos ) {
24 8 ▶ next REPO unless $repo->type eq 'git';
Branch: 1 branch
BranchTrueFalseTotal
unless $repo->type eq "git" 0 8 8
25 8 ▶ try {
Subroutine __ANON__: called CC=3 SCAR=11.0
26 8 ▶ printf "%3d) %-${max_len}s : ", $repo->number , $repo->label unless $self->quiet;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->quiet 4 4 8
27 # really wish this gave _some_ kind of output...
28 8 $repo->gc;
29 8 ▶ printf "%s\n", $self->major_change( 'COLLECTED' ) unless $self->quiet;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->quiet 4 4 8
30 }
31 0 ▶ catch {
Subroutine __ANON__: not called CC=1 SCAR=6.9
32 0 say STDERR $self->error( 'ERROR: Problem with GC on repo ' , $repo->label );
33 0 say STDERR "\n" , Dumper $_;
34 8 };
35 }
36 }
37  
38 16 1;
39  
40 ## FIXME docs
41  
42 __END__
« GitGot/Command/do.pm ↑ Summary GitGot/Repositories.pm »