diff options
author | Matija Čupić <matteeyah@gmail.com> | 2018-11-30 13:07:55 +0100 |
---|---|---|
committer | Matija Čupić <matteeyah@gmail.com> | 2018-12-08 19:28:57 +0100 |
commit | 44374434b5a0b4297686d5388f1124eda3adcbff (patch) | |
tree | abcc4f134731c9fcd39413e5f9f8b34862e3a887 /app/models/project.rb | |
parent | 86c0558c1c473e26df0a1cd5ea4b647175e8b857 (diff) | |
download | gitlab-ce-44374434b5a0b4297686d5388f1124eda3adcbff.tar.gz |
Conditionally assign ref_name for more efficiency
Diffstat (limited to 'app/models/project.rb')
-rw-r--r-- | app/models/project.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/app/models/project.rb b/app/models/project.rb index 0948e4625a8..79414665001 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -1741,7 +1741,11 @@ class Project < ActiveRecord::Base raise Repository::AmbiguousRefError if repository.ambiguous_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) ProtectedBranch.protected?(self, ref_name) |