File Coverage

blib/lib/App/GitGot/Command/gc.pm
Criterion Covered Total %
statement 23 25 92.0
branch 5 6 83.3
condition n/a
subroutine 8 9 88.8
pod n/a
total 36 40 90.0


line stmt bran cond sub pod time code
1             package App::GitGot::Command::gc;
2             our $AUTHORITY = 'cpan:GENEHACK';
3             $App::GitGot::Command::gc::VERSION = '1.339';
4             # ABSTRACT: Run the 'gc' command to garbage collect in git repos
5 15     15   13455 use 5.014;
  15         64  
6              
7 15     15   10637 use Data::Dumper;
  15         108320  
  15         1395  
8 15     15   177 use Try::Tiny;
  15         40  
  15         867  
9              
10 15     15   107 use Moo;
  15         46  
  15         126  
11             extends 'App::GitGot::Command';
12 15     15   6215 use namespace::autoclean;
  15         36  
  15         132  
13              
14             # incremental output looks nicer for this command...
15             STDOUT->autoflush(1);
16 2     2   10 sub _use_io_page { 0 }
17              
18             sub _execute {
19 2     2   10 my( $self, $opt, $args ) = @_;
20              
21 2         14 my $max_len = $self->max_length_of_an_active_repo_label;
22              
23 2         43 REPO: for my $repo ( $self->active_repos ) {
24 8 50       417 next REPO unless $repo->type eq 'git';
25             try {
26 8 100   8   545 printf "%3d) %-${max_len}s : ", $repo->number , $repo->label unless $self->quiet;
27             # really wish this gave _some_ kind of output...
28 8         555 $repo->gc;
29 8 100       160 printf "%s\n", $self->major_change( 'COLLECTED' ) unless $self->quiet;
30             }
31             catch {
32 0     0     say STDERR $self->error( 'ERROR: Problem with GC on repo ' , $repo->label );
33 0           say STDERR "\n" , Dumper $_;
34 8         69 };
35             }
36             }
37              
38             1;
39              
40             ## FIXME docs
41              
42             __END__