mirror of
https://gerrit.googlesource.com/git-repo
synced 2025-06-26 20:17:52 +00:00
Correctly handle schema-less URIs for remote fetch URL
Currently we don't deal with schema-less URIs like `git@github.com:foo` at all resulting in a scenario where we append them to the manifest repo URL. In order to deal with this, we munge both the manifest URL and the fetch URL into a format we like and proceed with that. Bug: https://g-issues.gerritcodereview.com/issues/40010331 Change-Id: I7b79fc4ed276630fdbeb235b94e327b172f0879b Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/386954 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Michael Kelly <mkelly@arista.com> Commit-Queue: Mike Frysinger <vapier@google.com>
This commit is contained in:
@ -1128,3 +1128,32 @@ class ExtendProjectElementTests(ManifestParseTestCase):
|
||||
)
|
||||
self.assertEqual(len(manifest.projects), 1)
|
||||
self.assertEqual(manifest.projects[0].upstream, "bar")
|
||||
|
||||
|
||||
class NormalizeUrlTests(ManifestParseTestCase):
|
||||
"""Tests for normalize_url() in manifest_xml.py"""
|
||||
|
||||
def test_has_trailing_slash(self):
|
||||
url = "http://foo.com/bar/baz/"
|
||||
self.assertEqual(
|
||||
"http://foo.com/bar/baz", manifest_xml.normalize_url(url)
|
||||
)
|
||||
|
||||
def test_has_no_scheme(self):
|
||||
"""Deal with cases where we have no scheme, but we also
|
||||
aren't dealing with the git SCP-like syntax
|
||||
"""
|
||||
url = "foo.com/baf/bat"
|
||||
self.assertEqual(url, manifest_xml.normalize_url(url))
|
||||
|
||||
url = "git@foo.com/baf/bat"
|
||||
self.assertEqual(url, manifest_xml.normalize_url(url))
|
||||
|
||||
url = "/file/path/here"
|
||||
self.assertEqual(url, manifest_xml.normalize_url(url))
|
||||
|
||||
def test_has_no_scheme_matches_scp_like_syntax(self):
|
||||
url = "git@foo.com:bar/baf"
|
||||
self.assertEqual(
|
||||
"ssh://git@foo.com/bar/baf", manifest_xml.normalize_url(url)
|
||||
)
|
||||
|
Reference in New Issue
Block a user