diff --git a/Cargo.lock b/Cargo.lock
index 3f0a8b7..54f8020 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -248,6 +248,9 @@ name = "cc"
version = "1.0.70"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d26a6ce4b6a484fa3edb70f7efa6fc430fd2b87285fe8b84304fd0936faa0dc0"
+dependencies = [
+ "jobserver",
+]
[[package]]
name = "cfg-if"
@@ -593,6 +596,16 @@ version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
+[[package]]
+name = "form_urlencoded"
+version = "1.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191"
+dependencies = [
+ "matches",
+ "percent-encoding",
+]
+
[[package]]
name = "fsevent-sys"
version = "4.0.0"
@@ -745,6 +758,21 @@ version = "0.25.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0a01e0497841a3b2db4f8afa483cce65f7e96a3498bd6c541734792aeac8fe7"
+[[package]]
+name = "git2"
+version = "0.13.23"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2a8057932925d3a9d9e4434ea016570d37420ddb1ceed45a174d577f24ed6700"
+dependencies = [
+ "bitflags 1.2.1",
+ "libc",
+ "libgit2-sys",
+ "log",
+ "openssl-probe",
+ "openssl-sys",
+ "url",
+]
+
[[package]]
name = "globset"
version = "0.4.8"
@@ -890,6 +918,17 @@ dependencies = [
"tokio-io-timeout",
]
+[[package]]
+name = "idna"
+version = "0.2.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8"
+dependencies = [
+ "matches",
+ "unicode-bidi",
+ "unicode-normalization",
+]
+
[[package]]
name = "indenter"
version = "0.3.3"
@@ -971,6 +1010,15 @@ version = "0.4.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4"
+[[package]]
+name = "jobserver"
+version = "0.1.24"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "af25a77299a7f711a01975c35a6a424eb6862092cc2d6c72c4ed6cbc56dfc1fa"
+dependencies = [
+ "libc",
+]
+
[[package]]
name = "kqueue"
version = "1.0.4"
@@ -1016,6 +1064,46 @@ version = "0.2.103"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd8f7255a17a627354f321ef0055d63b898c6fb27eff628af4d1b66b7331edf6"
+[[package]]
+name = "libgit2-sys"
+version = "0.12.24+1.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ddbd6021eef06fb289a8f54b3c2acfdd85ff2a585dfbb24b8576325373d2152c"
+dependencies = [
+ "cc",
+ "libc",
+ "libssh2-sys",
+ "libz-sys",
+ "openssl-sys",
+ "pkg-config",
+]
+
+[[package]]
+name = "libssh2-sys"
+version = "0.2.21"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e0186af0d8f171ae6b9c4c90ec51898bad5d08a2d5e470903a50d9ad8959cbee"
+dependencies = [
+ "cc",
+ "libc",
+ "libz-sys",
+ "openssl-sys",
+ "pkg-config",
+ "vcpkg",
+]
+
+[[package]]
+name = "libz-sys"
+version = "1.1.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "de5435b8549c16d423ed0c03dbaafe57cf6c3344744f1242520d59c9d8ecec66"
+dependencies = [
+ "cc",
+ "libc",
+ "pkg-config",
+ "vcpkg",
+]
+
[[package]]
name = "linked-hash-map"
version = "0.5.4"
@@ -1070,6 +1158,12 @@ dependencies = [
"regex-automata",
]
+[[package]]
+name = "matches"
+version = "0.1.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f"
+
[[package]]
name = "memchr"
version = "2.4.1"
@@ -1343,6 +1437,25 @@ version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56"
+[[package]]
+name = "openssl-probe"
+version = "0.1.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "28988d872ab76095a6e6ac88d99b54fd267702734fd7ffe610ca27f533ddb95a"
+
+[[package]]
+name = "openssl-sys"
+version = "0.9.67"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "69df2d8dfc6ce3aaf44b40dec6f487d5a886516cf6879c49e98e0710f310a058"
+dependencies = [
+ "autocfg",
+ "cc",
+ "libc",
+ "pkg-config",
+ "vcpkg",
+]
+
[[package]]
name = "owo-colors"
version = "1.3.0"
@@ -1472,6 +1585,12 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
+[[package]]
+name = "pkg-config"
+version = "0.3.20"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7c9b1041b4387893b91ee6746cddfc28516aff326a3519fb2adf820932c5e6cb"
+
[[package]]
name = "polling"
version = "2.1.0"
@@ -2143,6 +2262,21 @@ dependencies = [
"winapi",
]
+[[package]]
+name = "tinyvec"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f83b2a3d4d9091d0abd7eba4dc2710b1718583bd4d8992e2190720ea38f391f7"
+dependencies = [
+ "tinyvec_macros",
+]
+
+[[package]]
+name = "tinyvec_macros"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
+
[[package]]
name = "tokio"
version = "1.12.0"
@@ -2411,6 +2545,12 @@ dependencies = [
"version_check",
]
+[[package]]
+name = "unicode-bidi"
+version = "0.3.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1a01404663e3db436ed2746d9fefef640d868edae3cceb81c3b8d5732fda678f"
+
[[package]]
name = "unicode-linebreak"
version = "0.1.2"
@@ -2420,6 +2560,15 @@ dependencies = [
"regex",
]
+[[package]]
+name = "unicode-normalization"
+version = "0.1.19"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9"
+dependencies = [
+ "tinyvec",
+]
+
[[package]]
name = "unicode-segmentation"
version = "1.8.0"
@@ -2444,12 +2593,30 @@ version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"
+[[package]]
+name = "url"
+version = "2.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c"
+dependencies = [
+ "form_urlencoded",
+ "idna",
+ "matches",
+ "percent-encoding",
+]
+
[[package]]
name = "uuid"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7"
+[[package]]
+name = "vcpkg"
+version = "0.2.15"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
+
[[package]]
name = "version_check"
version = "0.9.3"
@@ -2535,12 +2702,14 @@ name = "watchexec"
version = "1.17.1"
dependencies = [
"async-recursion",
+ "async-stream",
"atomic-take",
"clearscreen",
"color-eyre",
"command-group",
"dunce",
"futures",
+ "git2",
"globset",
"miette",
"nom 7.0.0",
diff --git a/lib/Cargo.toml b/lib/Cargo.toml
index d0c04c7..8dd0076 100644
--- a/lib/Cargo.toml
+++ b/lib/Cargo.toml
@@ -29,6 +29,8 @@ regex = "1.5.4"
thiserror = "1.0.26"
tracing = "0.1.26"
unicase = "2.6.0"
+async-stream = "0.3.2"
+git2 = "0.13.22"
[dependencies.command-group]
version = "1.0.5"
diff --git a/lib/src/config.rs b/lib/src/config.rs
index c8d44fe..ee7adc2 100644
--- a/lib/src/config.rs
+++ b/lib/src/config.rs
@@ -185,13 +185,13 @@ pub struct InitConfig {
}
impl Default for InitConfig {
- fn default() -> Self {
- Self {
+ fn default() -> Self {
+ Self {
error_handler: Box::new(()) as _,
error_channel_size: 64,
event_channel_size: 1024,
}
- }
+ }
}
impl InitConfig {
diff --git a/lib/src/error.rs b/lib/src/error.rs
index 3a0f95c..b539bd7 100644
--- a/lib/src/error.rs
+++ b/lib/src/error.rs
@@ -1,6 +1,6 @@
//! Error types for critical, runtime, and specialised errors.
-use std::{path::PathBuf};
+use std::path::PathBuf;
use miette::Diagnostic;
use thiserror::Error;
@@ -9,7 +9,11 @@ use tokio::{
task::JoinError,
};
-use crate::{action, event::Event, fs::{self, Watcher}};
+use crate::{
+ action,
+ event::Event,
+ fs::{self, Watcher},
+};
/// Errors which are not recoverable and stop watchexec execution.
#[derive(Debug, Diagnostic, Error)]
diff --git a/lib/src/filter/tagged.rs b/lib/src/filter/tagged.rs
index 2a99cd0..e74257f 100644
--- a/lib/src/filter/tagged.rs
+++ b/lib/src/filter/tagged.rs
@@ -11,15 +11,14 @@ use unicase::UniCase;
use crate::error::RuntimeError;
use crate::event::{Event, Tag};
use crate::filter::Filterer;
-use crate::project::ProjectType;
// to make filters
pub use globset::Glob;
pub use regex::Regex;
+pub mod error;
mod parse;
pub mod swaplock;
-pub mod error;
#[derive(Debug)]
pub struct TaggedFilterer {
@@ -121,7 +120,11 @@ impl TaggedFilterer {
// Ok(Some(bool)) => the match was applied, bool is the result
// Ok(None) => for some precondition, the match was not done (mismatched tag, out of context, …)
- fn match_tag(&self, filter: &Filter, tag: &Tag) -> Result