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>2022-09-30 00:08:27 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-09-30 00:08:27 +0300
commit836ddfc35d1778675b3bd6d51f51972f36a96bbe (patch)
treebc1c0247c76a2cbdbab94b3884bc040b179f41fe /lib/gitlab/checks
parent488e1b59feb4314b034636990bcc4e220e61f0ce (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/checks')
-rw-r--r--lib/gitlab/checks/tag_check.rb13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/gitlab/checks/tag_check.rb b/lib/gitlab/checks/tag_check.rb
index 5dd7720b67d..007a775eaf5 100644
--- a/lib/gitlab/checks/tag_check.rb
+++ b/lib/gitlab/checks/tag_check.rb
@@ -9,11 +9,13 @@ module Gitlab
delete_protected_tag: 'You are not allowed to delete protected tags from this project. '\
'Only a project maintainer or owner can delete a protected tag.',
delete_protected_tag_non_web: 'You can only delete protected tags using the web interface.',
- create_protected_tag: 'You are not allowed to create this tag as it is protected.'
+ create_protected_tag: 'You are not allowed to create this tag as it is protected.',
+ default_branch_collision: 'You cannot use default branch name to create a tag'
}.freeze
LOG_MESSAGES = {
tag_checks: "Checking if you are allowed to change existing tags...",
+ default_branch_collision_check: "Checking if you are providing a valid tag name...",
protected_tag_checks: "Checking if you are creating, updating or deleting a protected tag..."
}.freeze
@@ -26,6 +28,7 @@ module Gitlab
end
end
+ default_branch_collision_check
protected_tag_checks
end
@@ -52,6 +55,14 @@ module Gitlab
end
end
end
+
+ def default_branch_collision_check
+ logger.log_timed(LOG_MESSAGES[:default_branch_collision_check]) do
+ if creation? && tag_name == project.default_branch
+ raise GitAccess::ForbiddenError, ERROR_MESSAGES[:default_branch_collision]
+ end
+ end
+ end
end
end
end