mirror of
https://github.com/rust-lang/cargo
synced 2024-10-16 04:32:24 +00:00
Auto merge of #7947 - quark-zju:ignore-broken-git, r=ehuss
Ignore broken Cargo.toml in git sources
Commit 3d6de41774
(#3998) made cargo
ignore Cargo.toml files that are invalid TOML in a git source.
This change further ignores Cargo.toml files that are valid TOML but
cannot really be loaded in a git source.
This is potentially an alternative fix for #6822.
This commit is contained in:
commit
ac2eb69346
|
@ -193,7 +193,26 @@ fn read_nested_packages(
|
||||||
if !source_id.is_registry() {
|
if !source_id.is_registry() {
|
||||||
for p in nested.iter() {
|
for p in nested.iter() {
|
||||||
let path = util::normalize_path(&path.join(p));
|
let path = util::normalize_path(&path.join(p));
|
||||||
read_nested_packages(&path, all_packages, source_id, config, visited, errors)?;
|
let result =
|
||||||
|
read_nested_packages(&path, all_packages, source_id, config, visited, errors);
|
||||||
|
// Ignore broken manifests found on git repositories.
|
||||||
|
//
|
||||||
|
// A well formed manifest might still fail to load due to reasons
|
||||||
|
// like referring to a "path" that requires an extra build step.
|
||||||
|
//
|
||||||
|
// See https://github.com/rust-lang/cargo/issues/6822.
|
||||||
|
if let Err(err) = result {
|
||||||
|
if source_id.is_git() {
|
||||||
|
info!(
|
||||||
|
"skipping nested package found at `{}`: {:?}",
|
||||||
|
path.display(),
|
||||||
|
&err,
|
||||||
|
);
|
||||||
|
errors.push(err);
|
||||||
|
} else {
|
||||||
|
return Err(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -323,6 +323,16 @@ fn cargo_compile_with_malformed_nested_paths() {
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file("vendor/dep2/Cargo.toml", "!INVALID!")
|
.file("vendor/dep2/Cargo.toml", "!INVALID!")
|
||||||
|
.file(
|
||||||
|
"vendor/dep3/Cargo.toml",
|
||||||
|
r#"
|
||||||
|
[project]
|
||||||
|
name = "dep3"
|
||||||
|
version = "0.5.0"
|
||||||
|
[dependencies]
|
||||||
|
subdep1 = { path = "../require-extra-build-step" }"#,
|
||||||
|
)
|
||||||
|
.file("vendor/dep3/src/lib.rs", "")
|
||||||
});
|
});
|
||||||
|
|
||||||
let p = project()
|
let p = project()
|
||||||
|
|
Loading…
Reference in a new issue