A conflict is recorded state too: unchanged canonical markers may be resolved by an insertion. Everything else keeps the dirty-worktree guard.
(
repo: &Repository,
view: &str,
status: &atomic_repository::RepositoryStatus,
)
| 1279 | /// A conflict is recorded state too: unchanged canonical markers may be |
| 1280 | /// resolved by an insertion. Everything else keeps the dirty-worktree guard. |
| 1281 | fn insert_would_discard_work( |
| 1282 | repo: &Repository, |
| 1283 | view: &str, |
| 1284 | status: &atomic_repository::RepositoryStatus, |
| 1285 | ) -> Result<bool, Status> { |
| 1286 | use atomic_repository::status::FileStatus; |
| 1287 | let mut conflicts = std::collections::HashSet::new(); |
| 1288 | for entry in status.entries() { |
| 1289 | match entry.status() { |
| 1290 | FileStatus::Clean => {} |
| 1291 | FileStatus::Conflicted => { |
| 1292 | conflicts.insert(entry.path().to_path_buf()); |
| 1293 | } |
| 1294 | _ => return Ok(true), |
| 1295 | } |
| 1296 | } |
| 1297 | if conflicts.is_empty() { |
| 1298 | return Ok(false); |
| 1299 | } |
| 1300 | let mut changed = false; |
| 1301 | repo.materialize_view_entries::<Status>(view, |entry| { |
| 1302 | if conflicts.remove(std::path::Path::new(&entry.path)) { |
| 1303 | changed |= !matches_canonical_entry(repo.root(), &entry)?; |
| 1304 | } |
| 1305 | Ok(()) |
| 1306 | }) |
| 1307 | .map_err(repository_error)??; |
| 1308 | // A reported conflict absent from the canonical render is not safe to |
| 1309 | // discard. Neither TREE nor saved materialization history proves ownership. |
| 1310 | Ok(changed || !conflicts.is_empty()) |
| 1311 | } |
| 1312 | |
| 1313 | fn matches_canonical_entry( |
| 1314 | root: &std::path::Path, |
no test coverage detected