diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-20 17:22:11 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-20 17:22:11 +0300 |
commit | 0c872e02b2c822e3397515ec324051ff540f0cd5 (patch) | |
tree | ce2fb6ce7030e4dad0f4118d21ab6453e5938cdd /lib/extracts_ref.rb | |
parent | f7e05a6853b12f02911494c4b3fe53d9540d74fc (diff) |
Add latest changes from gitlab-org/gitlab@15-7-stable-eev15.7.0-rc42
Diffstat (limited to 'lib/extracts_ref.rb')
-rw-r--r-- | lib/extracts_ref.rb | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/extracts_ref.rb b/lib/extracts_ref.rb index 9799116038e..f22996df0a5 100644 --- a/lib/extracts_ref.rb +++ b/lib/extracts_ref.rb @@ -64,10 +64,16 @@ module ExtractsRef def assign_ref_vars @id, @ref, @path = extract_ref_path @repo = repository_container.repository - raise InvalidPathError if @ref.match?(/\s/) - @commit = @repo.commit(@ref) if @ref.present? + return unless @ref.present? + + @commit = if ref_type && Feature.enabled?(:use_ref_type_parameter, @repo.project) + @fully_qualified_ref = %(refs/#{ref_type}/#{@ref}) + @repo.commit(@fully_qualified_ref) + else + @repo.commit(@ref) + end end # rubocop:enable Gitlab/ModuleWithInstanceVariables @@ -82,6 +88,12 @@ module ExtractsRef [id, ref, path] end + def ref_type + return unless params[:ref_type].present? + + params[:ref_type] == 'tags' ? 'tags' : 'heads' + end + private def extract_raw_ref(id) |