Skip to content

Commit e40504d

Browse files
committed
test(add): add test to show current behaviour of cargo install when git rev is in url
1 parent 6cba807 commit e40504d

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

tests/testsuite/install.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2169,6 +2169,33 @@ fn git_install_reads_workspace_manifest() {
21692169
.run();
21702170
}
21712171

2172+
#[cargo_test]
2173+
fn install_git_with_rev_in_url() {
2174+
let p = git::repo(&paths::root().join("foo"))
2175+
.file("Cargo.toml", &basic_manifest("foo", "0.1.0"))
2176+
.file("src/main.rs", "fn main() {}")
2177+
.build();
2178+
2179+
let mut url = p.url().to_string();
2180+
url.push_str("#0e8d88b5cfc173c5f5a6a0fe0ce1d4e6018600d4");
2181+
2182+
cargo_process("install --locked --git")
2183+
.arg(url.to_string())
2184+
.with_stderr_data(str![[r#"
2185+
[UPDATING] git repository `[ROOTURL]/foo#0e8d88b5cfc173c5f5a6a0fe0ce1d4e6018600d4`
2186+
[WARNING] spurious network error (3 tries remaining): failed to resolve path '[ROOT]/foo#0e8d88b5cfc173c5f5a6a0fe0ce1d4e6018600d4': No such file or directory; class=Os (2)
2187+
[WARNING] spurious network error (2 tries remaining): failed to resolve path '[ROOT]/foo#0e8d88b5cfc173c5f5a6a0fe0ce1d4e6018600d4': No such file or directory; class=Os (2)
2188+
[WARNING] spurious network error (1 try remaining): failed to resolve path '[ROOT]/foo#0e8d88b5cfc173c5f5a6a0fe0ce1d4e6018600d4': No such file or directory; class=Os (2)
2189+
[ERROR] failed to clone into: [ROOT]/home/.cargo/git/db/foo-[HASH]
2190+
2191+
Caused by:
2192+
failed to resolve path '[ROOT]/foo#0e8d88b5cfc173c5f5a6a0fe0ce1d4e6018600d4': No such file or directory; class=Os (2)
2193+
2194+
"#]])
2195+
.with_status(101)
2196+
.run();
2197+
}
2198+
21722199
#[cargo_test]
21732200
fn install_git_with_symlink_home() {
21742201
// Ensure that `cargo install` with a git repo is OK when CARGO_HOME is a

0 commit comments

Comments
 (0)