diff options
author | Robert Speicher <robert@gitlab.com> | 2016-05-05 18:35:24 +0000 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2016-05-05 18:35:24 +0000 |
commit | 56c49f4fb50b3b1fe170c93d8a0f67ec4e32888f (patch) | |
tree | 2ea437d57f2834b568f68b6052284c47af3313b8 | |
parent | e1c11241f46ec56ef47ca6aa47d4c1d1118ee1a2 (diff) | |
parent | 003671207db67eee5f3ceb605a061346dfad945d (diff) | |
download | gitlab-ce-56c49f4fb50b3b1fe170c93d8a0f67ec4e32888f.tar.gz |
Merge branch 'tag-exists' into 'master'
Use tag_exists? in GitAccess#protected_tag?
This will fail until https://gitlab.com/gitlab-org/gitlab_git/merge_requests/81/ is merged. Adding this should speed up checking for tags in `Gitlab::GitAccess` as it no longer needs to retrieve the entire list of tags.
See https://gitlab.com/gitlab-org/gitlab-ce/issues/14280 for more information.
See merge request !3983
-rw-r--r-- | CHANGELOG | 2 | ||||
-rw-r--r-- | Gemfile.lock | 2 | ||||
-rw-r--r-- | lib/gitlab/git_access.rb | 4 |
3 files changed, 5 insertions, 3 deletions
diff --git a/CHANGELOG b/CHANGELOG index 5469723beca..769ffb2476a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -3,6 +3,8 @@ Please view this file on the master branch, on stable branches it's out of date. v 8.8.0 (unreleased) - Project#open_branches has been cleaned up and no longer loads entire records into memory. - Log to application.log when an admin starts and stops impersonating a user + - Updated gitlab_git to 10.1.0 + - GitAccess#protected_tag? no longer loads all tags just to check if a single one exists - Make build status canceled if any of the jobs was canceled and none failed - Upgrade Sidekiq to 4.1.2 - Sanitize repo paths in new project error message diff --git a/Gemfile.lock b/Gemfile.lock index a8f7bfe43ba..fe083c2b566 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -353,7 +353,7 @@ GEM posix-spawn (~> 0.3) gitlab_emoji (0.3.1) gemojione (~> 2.2, >= 2.2.1) - gitlab_git (10.0.2) + gitlab_git (10.1.0) activesupport (~> 4.0) charlock_holmes (~> 0.7.3) github-linguist (~> 4.7.0) diff --git a/lib/gitlab/git_access.rb b/lib/gitlab/git_access.rb index 3ed1eec517c..6cb41239871 100644 --- a/lib/gitlab/git_access.rb +++ b/lib/gitlab/git_access.rb @@ -128,7 +128,7 @@ module Gitlab action = if project.protected_branch?(branch_name(ref)) protected_branch_action(oldrev, newrev, branch_name(ref)) - elsif protected_tag?(tag_name(ref)) + elsif (tag_ref = tag_name(ref)) && protected_tag?(tag_ref) # Prevent any changes to existing git tag unless user has permissions :admin_project else @@ -176,7 +176,7 @@ module Gitlab end def protected_tag?(tag_name) - project.repository.tag_names.include?(tag_name) + project.repository.tag_exists?(tag_name) end def user_allowed? |