fn absolute_submodule_url<'s>(
base_url: &str,
submodule_url: &'s str,
) -> CargoResult<Cow<'s, str>>
Expand description
Constructs an absolute URL for a child submodule URL with its parent base URL.
Git only assumes a submodule URL is a relative path if it starts with ./
or ../
1. To fetch the correct repo, we need to construct an absolute
submodule URL.
At this moment it comes with some limitations:
- GitHub doesn’t accept non-normalized URLs with relative paths.
(
ssh://git@github.com/rust-lang/cargo.git/relative/..
is invalid) url
crate cannot parse SCP-like URLs. (git@github.com:rust-lang/cargo.git
is not a valid WHATWG URL)
To overcome these, this patch always tries Url::parse
first to normalize
the path. If it couldn’t, append the relative path as the last resort and
pray the remote git service supports non-normalized URLs.
See also rust-lang/cargo#12404 and rust-lang/cargo#12295.