Commit 44374434 authored by Matija Čupić's avatar Matija Čupić

Conditionally assign ref_name for more efficiency

parent 86c0558c
...@@ -1741,7 +1741,11 @@ class Project < ActiveRecord::Base ...@@ -1741,7 +1741,11 @@ class Project < ActiveRecord::Base
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
ref_name = Gitlab::Git.ref_name(resolved_ref) ref_name = if resolved_ref == ref
Gitlab::Git.ref_name(resolved_ref)
else
ref
end
if Gitlab::Git.branch_ref?(resolved_ref) if Gitlab::Git.branch_ref?(resolved_ref)
ProtectedBranch.protected?(self, ref_name) ProtectedBranch.protected?(self, ref_name)
......
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