summaryrefslogtreecommitdiff
path: root/app/services/validate_new_branch_service.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/services/validate_new_branch_service.rb')
-rw-r--r--app/services/validate_new_branch_service.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/app/services/validate_new_branch_service.rb b/app/services/validate_new_branch_service.rb
index c19e2ec2043..3f4a59e5cee 100644
--- a/app/services/validate_new_branch_service.rb
+++ b/app/services/validate_new_branch_service.rb
@@ -3,14 +3,14 @@
require_relative 'base_service'
class ValidateNewBranchService < BaseService
- def execute(branch_name)
+ def execute(branch_name, force: false)
valid_branch = Gitlab::GitRefValidator.validate(branch_name)
unless valid_branch
return error('Branch name is invalid')
end
- if project.repository.branch_exists?(branch_name)
+ if project.repository.branch_exists?(branch_name) && !force
return error('Branch already exists')
end