Skip to content

Commit

Permalink
fix(cli): use matched_path_or_any_parents when checking if a file i…
Browse files Browse the repository at this point in the history
…s ignored (tauri-apps#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
  • Loading branch information
anatawa12 authored Mar 6, 2024
1 parent 5163861 commit b15948b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .changes/taurignore-ignoring-folders-not-working-for-watch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'tauri-cli': patch:bug
'@tauri-apps/cli': patch:bug
---

Fix `.taurignore` failing to ignore in some cases.
6 changes: 5 additions & 1 deletion tooling/cli/src/interface/rust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down

0 comments on commit b15948b

Please sign in to comment.