fn handle_event(&self, event: &DebouncedEvent, repo: &R)
    where
        R: Repository,
    {
        log::debug!("received event: {:?}", event);
        // TODO: better commit messages (e.g. short title, descriptive body)
        // TODO: configurable commit messages
        let (path, message) = match event {
            DebouncedEvent::Create(path) => {
                if path.is_dir() {
                    return;
                }
                handle_event!(path, "created file {} @ {}")
            }
            DebouncedEvent::Write(path) => handle_event!(path, "written file {} @ {}"),
            DebouncedEvent::Chmod(path) => handle_event!(path, "chmod file {} @ {}"),
            DebouncedEvent::Remove(path) => handle_event!(path, "deleted file {} @ {}"),
            DebouncedEvent::Rename(old, new) => (
                new,
                format!(
                    "renamed file {} to {} @ {}",
                    old.to_str().unwrap(),
                    new.to_str().unwrap(),
                    chrono::Utc::now()
                ),
            ),
            // TODO: handle these two later
            DebouncedEvent::Rescan => todo!(),
            DebouncedEvent::Error(_, _) => todo!(),
            DebouncedEvent::NoticeRemove(_) | DebouncedEvent::NoticeWrite(_) => {
                return;
            }
        };

        repo.stage(path).unwrap();
        repo.commit(&message).unwrap();
    }
/// Handle an event sent by the watcher.
Handle an event sent by the watcher.
Handle an event sent by the watcher .
fn handle_event(&self, event: &DebouncedEvent, repo: &R)
    where
        R: Repository,
    {
        log::debug!("received event: {:?}", event);
        // TODO: better commit messages (e.g. short title, descriptive body)
        // TODO: configurable commit messages
        let (path, message) = match event {
            DebouncedEvent::Create(path) => {
                if path.is_dir() {
                    return;
                }
                handle_event!(path, "created file {} @ {}")
            }
            DebouncedEvent::Write(path) => handle_event!(path, "written file {} @ {}"),
            DebouncedEvent::Chmod(path) => handle_event!(path, "chmod file {} @ {}"),
            DebouncedEvent::Remove(path) => handle_event!(path, "deleted file {} @ {}"),
            DebouncedEvent::Rename(old, new) => (
                new,
                format!(
                    "renamed file {} to {} @ {}",
                    old.to_str().unwrap(),
                    new.to_str().unwrap(),
                    chrono::Utc::now()
                ),
            ),
            // TODO: handle these two later
            DebouncedEvent::Rescan => todo!(),
            DebouncedEvent::Error(_, _) => todo!(),
            DebouncedEvent::NoticeRemove(_) | DebouncedEvent::NoticeWrite(_) => {
                return;
            }
        };
        repo.stage(path).unwrap();
        repo.commit(&message).unwrap();
    }
fn handle_event ( & self , event : & DebouncedEvent , repo : & R ) where R : Repository , { log :: debug ! ( " " event ) ; // TODO: better commit messages (e.g. short title, descriptive body) // TODO: configurable commit messages let ( path , message ) = match event { DebouncedEvent :: Create ( path ) => { if path . is_dir ( ) { return ; } handle_event ! ( path " " ) } DebouncedEvent :: Write ( path ) => handle_event ! ( path " " ) , DebouncedEvent :: Chmod ( path ) => handle_event ! ( path " " ) , DebouncedEvent :: Remove ( path ) => handle_event ! ( path " " ) , DebouncedEvent :: Rename ( old , new ) => ( new , format ! ( " " old to_str ( ) unwrap ( ) new to_str ( ) unwrap ( ) chrono Utc now ( ) ) , ) , // TODO: handle these two later DebouncedEvent :: Rescan => todo ! ( ) , DebouncedEvent :: Error ( _ , _ ) => todo ! ( ) , DebouncedEvent :: NoticeRemove ( _ ) | DebouncedEvent :: NoticeWrite ( _ ) => { return ; } } ; repo . stage ( path ) . unwrap ( ) ; repo . commit ( & message ) . unwrap ( ) ; }
Handle an event sent by the watcher.
Handle an event sent by the watcher .
&self
event
&DebouncedEvent
repo
&R
&self
event
&DebouncedEvent
repo
&R