fix(cli): use matched_path_or_any_parents when checking if a file is ignored (#8903)

* fix: taurignore ignoreing folders not working for watch

* docs: add to changes

* fix: panic: path is expected to be under the root

* Update taurignore-ignoring-folders-not-working-for-watch.md

* Update taurignore-ignoring-folders-not-working-for-watch.md
This commit is contained in:
anatawa12
2024-03-07 04:12:41 +09:00
committed by GitHub
parent 5163861588
commit b15948b11c
2 changed files with 11 additions and 1 deletions

View File

@@ -0,0 +1,6 @@
---
'tauri-cli': patch:bug
'@tauri-apps/cli': patch:bug
---
Fix `.taurignore` failing to ignore in some cases.

View File

@@ -263,7 +263,11 @@ struct IgnoreMatcher(Vec<Gitignore>);
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;
}
}