Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-02-01 21:11:40 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-02-01 21:11:40 +0300
commit3bfb19d99e3508b2a42c49d09e5a3236d2ce3a29 (patch)
treedc3a6a664e81caaa99530260ad56821479a8a939 /app/services/security
parent18d5458781b21dee4dbb8854c72c064e9bd808ed (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/security')
-rw-r--r--app/services/security/ci_configuration/base_create_service.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/app/services/security/ci_configuration/base_create_service.rb b/app/services/security/ci_configuration/base_create_service.rb
index aaa850fde39..3e8865d3dff 100644
--- a/app/services/security/ci_configuration/base_create_service.rb
+++ b/app/services/security/ci_configuration/base_create_service.rb
@@ -12,6 +12,16 @@ module Security
end
def execute
+ if project.repository.empty? && !(@params && @params[:initialize_with_sast])
+ docs_link = ActionController::Base.helpers.link_to _('add at least one file to the repository'),
+ Rails.application.routes.url_helpers.help_page_url('user/project/repository/index.md',
+ anchor: 'add-files-to-a-repository'),
+ target: '_blank',
+ rel: 'noopener noreferrer'
+ raise Gitlab::Graphql::Errors::MutationError,
+ _(format('You must %s before using Security features.', docs_link.html_safe)).html_safe
+ end
+
project.repository.add_branch(current_user, branch_name, project.default_branch)
attributes_for_commit = attributes