Refactor path ignore rule handling in Project and ServeSession

- Introduced a new method `path_ignore_rules` in the Project struct to streamline the creation of PathIgnoreRule instances.
- Updated ServeSession and snapshot middleware to utilize the new method, improving code clarity and reducing duplication.
- Removed redundant PathIgnoreRule mapping from multiple locations, enhancing maintainability.
This commit is contained in:
Joe 2026-03-06 23:12:28 -06:00
parent 89869f685d
commit 0243181731
3 changed files with 21 additions and 23 deletions

View file

@ -17,7 +17,7 @@ use crate::{
resolution::UnresolvedValue,
snapshot::{
InstanceContext, InstanceMetadata, InstanceSnapshot, InstanceWithMeta, InstigatingSource,
PathIgnoreRule, SyncRule,
SyncRule,
},
snapshot_middleware::Middleware,
syncback::{
@ -115,10 +115,7 @@ pub fn snapshot_project(
let mut context = context.clone();
context.clear_sync_rules();
let rules = project.glob_ignore_paths.iter().map(|glob| PathIgnoreRule {
glob: glob.clone(),
base_path: project.folder_location().to_path_buf(),
});
let rules = project.path_ignore_rules();
let sync_rules = project.sync_rules.iter().map(|rule| SyncRule {
base_path: project.folder_location().to_path_buf(),