diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-30 02:58:28 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-30 02:58:28 +0300 |
commit | 6cf208f33ad87d199cb9b50fd0b29cf243155f90 (patch) | |
tree | b147a9f37a90d9b8c2057e938f8fb1596c51bb55 /lib | |
parent | dd45a03c04b9cc91cd761bf2e94644ee92f2a8f6 (diff) |
Add latest changes from gitlab-org/security/gitlab@15-10-stable-ee
Diffstat (limited to 'lib')
-rw-r--r-- | lib/extracts_ref.rb | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/lib/extracts_ref.rb b/lib/extracts_ref.rb index 49c9772f760..dba1aad639c 100644 --- a/lib/extracts_ref.rb +++ b/lib/extracts_ref.rb @@ -5,8 +5,7 @@ # Can be extended for different types of repository object, e.g. Project or Snippet module ExtractsRef InvalidPathError = Class.new(StandardError) - BRANCH_REF_TYPE = 'heads' - TAG_REF_TYPE = 'tags' + # Given a string containing both a Git tree-ish, such as a branch or tag, and # a filesystem path joined by forward slashes, attempts to separate the two. # @@ -92,7 +91,7 @@ module ExtractsRef def ref_type return unless params[:ref_type].present? - params[:ref_type] == TAG_REF_TYPE ? TAG_REF_TYPE : BRANCH_REF_TYPE + params[:ref_type] == 'tags' ? 'tags' : 'heads' end private @@ -155,13 +154,4 @@ module ExtractsRef def repository_container raise NotImplementedError end - - def ambiguous_ref?(project, ref) - return true if project.repository.ambiguous_ref?(ref) - - return false unless ref&.starts_with?('refs/') - - unprefixed_ref = ref.sub(%r{^refs/(heads|tags)/}, '') - project.repository.commit(unprefixed_ref).present? - end end |