Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/git_nested/submodules.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ def resolve(url: str, base: str) -> str:
if not url.startswith(('./', '../')):
return url
scheme, sep, rest = base.rpartition('://')
if not sep:
# A local path. On Windows it may have backslashes, which posixpath takes as part of a name.
rest = rest.replace('\\', '/')
return f'{scheme}{sep}{posixpath.normpath(posixpath.join(rest, url))}'


Expand Down
1 change: 1 addition & 0 deletions tests/unit/test_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ def test_gitnested_is_written_with_lf(tmp_path):
('./foo.git', '/srv/git/bar.git', '/srv/git/bar.git/foo.git'),
('../foo.git', 'https://example.com/group/bar.git', 'https://example.com/group/foo.git'),
('https://example.com/x.git', '/srv/git/bar.git', 'https://example.com/x.git'),
('../foo', 'D:\\a\\upstream\\bar', 'D:/a/upstream/foo'),
],
)
def test_a_relative_submodule_url_is_resolved_like_git_does(url, base, resolved):
Expand Down
Loading