-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Description
Problem
When using a Git submodule that uses the SSH protocol, Git allows the ssh://
to be omitted and the URL to be provided in a form such as git@github.com:...
. Previously this worked fine with Cargo, but since some changes a couple of weeks ago related to handling submodules this seems to no longer work. I instead get an error such as the following:
Caused by:
failed to load source for dependency `<redacted>`
Caused by:
Unable to update ssh://git@github.com/<redacted>
Caused by:
failed to update submodule `<redacted>`
Caused by:
failed to parse url for submodule `<redacted>`: `git@github.com:<redacted>.git`
Caused by:
relative URL without a base
As you can see it's failing to parse the git@github.com:...
URL, it seems to think it's a relative URL, but it is not a relative URL, it is an absolute URL which doesn't specify the ssh://
protocol, which is a valid Git submodule URL, so should be supported.
I am already using git-fetch-with-cli = true
in my .cargo/config.toml
file to fix other issues with using SSH authentication to private repositories, but it doesn't seem to fix this issue.
Steps
- Create a crate which contains a submodule which uses an SSH URL that omits the
ssh://
prefix. - Depend on that crate from another crate.
- Try to build this latter crate.
Possible Solution(s)
Any parsing of a Git submodule URL should allow the protocol to be omitted. It may be the call to Url::parse()
added in the commit 2717a34 which has triggered this, so possibly revert that particular part of the change to use the string verbatim without parsing, as was done before.
Notes
No response
Version
Fails using nightly-2023-06-11
or onwards, nightly-2023-06-10
does not exhibit this issue. The version output on the earliest failing version is:
cargo 1.72.0-nightly (49b6d9e17 2023-06-09)
release: 1.72.0-nightly
commit-hash: 49b6d9e179a91cf7645142541c9563443f64bf2b
commit-date: 2023-06-09
host: x86_64-unknown-linux-gnu
libgit2: 1.6.4 (sys:0.17.1 vendored)
libcurl: 8.1.2-DEV (sys:0.4.63+curl-8.1.2 vendored ssl:OpenSSL/1.1.1t)
ssl: OpenSSL 1.1.1t 7 Feb 2023
os: Ubuntu 22.04 (jammy) [64-bit]