(paths: &GitAdminPaths)
| 1215 | } |
| 1216 | |
| 1217 | fn observe_locks(paths: &GitAdminPaths) -> Result<LockObservation, ObservationError> { |
| 1218 | let index_lock_path = append_suffix(&paths.index_path, ".lock"); |
| 1219 | let index_lock = observe_path(index_lock_path)?; |
| 1220 | let mut ref_locks = BTreeSet::new(); |
| 1221 | |
| 1222 | for admin_dir in [&paths.common_dir, &paths.worktree_git_dir] { |
| 1223 | collect_top_level_locks(admin_dir, &mut ref_locks)?; |
| 1224 | collect_locks_recursive(&admin_dir.join("refs"), &mut ref_locks)?; |
| 1225 | } |
| 1226 | ref_locks.remove(&index_lock.path); |
| 1227 | |
| 1228 | Ok(LockObservation { |
| 1229 | index_lock, |
| 1230 | ref_locks: ref_locks.into_iter().collect(), |
| 1231 | }) |
| 1232 | } |
| 1233 | |
| 1234 | fn collect_top_level_locks( |
| 1235 | directory: &Path, |
no test coverage detected