Commit 8ef91a0a authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'dz-fix-extract-path' into 'master'

Improve ExtractsPath logic related to atom format

* Fixes one test from https://gitlab.com/gitlab-org/gitlab-ce/issues/23378. 
* Fixes issue introduced by https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/6750.

See merge request !6907
parents 808c6aaf d60d5fe4
......@@ -113,17 +113,18 @@ module ExtractsPath
@id = get_id
@ref, @path = extract_ref(@id)
@repo = @project.repository
if @options[:extended_sha1].blank?
@commit = @repo.commit(@ref)
else
@commit = @repo.commit(@options[:extended_sha1])
end
if @path.empty? && !@commit
@id = @ref = extract_ref_without_atom(@id)
if @options[:extended_sha1].present?
@commit = @repo.commit(@options[:extended_sha1])
else
@commit = @repo.commit(@ref)
request.format = :atom if @commit
if @path.empty? && !@commit && @id.ends_with?('.atom')
@id = @ref = extract_ref_without_atom(@id)
@commit = @repo.commit(@ref)
request.format = :atom if @commit
end
end
raise InvalidPathError unless @commit
......
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