diff --git a/src/cargo/ops/vendor.rs b/src/cargo/ops/vendor.rs index 3cf13ed2b6c..ce1f688d182 100644 --- a/src/cargo/ops/vendor.rs +++ b/src/cargo/ops/vendor.rs @@ -618,10 +618,6 @@ fn vendor_this(relative: &Path) -> bool { // Temporary Cargo files Some(".cargo-ok") => false, - // Skip patch-style orig/rej files. Published crates on crates.io - // have `Cargo.toml.orig` which we don't want to use here and - // otherwise these are rarely used as part of the build process. - Some(p) if p.ends_with(".orig") || p.ends_with(".rej") => false, _ => true, } } diff --git a/tests/testsuite/vendor.rs b/tests/testsuite/vendor.rs index 353cfa21b85..04872aa0bd4 100644 --- a/tests/testsuite/vendor.rs +++ b/tests/testsuite/vendor.rs @@ -1085,20 +1085,37 @@ fn ignore_files() { .build(); Package::new("url", "1.4.1") - .file("src/lib.rs", "") + // These will be vendored + .file(".cargo_vcs_info.json", "") + .file("Cargo.toml.orig", "") .file("foo.orig", "") - .file(".gitignore", "") - .file(".gitattributes", "") .file("foo.rej", "") + .file("src/lib.rs", "") + // These will not be vendored + .file(".cargo-ok", "") + .file(".gitattributes", "") + .file(".gitignore", "") .publish(); p.cargo("vendor --respect-source-config").run(); let csum = p.read_file("vendor/url/.cargo-checksum.json"); - assert!(!csum.contains("foo.orig")); - assert!(!csum.contains(".gitignore")); - assert!(!csum.contains(".gitattributes")); - assert!(!csum.contains(".cargo-ok")); - assert!(!csum.contains("foo.rej")); + assert_e2e().eq( + csum, + str![[r#" +{ + "files": { + ".cargo_vcs_info.json": "[..]", + "Cargo.toml": "[..]", + "Cargo.toml.orig": "[..]", + "foo.orig": "[..]", + "foo.rej": "[..]", + "src/lib.rs": "[..]" + }, + "package": "[..]" +} +"#]] + .is_json(), + ); } #[cargo_test]