diff options
-rw-r--r-- | Changes | 2 | ||||
-rw-r--r-- | lib/API/GitForge/GitLab.pm | 6 |
2 files changed, 3 insertions, 5 deletions
@@ -1,6 +1,8 @@ Revision history for API::GitForge {{$NEXT}} + - API::GitForge::GitLab::_ensure_repo(): avoid an unnecessary API + call. 0.002 2020-03-09 12:17:47-07:00 America/Phoenix - Implement API::GitForge::GitLab::_ensure_repo(). diff --git a/lib/API/GitForge/GitLab.pm b/lib/API/GitForge/GitLab.pm index 3f38bf7..2091cfc 100644 --- a/lib/API/GitForge/GitLab.pm +++ b/lib/API/GitForge/GitLab.pm @@ -113,13 +113,9 @@ sub _clean_config_fork { sub _ensure_repo { my ($self, $target) = @_; my ($ns, $repo) = _extract_project_id($target); - - # first we are required to get the namespace id + return if $self->{_api}->project($target); my $namespace = $self->{_api}->namespace($ns) or croak "invalid project namespace $ns"; - - # now create the project unless it already exists - return if $self->{_api}->project($target); $self->{_api} ->create_project({ name => $repo, namespace_id => $namespace->{id} }); } |