Skip to content

Commit

Permalink
Better filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanwills-optus committed Jan 31, 2020
1 parent ebc3fe1 commit d080d61
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/Group/Git/Stash.pm
Expand Up @@ -43,7 +43,7 @@ sub _mech {
cache => CHI->new(
driver => 'File',
root_dir => $self->conf->{cache_dir},
expires_in => '30 min',
expires_in => '60 min',
),
);
}
Expand Down Expand Up @@ -76,9 +76,14 @@ sub _repos {
my $start = 0;
my $more = 1;
@ARGV = @argv;
my %exclude = map {$_ => 1} @{ $self->{conf}{'exclude-tags'} || [] };

while ($more) {
$mech->get( $url . $start );
if ( $mech->status != 200 ) {
warn 'Error (', $mech->status, ") accessing $url$start\n";
last;
}
my $response = eval { decode_json $mech->content };
if ( !$response ) {
die $@ || "Error occured processing stash server response\n";
Expand All @@ -96,6 +101,8 @@ sub _repos {
my ($dir) = $self->recurse ? $git =~ m{([^/]+/[^/]+?)(?:[.]git)?$} : $git =~ m{/([^/]+?)(?:[.]git)?$};
my $name = $self->recurse ? path("$project/$repo->{name}") : path($repo->{name});
$dir =~ s/^~//xms;
next if $exclude{$repo->{project}{owner} ? 'personal' : 'project'};
next if $self->{conf}{skip} && $project =~ /$self->{conf}{skip}/;

$repos{$dir} = Group::Git::Repo->new(
name => path($dir),
Expand All @@ -116,7 +123,7 @@ sub _repos {
push @{ $conf->{tags}{project} }, "$dir";
}
}
$more = !$response->{isLastPage};
last if $response->{isLastPage};
$start = $response->{nextPageStart};
}

Expand Down

0 comments on commit d080d61

Please sign in to comment.