diff --git a/.changes/taurignore-ignoring-folders-not-working-for-watch.md b/.changes/taurignore-ignoring-folders-not-working-for-watch.md new file mode 100644 index 000000000..dae7b9a99 --- /dev/null +++ b/.changes/taurignore-ignoring-folders-not-working-for-watch.md @@ -0,0 +1,6 @@ +--- +'tauri-cli': patch:bug +'@tauri-apps/cli': patch:bug +--- + +Fix `.taurignore` failing to ignore in some cases. diff --git a/tooling/cli/src/interface/rust.rs b/tooling/cli/src/interface/rust.rs index 2d66191f9..8a60dc672 100644 --- a/tooling/cli/src/interface/rust.rs +++ b/tooling/cli/src/interface/rust.rs @@ -263,7 +263,11 @@ struct IgnoreMatcher(Vec); impl IgnoreMatcher { fn is_ignore(&self, path: &Path, is_dir: bool) -> bool { for gitignore in &self.0 { - if gitignore.matched(path, is_dir).is_ignore() { + if path.starts_with(gitignore.path()) + && gitignore + .matched_path_or_any_parents(path, is_dir) + .is_ignore() + { return true; } }