Skip to content

Commit

Permalink
fix(package): sort dirty file report
Browse files Browse the repository at this point in the history
To make error message more deterministic
  • Loading branch information
weihanglo committed Dec 19, 2024
1 parent 59b2ddd commit cc3b6cb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/cargo/ops/cargo_package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@ fn check_repo_state(
// Find the intersection of dirty in git, and the src_files that would
// be packaged. This is a lazy n^2 check, but seems fine with
// thousands of files.
let dirty_src_files: Vec<String> = src_files
let mut dirty_src_files: Vec<_> = src_files
.iter()
.filter(|src_file| dirty_files.iter().any(|path| src_file.starts_with(path)))
.map(|path| {
Expand All @@ -847,6 +847,7 @@ fn check_repo_state(
dirty,
}))
} else {
dirty_src_files.sort_unstable();
anyhow::bail!(
"{} files in the working directory contain changes that were \
not yet committed into git:\n\n{}\n\n\
Expand Down

0 comments on commit cc3b6cb

Please sign in to comment.