diff options
Diffstat (limited to 'app/services/security/ci_configuration/base_create_service.rb')
-rw-r--r-- | app/services/security/ci_configuration/base_create_service.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/app/services/security/ci_configuration/base_create_service.rb b/app/services/security/ci_configuration/base_create_service.rb index adb45244adb..ea77cd98ba3 100644 --- a/app/services/security/ci_configuration/base_create_service.rb +++ b/app/services/security/ci_configuration/base_create_service.rb @@ -25,7 +25,7 @@ module Security rescue Gitlab::Git::PreReceiveError => e ServiceResponse.error(message: e.message) rescue StandardError - project.repository.rm_branch(current_user, branch_name) if project.repository.branch_exists?(branch_name) + remove_branch_on_exception raise end @@ -50,6 +50,10 @@ module Security Gitlab::Routing.url_helpers.project_new_merge_request_url(project, merge_request: merge_request_params) end + def remove_branch_on_exception + project.repository.rm_branch(current_user, branch_name) if project.repository.branch_exists?(branch_name) + end + def track_event(attributes_for_commit) action = attributes_for_commit[:actions].first |