Mercurial > public > mercurial-scm > hg-stable
diff rust/rhg/src/commands/status.rs @ 49683:53ca3e3bc013 stable
rhg: fix race when a fixup file is deleted on disk
See next changeset for the other race in the same kind of logic and why
there are two different places.
author | Rapha?l Gom?s <rgomes@octobus.net> |
---|---|
date | Mon, 27 Feb 2023 15:18:50 +0100 |
parents | ae61851e6fe2 |
children | 8fcd5302243a |
line wrap: on
line diff
--- a/rust/rhg/src/commands/status.rs Sat Feb 25 06:11:14 2023 +0100 +++ b/rust/rhg/src/commands/status.rs Mon Feb 27 15:18:50 2023 +0100 @@ -436,9 +436,21 @@ // `unsure_is_clean` which was needed before reading // contents. Here we access metadata again after reading // content, in case it changed in the meantime. - let fs_metadata = repo + let metadata_res = repo .working_directory_vfs() - .symlink_metadata(&fs_path)?; + .symlink_metadata(&fs_path); + let fs_metadata = match metadata_res { + Ok(meta) => meta, + Err(err) => match err { + HgError::IoError { .. } => { + // The file has probably been deleted. In any + // case, it was in the dirstate before, so + // let's ignore the error. + continue; + } + _ => return Err(err.into()), + }, + }; if let Some(mtime) = TruncatedTimestamp::for_reliable_mtime_of( &fs_metadata,