mirror of
https://github.com/rust-lang/cargo.git
synced 2025-10-01 11:30:39 +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,
|
// Handle files outside package root but under git workdir,
|
||||||
.filter_map(|p| paths::strip_prefix_canonical(p, workdir).ok())
|
.filter_map(|p| paths::strip_prefix_canonical(p, workdir).ok())
|
||||||
{
|
{
|
||||||
if repo.status_file(&rel_path)? != git2::Status::CURRENT {
|
match repo.status_file(&rel_path) {
|
||||||
dirty_files.insert(workdir.join(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)
|
Ok(dirty_files)
|
||||||
|
@ -1467,9 +1467,9 @@ fn dirty_file_outside_pkg_root_inside_submodule() {
|
|||||||
p.change_file("submodule/file.txt", "changed");
|
p.change_file("submodule/file.txt", "changed");
|
||||||
|
|
||||||
p.cargo("package --workspace --no-verify")
|
p.cargo("package --workspace --no-verify")
|
||||||
.with_status(101)
|
|
||||||
.with_stderr_data(str![[r#"
|
.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();
|
.run();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user