summaryrefslogtreecommitdiff
path: root/lib/api/protected_branches.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/api/protected_branches.rb')
-rw-r--r--lib/api/protected_branches.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/api/protected_branches.rb b/lib/api/protected_branches.rb
index 33dea25289a..ca75ee906ce 100644
--- a/lib/api/protected_branches.rb
+++ b/lib/api/protected_branches.rb
@@ -59,6 +59,7 @@ module API
# rubocop: disable CodeReuse/ActiveRecord
post ':id/protected_branches' do
protected_branch = user_project.protected_branches.find_by(name: params[:name])
+
if protected_branch
conflict!("Protected branch '#{params[:name]}' already exists")
end