Enhance syncback functionality and improve code readability

- Refactored the syncback process to streamline directory management and improve handling of class transitions in clean mode.
- Updated the `clone_tree_filtered` function to accept a tuple of compiled Globs and original pattern strings, enhancing flexibility in ignore pattern handling.
- Simplified logic for checking if paths are inside removed directories, improving code clarity.
- Added detailed comments to clarify the purpose of new logic for handling script directory transitions, ensuring better maintainability.
- Improved logging for better traceability during syncback operations.
This commit is contained in:
Joe 2026-02-01 20:10:11 -06:00
parent 1534a54808
commit 411f79ee81
10 changed files with 232 additions and 65 deletions

View file

@ -126,10 +126,7 @@ impl FsSnapshot {
// Also handle the case where the same file might be listed twice (absolute vs relative path)
// by gracefully handling "file not found" errors.
for path in &self.removed_files {
let is_inside_removed_dir = self
.removed_dirs
.iter()
.any(|dir| path.starts_with(dir));
let is_inside_removed_dir = self.removed_dirs.iter().any(|dir| path.starts_with(dir));
if is_inside_removed_dir {
continue;
}
@ -158,11 +155,7 @@ impl FsSnapshot {
let files_inside_dirs = self
.removed_files
.iter()
.filter(|path| {
self.removed_dirs
.iter()
.any(|dir| path.starts_with(dir))
})
.filter(|path| self.removed_dirs.iter().any(|dir| path.starts_with(dir)))
.count();
log::debug!(
"Removed {} directories and {} files from the file system ({} files skipped, inside removed dirs)",