diff options
-rw-r--r-- | Changes | 1 | ||||
-rw-r--r-- | lib/API/GitForge/GitLab.pm | 13 |
2 files changed, 12 insertions, 2 deletions
@@ -1,6 +1,7 @@ Revision history for API::GitForge {{$NEXT}} + - Implement API::GitForge::GitLab::_ensure_repo(). - Add git repo metadata to dist.ini. - Don't disable merge requests in GitLab clean forks. Otherwise we can't submit merge requests upstream. diff --git a/lib/API/GitForge/GitLab.pm b/lib/API/GitForge/GitLab.pm index f4baaad..3f38bf7 100644 --- a/lib/API/GitForge/GitLab.pm +++ b/lib/API/GitForge/GitLab.pm @@ -111,8 +111,17 @@ sub _clean_config_fork { } sub _ensure_repo { - # TODO - die "unimplemented"; + my ($self, $target) = @_; + my ($ns, $repo) = _extract_project_id($target); + + # first we are required to get the namespace id + 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} }); } sub _nuke_fork { |