Commit 1b28a2c1 authored by Matija Čupić's avatar Matija Čupić

Check resolved_ref before checking if protected

parent 9b4e45c3
...@@ -1737,10 +1737,11 @@ class Project < ActiveRecord::Base ...@@ -1737,10 +1737,11 @@ class Project < ActiveRecord::Base
end end
def protected_for?(ref) def protected_for?(ref)
return false if ref.nil?
raise Repository::AmbiguousRefError if repository.ambiguous_ref?(ref) raise Repository::AmbiguousRefError if repository.ambiguous_ref?(ref)
resolved_ref = repository.expand_ref(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 ref_name = if resolved_ref == ref
Gitlab::Git.ref_name(resolved_ref) Gitlab::Git.ref_name(resolved_ref)
else else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment