feat: Add git_ignored_file method to check files against gitignore

This commit is contained in:
Paul Gauthier 2024-11-13 13:12:25 -08:00 committed by Paul Gauthier (aider)
parent ea1a4ecdc6
commit 218623be28
3 changed files with 17 additions and 0 deletions

View file

@ -355,6 +355,9 @@ class Coder:
for fname in fnames:
fname = Path(fname)
if self.repo and self.repo.git_ignored_file(fname):
self.io.tool_warning(f"Skipping {fname} that matches gitignore spec.")
if self.repo and self.repo.ignored_file(fname):
self.io.tool_warning(f"Skipping {fname} that matches aiderignore spec.")
continue
@ -1779,6 +1782,10 @@ class Coder:
self.check_for_dirty_commit(path)
return True
if self.repo and self.repo.git_ignored_file(path):
self.io.tool_warning(f"Skipping edits to {path} that matches gitignore spec.")
return
if not Path(full_path).exists():
if not self.io.confirm_ask("Create new file?", subject=path):
self.io.tool_output(f"Skipping edits to {path}")