Skip to content

Commit f3edba9

Browse files
committed
test(git): added tests for issue #14621
1 parent d8cb5fb commit f3edba9

File tree

1 file changed

+78
-0
lines changed

1 file changed

+78
-0
lines changed

tests/testsuite/git.rs

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4052,6 +4052,84 @@ src/lib.rs
40524052
.run();
40534053
}
40544054

4055+
#[cargo_test(public_network_test, requires_git)]
4056+
fn github_fastpath_error_message() {
4057+
let p = project()
4058+
.file(
4059+
"Cargo.toml",
4060+
r#"
4061+
[package]
4062+
name = "foo"
4063+
version = "0.1.0"
4064+
edition = "2015"
4065+
4066+
[dependencies]
4067+
bitflags = { git = "https://github.com/rust-lang/bitflags.git", rev="11111b376b93484341c68fbca3ca110ae5cd2790" }
4068+
"#,
4069+
)
4070+
.file("src/lib.rs", "")
4071+
.build();
4072+
p.cargo("fetch")
4073+
.env("CARGO_NET_GIT_FETCH_WITH_CLI", "true")
4074+
.with_status(101)
4075+
.with_stderr_data(str![[r#"
4076+
[UPDATING] git repository `https://github.com/rust-lang/bitflags.git`
4077+
fatal: remote [ERROR] upload-pack: not our ref 11111b376b93484341c68fbca3ca110ae5cd2790
4078+
[ERROR] failed to get `bitflags` as a dependency of package `foo v0.1.0 ([ROOT]/foo)`
4079+
4080+
Caused by:
4081+
failed to load source for dependency `bitflags`
4082+
4083+
Caused by:
4084+
Unable to update https://github.com/rust-lang/bitflags.git?rev=11111b376b93484341c68fbca3ca110ae5cd2790
4085+
4086+
Caused by:
4087+
failed to clone into: [ROOT]/home/.cargo/git/db/bitflags-[HASH]
4088+
4089+
Caused by:
4090+
process didn't exit successfully: `git fetch --no-tags --force --update-head-ok 'https://github.com/rust-lang/bitflags.git' '+11111b376b93484341c68fbca3ca110ae5cd2790:refs/commit/11111b376b93484341c68fbca3ca110ae5cd2790'` ([EXIT_STATUS]: 128)
4091+
4092+
"#]])
4093+
.run();
4094+
}
4095+
4096+
#[cargo_test(public_network_test)]
4097+
fn git_fetch_libgit2_error_message() {
4098+
let p = project()
4099+
.file(
4100+
"Cargo.toml",
4101+
r#"
4102+
[package]
4103+
name = "foo"
4104+
version = "0.1.0"
4105+
edition = "2015"
4106+
4107+
[dependencies]
4108+
bitflags = { git = "https://github.com/rust-lang/bitflags.git", rev="11111b376b93484341c68fbca3ca110ae5cd2790" }
4109+
"#,
4110+
)
4111+
.file("src/lib.rs", "")
4112+
.build();
4113+
p.cargo("fetch")
4114+
.with_status(101)
4115+
.with_stderr_data(str![[r#"
4116+
[UPDATING] git repository `https://github.com/rust-lang/bitflags.git`
4117+
...
4118+
[ERROR] failed to get `bitflags` as a dependency of package `foo v0.1.0 ([ROOT]/foo)`
4119+
4120+
Caused by:
4121+
failed to load source for dependency `bitflags`
4122+
4123+
Caused by:
4124+
Unable to update https://github.com/rust-lang/bitflags.git?rev=11111b376b93484341c68fbca3ca110ae5cd2790
4125+
4126+
Caused by:
4127+
failed to clone into: [ROOT]/home/.cargo/git/db/bitflags-[HASH]
4128+
...
4129+
"#]])
4130+
.run();
4131+
}
4132+
40554133
#[cargo_test]
40564134
fn git_worktree_with_bare_original_repo() {
40574135
let project = project().build();

0 commit comments

Comments
 (0)