From 60da93f6d10ef17a8167660f6ed885cd5157ac0a Mon Sep 17 00:00:00 2001 From: Lary_Stef Date: Sat, 28 Feb 2026 21:34:01 +0300 Subject: [PATCH] Fix .gitgnore search in FileWatcher --- taskiq/cli/watcher.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/taskiq/cli/watcher.py b/taskiq/cli/watcher.py index e0ac0e22..a16264d9 100644 --- a/taskiq/cli/watcher.py +++ b/taskiq/cli/watcher.py @@ -21,9 +21,17 @@ def __init__( ) -> None: self.callback = callback self.gitignore = None - gpath = path / ".gitignore" - if use_gitignore and gpath.exists(): - self.gitignore = parse_gitignore(gpath) + project_root = Path().resolve() + path = path.resolve() + + if use_gitignore: + while path != project_root.parent: + gpath = path / ".gitignore" + if gpath.exists(): + self.gitignore = parse_gitignore(gpath) + break + path = path.parent + self.callback_kwargs = callback_kwargs def dispatch(self, event: FileSystemEvent) -> None: