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

@ -737,6 +737,10 @@ class Commands:
for matched_file in sorted(all_matched_files):
abs_file_path = self.coder.abs_root_path(matched_file)
if self.coder.repo.git_ignored_file(matched_file):
self.io.tool_error(f"Can't add {matched_file} which is in gitignore")
continue
if not abs_file_path.startswith(self.coder.root) and not is_image_file(matched_file):
self.io.tool_error(
f"Can not add {abs_file_path}, which is not within {self.coder.root}"