improve file watcher to respect .ignore file
Dependencies
- [2]
6YZAVBWUInitial commit - [3]
WT3GA27Padd cursor with selection - [4]
UB2ITZJSrefresh changed files on FS changes - [5]
A5YBC77Vrecord! - [6]
AXSXZQDGfix updating changed file contents, styling - [7]
ZVI4AWERwoot contents_diff - [8]
23SFYK4Qbig view refactor into a new crate - [9]
WGID4LS4absolutely slayed testing with iced task - [10]
ACDXXAX2refactor main's updates into smaller fns - [11]
I56UGW7Umake record test, fix log update - [12]
X6AK4QPXfinish recording test - [13]
YYKXNBFLtest: add untracked file - [14]
WAOGSCOJvery nice refactor, wip adding channels logs - [15]
EJPSD5XOshared allowed actions conditions between update and view - [16]
AZ5D2LQUallow to set record description - [17]
PKLUHYE4allow to copy change hash - [18]
IN2JREDBadd window name on linux - [19]
YGZ3VCW4add push - [20]
XQTT6NDFrespect .ignore in file watch - [21]
YRGDFHABproject dir picker - [22]
LPSUBGUBadd projects picker - [23]
TMDH7GPVdir picker scrollables handling + confirmation - [24]
T4UECD3Spicking projects key nav and scrollable - [25]
B4RMW5AEadd syntax highlighter to untracked files contents - [26]
IQDCHWCPload a pijul repo - [27]
BFN2VHZSrefactor file stuff into sub-mod - [28]
I2AG42PAnew cols layout - [29]
KWTBNTO3diffs selection and scrolling - [30]
PTWZYQFRuse nav-scrollable for repo status - [31]
YK3MOJJLchonky refactor, wip other channels logs & diffs - [32]
S2NVIFXRallow to enter record msg - [33]
AMPZ2BXKshow changed files diffs (only Edit atm) - [34]
K5YUSV2Wauto-scroll to last offset - [35]
Z2CJPWZEfocus record message text_editor on spawn - [36]
3SYSJKYLadd app icon - [37]
FU6P5QLGindicate when a file is a dir with appended '/' - [38]
YBJRDOTCmake all repo actions async - [*]
VCNKFNUFapp init test
Change contents
- replacement in inflorescence/src/test.rs at line 116
Msg::ManagingRepo(ManagingRepoMsg::ToRepo(repo::MsgIn::RefreshChangedAndUntrackedFiles))Msg::ManagingRepo(ManagingRepoMsg::WatchedFileChange(path)) if path == &repo_path.join(file_to_record) - replacement in inflorescence/src/test.rs at line 226
Msg::ManagingRepo(ManagingRepoMsg::ToRepo(repo::MsgIn::RefreshChangedAndUntrackedFiles))Msg::ManagingRepo(ManagingRepoMsg::WatchedFileChange(path)) if path == &repo_path.join(file_to_record) - replacement in inflorescence/src/test.rs at line 527
Msg::ManagingRepo(ManagingRepoMsg::ToRepo(repo::MsgIn::RefreshChangedAndUntrackedFiles))Msg::ManagingRepo(ManagingRepoMsg::WatchedFileChange(path)) if path == &repo_path.join(file_to_record) - replacement in inflorescence/src/main.rs at line 23[6.112]→[5.4438:4510](∅→∅),[18.634]→[5.4438:4510](∅→∅),[9.5322]→[5.4438:4510](∅→∅),[8.25516]→[5.4438:4510](∅→∅),[3.508]→[5.4438:4510](∅→∅)
use notify_debouncer_full::notify::{RecommendedWatcher, RecursiveMode};use notify_debouncer_full::notify::{self, RecommendedWatcher, RecursiveMode}; - replacement in inflorescence/src/main.rs at line 25
new_debouncer, notify, DebounceEventResult, Debouncer, RecommendedCache,new_debouncer, DebounceEventResult, Debouncer, RecommendedCache, - edit in inflorescence/src/main.rs at line 94
/// ".ignore" file loaded to memoryignore: Gitignore, - edit in inflorescence/src/main.rs at line 115
WatchedFileChange(PathBuf), - replacement in inflorescence/src/main.rs at line 130
let report = report::Container::default();let mut report = report::Container::default(); - replacement in inflorescence/src/main.rs at line 134
init_managing_repo(repo_path);init_managing_repo(repo_path, &mut report); - edit in inflorescence/src/main.rs at line 212
report: &mut report::Container, - edit in inflorescence/src/main.rs at line 230
// Load `.ignore` filelet (ignore, ignore_err) = Gitignore::new(repo_path.join(".ignore"));if let Some(err) = ignore_err {let msg = format!("Error loading .ignore file {err:?}");error!("{msg}");report::show_err(report, msg);} - edit in inflorescence/src/main.rs at line 249
ignore, - replacement in inflorescence/src/main.rs at line 260
let (task, new_sub_state) =update_picking_repo_dir_from_view(model, msg);let (task, new_sub_state) = update_picking_repo_dir_from_view(model,msg,&mut state.model.report,); - replacement in inflorescence/src/main.rs at line 285
update_picking_project_from_view(model, msg);update_picking_project_from_view(model,msg,&mut state.model.report,); - edit in inflorescence/src/main.rs at line 389
report: &mut report::Container, - replacement in inflorescence/src/main.rs at line 411
init_managing_repo(path.clone());init_managing_repo(path.clone(), report); - replacement in inflorescence/src/main.rs at line 445
init_managing_repo(dir);init_managing_repo(dir, report); - edit in inflorescence/src/main.rs at line 586
ManagingRepoMsg::WatchedFileChange(path) => {let is_dir = path.metadata().map(|md| md.is_dir()).unwrap_or(false);if !state.ignore.matched_path_or_any_parents(&path, is_dir).is_ignore()&& let Some(fs_watch) = state.repo_fs_watch.as_mut(){// Refresh repostate.repo_tx_in.send(repo::MsgIn::RefreshChangedAndUntrackedFiles).unwrap();// Start watching it in case it's a new fileif let Err(err) =fs_watch.watch(&path, RecursiveMode::NonRecursive){match &err.kind {// Ignore path not found as this might be triggered on a// watched file that's been removednotify::ErrorKind::PathNotFound => {}notify::ErrorKind::Generic(_)| notify::ErrorKind::Io(_)| notify::ErrorKind::WatchNotFound| notify::ErrorKind::InvalidConfig(_)| notify::ErrorKind::MaxFilesWatch => {let msg = format!("Error setting up file watch for path {}: {err:?}",path.to_string_lossy());error!("{msg}");report::show_err(report, msg)}}}}Task::none()} - edit in inflorescence/src/main.rs at line 735
report: &mut report::Container, - replacement in inflorescence/src/main.rs at line 758
init_managing_repo(dir);init_managing_repo(dir, report); - edit in inflorescence/src/main.rs at line 1845[10.8018]→[20.521:549](∅→∅),[20.549]→[21.3624314:3624394](∅→∅),[21.3624394]→[20.643:679](∅→∅),[20.643]→[20.643:679](∅→∅),[20.679]→[22.26557:26622](∅→∅),[22.26622]→[20.742:767](∅→∅),[20.742]→[20.742:767](∅→∅),[20.767]→[21.3624395:3624434](∅→∅),[21.3624434]→[20.823:829](∅→∅),[20.823]→[20.823:829](∅→∅)
// Load `.ignore` filelet (ignore, ignore_err) = Gitignore::new(model.repo_path.join(".ignore"));if let Some(err) = ignore_err {let msg = format!("Error loading .ignore file {err:?}");error!("{msg}");report::show_err(report, msg);} - replacement in inflorescence/src/main.rs at line 1847
let (fs_watch_tx, fs_watch_rx) = watch::channel(());let (fs_watch_tx, fs_watch_rx) = watch::channel(model.repo_path.clone()); - edit in inflorescence/src/main.rs at line 1853
// TODO: distinguish ".pijul" changes - replacement in inflorescence/src/main.rs at line 1858
let is_dir = matches!(event.kind,notify::EventKind::Create(notify::event::CreateKind::Folder,) | notify::EventKind::Remove(notify::event::RemoveKind::Folder,));if event.paths.iter().any(|path| {!ignore.matched_path_or_any_parents(path, is_dir).is_ignore()}) {let _ = fs_watch_tx.send(());}event.paths.iter().for_each(|path| {let _ = fs_watch_tx.send(path.clone());}) - replacement in inflorescence/src/main.rs at line 1869[10.8794]→[10.8794:8807](∅→∅),[10.8807]→[21.3624435:3624494](∅→∅),[16.14517]→[10.8866:8885](∅→∅),[14.91804]→[10.8866:8885](∅→∅),[21.3624494]→[10.8866:8885](∅→∅),[10.8866]→[10.8866:8885](∅→∅)
fs_watch.watch(&model.repo_path, RecursiveMode::Recursive).unwrap();for entry in ignore::WalkBuilder::new(&model.repo_path).standard_filters(false) // disable git related stuff.ignore(true) // use ".ignore" file.build()// ignore errors.flatten(){if let Err(err) =fs_watch.watch(entry.path(), RecursiveMode::NonRecursive){let msg = format!("Error setting up file watch for path {}: {err:?}",entry.path().to_string_lossy());error!("{msg}");report::show_err(report, msg)}} - replacement in inflorescence/src/main.rs at line 1889[10.8947]→[10.8947:8998](∅→∅),[10.8998]→[21.3624495:3624573](∅→∅),[15.26723]→[10.9103:9111](∅→∅),[21.3624573]→[10.9103:9111](∅→∅),[10.9103]→[10.9103:9111](∅→∅)
let watch_task = Task::run(fs_watch_rx, |()| {ManagingRepoMsg::ToRepo(repo::MsgIn::RefreshChangedAndUntrackedFiles)});let watch_task = Task::run(fs_watch_rx, ManagingRepoMsg::WatchedFileChange);