Open
Description
Problem
During the investigation of #14955 and #14962, we found more corner cases that cargo package
doesn't consider dirty. You don't even need to pass --allow-dirty
flag to explicitly allow it. .cargo_vcs_info.json
shows no dirty at all. However, the actual packaged .crate
file contains dirty files.
Let's consider this virtual workspace:
./
├── foo/
│ ├── src/
│ ├── Cargo.toml
│ └── README.md -> ../README.md
├── Cargo.toml
├── LICENSE
└── README.md
# foo/Cargo.toml
[package]
name = "foo"
edition.workspace = true
license-file = "../LICENSE" # link to parent LICENSE
# Cargo.toml
[workspace]
members = ["foo"]
[workspace.package]
edition = "2015"
There are at least three corner cases:
- Symlinks — if you change README.md at workspace root level, when packaging it would be included. However, since
PathSource::list_files
list symlink as ordinary file. When doing dirty check, the naive path prefix check is not able to find the symlink source file dirty. -
package.license-file
andpackage.readme
— they are copied duringcargo package
.PathSource::list_files
doesn't even report them because they are not under the directory of the package. - Workspace inheritance — like changing
workspace.package.edition
to2021
would actually make foo's Cargo.toml dirty, but the current dirty status check doesn't capture that.- Fixed by fix(package): report lockfile / workspace manifest is dirty #15276 and fix: revert the behavior checking lockfile's VCS status #15341. We do an aggressively check that if the workspace Cargo.toml is dirty, consider it dirty.
- Symlinks linking to Git submodules. See 1.86
cargo package
fail when workspace crate contains symlink into git submodule #15384.- It also has a performance issue and needs refactor. When considering performance, also keep in mind large monorepo-level workspace performance like Performance Regression in
cargo package
on1.81.0
#14955
- It also has a performance issue and needs refactor. When considering performance, also keep in mind large monorepo-level workspace performance like Performance Regression in
Steps
See #14966
Possible Solution(s)
No response
Notes
No response
Version
cargo 1.85.0-nightly (769f622e1 2024-12-14)