summaryrefslogtreecommitdiff
path: root/app/models/project.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/project.rb')
-rw-r--r--app/models/project.rb13
1 files changed, 7 insertions, 6 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index fa1820b2bdb..a8bef70f505 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -1739,12 +1739,13 @@ class Project < ActiveRecord::Base
def protected_for?(ref)
return false if ref.nil? || repository.ambiguous_ref?(ref)
- resolved_ref = repository.resolve_ref(ref)
- ref_name = if resolved_ref == ref
- Gitlab::Git.ref_name(resolved_ref)
- else
- ref
- end
+ if Gitlab::Git.branch_ref?(ref) || Gitlab::Git.tag_ref?(ref)
+ resolved_ref = ref
+ ref_name = Gitlab::Git.ref_name(ref)
+ else
+ resolved_ref = repository.expand_ref(ref)
+ ref_name = ref
+ end
if Gitlab::Git.branch_ref?(resolved_ref)
ProtectedBranch.protected?(self, ref_name)