File Coverage

blib/lib/App/GitGot/Command/readd.pm
Criterion Covered Total %
statement 14 29 48.2
branch 0 8 0.0
condition n/a
subroutine 5 8 62.5
pod 0 1 0.0
total 19 46 41.3


line stmt bran cond sub pod time code
1             package App::GitGot::Command::readd;
2             our $AUTHORITY = 'cpan:GENEHACK';
3             $App::GitGot::Command::readd::VERSION = '1.339';
4             # ABSTRACT: update config metadata to match repo
5 15     15   9589 use 5.014;
  15         59  
6              
7 15     15   118 use App::GitGot -command;
  15         39  
  15         127  
8 15     15   5380 use App::GitGot::Repo::Git;
  15         37  
  15         449  
9              
10 15     15   93 use Moo;
  15         46  
  15         114  
11             extends 'App::GitGot::Command';
12 15     15   4843 use namespace::autoclean;
  15         40  
  15         110  
13              
14             sub options {
15 0     0 0   my( $class , $app ) = @_;
16 0           return ();
17             }
18              
19 0     0     sub _use_io_page { 0 }
20              
21             sub _execute {
22 0     0     my ( $self, $opt, $args ) = @_;
23              
24 0           my $max_len = $self->max_length_of_an_active_repo_label();
25 0           my $updated_config = 0;
26              
27 0           REPO: for my $repo ( $self->active_repos ) {
28 0 0         next unless $repo->type eq 'git';
29              
30 0           my $configuration_url = $repo->repo;
31 0           my( $repo_url ) = $repo->config("remote.origin.url");
32              
33 0 0         if( $configuration_url ne $repo_url ) {
34             # do as i say, not as i do...
35 0           $repo->{repo} = $repo_url;
36 0           $updated_config = 1;
37              
38 0 0         printf "Updated repo url for %-${max_len}s to %s\n", $repo->name, $repo->repo
39             if $self->verbose;
40             }
41             }
42              
43             $self->write_config()
44 0 0         if $updated_config;
45             }
46              
47             1;
48              
49             __END__