feat: implement .gitignore support in file watcher
This commit is contained in:
@@ -47,10 +47,15 @@ class GitEventHandler(FileSystemEventHandler):
|
||||
file_path = event.src_path if action != "rename" else event.dest_path
|
||||
file_name = os.path.basename(file_path)
|
||||
|
||||
# Check if any part of the path is .git
|
||||
# Check if any part of the path is .git or if it's the log file
|
||||
if ".git" in file_path.split(os.sep) or file_name == "git_monitor.log":
|
||||
return
|
||||
|
||||
# NEW: Respect .gitignore
|
||||
if git_manager.is_ignored(file_path):
|
||||
logger.info(f"Ignored: {file_path} (matches .gitignore)")
|
||||
return
|
||||
|
||||
display_name = custom_file_name if custom_file_name else file_name
|
||||
logger.info(f"File event: {action} on {display_name}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user