diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2020-03-10 09:05:43 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2020-03-10 09:05:43 -0700 |
commit | 68c29d68184b93fda6fa8ca2741114859693aa0e (patch) | |
tree | 1cd5afc0ece6efa986e9b6b7a5f88640894f6f91 /lib/API/GitForge/GitLab.pm | |
parent | 89c554cf3eb44ef1a002fbc077250e26fb2a0aa3 (diff) | |
download | p5-API-GitForge-68c29d68184b93fda6fa8ca2741114859693aa0e.tar.gz |
try to unprotect fork branches before deleting them
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'lib/API/GitForge/GitLab.pm')
-rw-r--r-- | lib/API/GitForge/GitLab.pm | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/API/GitForge/GitLab.pm b/lib/API/GitForge/GitLab.pm index 2091cfc..1e620d8 100644 --- a/lib/API/GitForge/GitLab.pm +++ b/lib/API/GitForge/GitLab.pm @@ -128,6 +128,14 @@ sub _nuke_fork { $self->{_api}->delete_project("$user/$repo"); } +sub _ensure_fork_branch_unprotected { + my ($self, $upstream, $branch) = @_; + my (undef, $repo) = _extract_project_id($upstream); + my $user = $self->{_api}->current_user->{username}; + return unless $self->{_api}->protected_branch("$user/$repo", $branch); + $self->{_api}->unprotect_branch("$user/$repo", $branch); +} + sub _extract_project_id { my $project = shift; $project =~ s#(?:\.git)?/?$##; |