Skip to content

Commit b15948b

Browse files
authored
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
1 parent 5163861 commit b15948b

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'tauri-cli': patch:bug
3+
'@tauri-apps/cli': patch:bug
4+
---
5+
6+
Fix `.taurignore` failing to ignore in some cases.

tooling/cli/src/interface/rust.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,11 @@ struct IgnoreMatcher(Vec<Gitignore>);
263263
impl IgnoreMatcher {
264264
fn is_ignore(&self, path: &Path, is_dir: bool) -> bool {
265265
for gitignore in &self.0 {
266-
if gitignore.matched(path, is_dir).is_ignore() {
266+
if path.starts_with(gitignore.path())
267+
&& gitignore
268+
.matched_path_or_any_parents(path, is_dir)
269+
.is_ignore()
270+
{
267271
return true;
268272
}
269273
}

0 commit comments

Comments
 (0)