Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions src/cargo/ops/vendor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -618,10 +618,6 @@ fn vendor_this(relative: &Path) -> bool {
// Temporary Cargo files
Some(".cargo-ok") => false,
Comment on lines 618 to 619
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that we are doing fresh extractions, is this still needed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For git checkouts we still have that, though there is no test exercising that code path. Do you want a test for it in this PR?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's go ahead and merge this


// 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,
}
}
33 changes: 25 additions & 8 deletions tests/testsuite/vendor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down