Skip to content

Commit bbb6aff

Browse files
committed
fix(package): Normalize cargo.toml to Cargo.toml for windows
1 parent 5dd39df commit bbb6aff

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/cargo/ops/cargo_package.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,15 +239,17 @@ fn build_ar_list(
239239
})?
240240
.to_string();
241241
match rel_str.as_ref() {
242-
"Cargo.toml" => {
242+
"Cargo.toml" |
243+
// normalize for case insensitive filesystems (like on Windows)
244+
"cargo.toml" => {
243245
result.push(ArchiveFile {
244246
rel_path: PathBuf::from(ORIGINAL_MANIFEST_FILE),
245247
rel_str: ORIGINAL_MANIFEST_FILE.to_string(),
246248
contents: FileContents::OnDisk(src_file),
247249
});
248250
result.push(ArchiveFile {
249-
rel_path,
250-
rel_str,
251+
rel_path: PathBuf::from("Cargo.toml"),
252+
rel_str: "Cargo.toml".to_string(),
251253
contents: FileContents::Generated(GeneratedFile::Manifest),
252254
});
253255
}

tests/testsuite/package.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3016,7 +3016,7 @@ See [..]
30163016
[VERIFYING] foo v0.0.1 ([CWD])
30173017
[COMPILING] foo v0.0.1 ([CWD][..])
30183018
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
3019-
[PACKAGED] 3 files, [..] ([..] compressed)
3019+
[PACKAGED] 4 files, [..] ([..] compressed)
30203020
",
30213021
)
30223022
.run();
@@ -3025,7 +3025,8 @@ See [..]
30253025
.with_stdout(
30263026
"\
30273027
Cargo.lock
3028-
cargo.toml
3028+
Cargo.toml
3029+
Cargo.toml.orig
30293030
src/main.rs
30303031
",
30313032
)
@@ -3036,7 +3037,7 @@ src/main.rs
30363037
validate_crate_contents(
30373038
f,
30383039
"foo-0.0.1.crate",
3039-
&["Cargo.lock", "cargo.toml", "src/main.rs"],
3040+
&["Cargo.lock", "Cargo.toml", "Cargo.toml.orig", "src/main.rs"],
30403041
&[],
30413042
);
30423043
}

0 commit comments

Comments
 (0)