summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorMatija Čupić <matteeyah@gmail.com>2018-12-03 14:10:42 +0100
committerMatija Čupić <matteeyah@gmail.com>2018-12-08 19:28:58 +0100
commit1b28a2c1a9c9651316997f7e12b161b68001126b (patch)
tree37015a83c6e09d5b2706e1f8cce5ef6d7ca2b452 /app
parent9b4e45c35253a397f3ff79207736280293848bf9 (diff)
downloadgitlab-ce-1b28a2c1a9c9651316997f7e12b161b68001126b.tar.gz
Check resolved_ref before checking if protected
Diffstat (limited to 'app')
-rw-r--r--app/models/project.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index 79414665001..d75fecb5ff2 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -1737,10 +1737,11 @@ class Project < ActiveRecord::Base
end
def protected_for?(ref)
- return false if ref.nil?
raise Repository::AmbiguousRefError if repository.ambiguous_ref?(ref)
resolved_ref = repository.expand_ref(ref) || ref
+ return false unless Gitlab::Git.tag_ref?(resolved_ref) || Gitlab::Git.branch_ref?(resolved_ref)
+
ref_name = if resolved_ref == ref
Gitlab::Git.ref_name(resolved_ref)
else