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.336';
4             # ABSTRACT: Run the 'gc' command to garbage collect in git repos
5 15     15   8486 use 5.014;
  15         46  
6              
7 15     15   7667 use Data::Dumper;
  15         81558  
  15         857  
8 15     15   96 use Try::Tiny;
  15         28  
  15         617  
9              
10 15     15   80 use Moo;
  15         28  
  15         74  
11             extends 'App::GitGot::Command';
12 15     15   4105 use namespace::autoclean;
  15         28  
  15         77  
13              
14             # incremental output looks nicer for this command...
15             STDOUT->autoflush(1);
16 2     2   7 sub _use_io_page { 0 }
17              
18             sub _execute {
19 2     2   6 my( $self, $opt, $args ) = @_;
20              
21 2         11 my $max_len = $self->max_length_of_an_active_repo_label;
22              
23 2         31 REPO: for my $repo ( $self->active_repos ) {
24 8 50       331 next REPO unless $repo->type eq 'git';
25             try {
26 8 100   8   483 printf "%3d) %-${max_len}s : ", $repo->number , $repo->label unless $self->quiet;
27             # really wish this gave _some_ kind of output...
28 8         406 $repo->gc;
29 8 100       140 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         64 };
35             }
36             }
37              
38             1;
39              
40             ## FIXME docs
41              
42             __END__