mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-28 11:20:36 +00:00
fix(package): ignore status check failure
Dirtiness check for symlinks is mostly informational. And changes in submodule would fail git-status as well (see #15384). To avoid adding complicated logic to handle that, for now we ignore the status check failure.
This commit is contained in:
parent
79473988e5
commit
d760263afb
@ -268,8 +268,22 @@ fn dirty_files_outside_pkg_root(
|
||||
// Handle files outside package root but under git workdir,
|
||||
.filter_map(|p| paths::strip_prefix_canonical(p, workdir).ok())
|
||||
{
|
||||
if repo.status_file(&rel_path)? != git2::Status::CURRENT {
|
||||
dirty_files.insert(workdir.join(rel_path));
|
||||
match repo.status_file(&rel_path) {
|
||||
Ok(git2::Status::CURRENT) => {}
|
||||
Ok(_) => {
|
||||
dirty_files.insert(workdir.join(rel_path));
|
||||
}
|
||||
Err(e) => {
|
||||
// Dirtiness check for symlinks is mostly informational.
|
||||
// And changes in submodule would fail git-status as well (see #15384).
|
||||
// To avoid adding complicated logic to handle that,
|
||||
// for now we ignore the status check failure.
|
||||
debug!(
|
||||
"failed to get status from file `{}` in git repo at `{}`: {e}",
|
||||
rel_path.display(),
|
||||
workdir.display()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(dirty_files)
|
||||
|
@ -1467,9 +1467,9 @@ fn dirty_file_outside_pkg_root_inside_submodule() {
|
||||
p.change_file("submodule/file.txt", "changed");
|
||||
|
||||
p.cargo("package --workspace --no-verify")
|
||||
.with_status(101)
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] attempt to get status of nonexistent file 'submodule/file.txt'; class=Invalid (3); code=NotFound (-3)
|
||||
[PACKAGING] isengard v0.0.0 ([ROOT]/foo/isengard)
|
||||
[PACKAGED] 6 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
|
Loading…
x
Reference in New Issue
Block a user