diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-29 15:09:08 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-29 15:09:08 +0300 |
commit | 7cc6872401eb487ed20dbb9d455f8bb9c97d9e39 (patch) | |
tree | 63f6ed5d4e6c5cec31c43363626d9f5b178eddf8 /app/models/project.rb | |
parent | 46b10c0fc884400941c17e2777b242ac54d111e5 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/project.rb')
-rw-r--r-- | app/models/project.rb | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/app/models/project.rb b/app/models/project.rb index f8c201d73e5..3aa8430f3a2 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -1068,12 +1068,19 @@ class Project < ApplicationRecord end end - def to_reference_with_postfix - "#{to_reference(full: true)}#{self.class.reference_postfix}" + # Produce a valid reference (see Referable#to_reference) + # + # NB: For projects, all references are 'full' - i.e. they all include the + # full_path, rather than just the project name. For this reason, we ignore + # the value of `full:` passed to this method, which is part of the Referable + # interface. + def to_reference(from = nil, full: false) + base = to_reference_base(from, full: true) + "#{base}#{self.class.reference_postfix}" end # `from` argument can be a Namespace or Project. - def to_reference(from = nil, full: false) + def to_reference_base(from = nil, full: false) if full || cross_namespace_reference?(from) full_path elsif cross_project_reference?(from) |