From 410f08e1caffd329628339b84b1cbee7bf4e7c11 Mon Sep 17 00:00:00 2001 From: Hatter Jiang Date: Sun, 29 Aug 2021 23:55:53 +0800 Subject: [PATCH] feat: ignore .git --- src/main.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index e851a45..011c1d8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -36,7 +36,13 @@ fn main() { match rx.recv() { Ok(RawEvent { path: Some(path), op: Ok(op), cookie }) => { success!("Change: {:?} {:?} ({:?})", op, path, cookie); - if path.to_str().map(|s| !s.contains("/.git/")).unwrap_or(false) { + if path.to_str().map( + |s| !s.contains("/.git/") + && !s.ends_with("~") + && !s.ends_with(".swp") + && !s.ends_with(".swx") + && cookie.is_none() + ).unwrap_or(false) { match rust_util::util_cmd::run_command_and_wait(&mut Command::new(action)) { Ok(exit_status) => success!("Run action success: {}", exit_status), Err(e) => failure!("Run action: {}, failed: {}", action, e),