summaryrefslogtreecommitdiff
path: root/lib/API/GitForge/GitLab.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/API/GitForge/GitLab.pm')
-rw-r--r--lib/API/GitForge/GitLab.pm13
1 files changed, 11 insertions, 2 deletions
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 {