Problem
Description
When package.include is specified in Cargo.toml, cargo publish incorrectly reports files inside .gitignored directories as uncommitted changes.
Expected behavior
Files inside .gitignored directories should not be reported as uncommitted changes.
Steps
From 3185f58
#[cargo_test]
fn include_does_not_pick_up_gitignored_files() {
// Ensures `include` directives do not traverse into `.gitignore`d directories.
let (p, _repo) = git::new_repo("foo", |p| {
p.file(
"Cargo.toml",
r#"
[package]
name = "foo"
version = "0.1.0"
edition = "2024"
description = "foo"
license = "MIT"
documentation = "foo"
include = ["src/**/*", "Cargo.toml", "LICENSE"]
"#,
)
.file("src/lib.rs", "")
.file("LICENSE", "license text")
.file(".gitignore", ".venv/")
});
p.change_file(".venv/some-package/LICENSE", "other license");
// TODO: not expected behavior
p.cargo("package --list")
.with_status(101)
.with_stderr_data(str![[r#"
[ERROR] 1 files in the working directory contain changes that were not yet committed into git:
.venv/some-package/LICENSE
to proceed despite this and include the uncommitted changes, pass the `--allow-dirty` flag
"#]])
.with_stdout_data(str![[r#"
"#]])
.run();
}
Possible Solution(s)
Part of #16864
Notes
No response
Version
Problem
Description
When
package.includeis specified inCargo.toml,cargo publishincorrectly reports files inside.gitignored directories as uncommitted changes.Expected behavior
Files inside
.gitignored directories should not be reported as uncommitted changes.Steps
From 3185f58
Possible Solution(s)
Part of #16864
Notes
No response
Version