From 73453a3ceedc9cdf3ebc597f646a3eef3ddc0e0f Mon Sep 17 00:00:00 2001 From: Hatter Jiang Date: Sun, 29 Aug 2021 23:52:43 +0800 Subject: [PATCH] feat: ignore .git --- src/main.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index db0295c..e851a45 100644 --- a/src/main.rs +++ b/src/main.rs @@ -35,10 +35,12 @@ fn main() { loop { match rx.recv() { Ok(RawEvent { path: Some(path), op: Ok(op), cookie }) => { - success!("Success: {:?} {:?} ({:?})", op, path, cookie); - 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), + success!("Change: {:?} {:?} ({:?})", op, path, cookie); + if path.to_str().map(|s| !s.contains("/.git/")).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), + } } } Ok(event) => information!("Broken event: {:?}", event),