Merge branch 'sh-fix-submodules-trailing-spaces' into 'master'
Strip trailing whitespaces in submodule URLs Closes #33018 See merge request !11753
This commit is contained in:
commit
fd2993b534
3 changed files with 10 additions and 0 deletions
|
@ -13,6 +13,7 @@ module SubmoduleHelper
|
|||
|
||||
if url =~ /([^\/:]+)\/([^\/]+(?:\.git)?)\Z/
|
||||
namespace, project = $1, $2
|
||||
project.rstrip!
|
||||
project.sub!(/\.git\z/, '')
|
||||
|
||||
if self_url?(url, namespace, project)
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
title: Strip trailing whitespaces in submodule URLs
|
||||
merge_request:
|
||||
author:
|
|
@ -115,6 +115,11 @@ describe SubmoduleHelper do
|
|||
expect(submodule_links(submodule_item)).to eq(['https://gitlab.com/gitlab-org/gitlab-ce', 'https://gitlab.com/gitlab-org/gitlab-ce/tree/hash'])
|
||||
end
|
||||
|
||||
it 'handles urls with trailing whitespace' do
|
||||
stub_url('http://gitlab.com/gitlab-org/gitlab-ce.git ')
|
||||
expect(submodule_links(submodule_item)).to eq(['https://gitlab.com/gitlab-org/gitlab-ce', 'https://gitlab.com/gitlab-org/gitlab-ce/tree/hash'])
|
||||
end
|
||||
|
||||
it 'returns original with non-standard url' do
|
||||
stub_url('http://gitlab.com/another/gitlab-org/gitlab-ce.git')
|
||||
expect(submodule_links(submodule_item)).to eq([repo.submodule_url_for, nil])
|
||||
|
|
Loading…
Reference in a new issue