mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-01 18:25:00 +00:00
refactor: Reorder git ignored file check to handle non-git repos
This commit is contained in:
parent
218623be28
commit
bc82baa968
1 changed files with 4 additions and 4 deletions
|
@ -737,16 +737,16 @@ class Commands:
|
||||||
for matched_file in sorted(all_matched_files):
|
for matched_file in sorted(all_matched_files):
|
||||||
abs_file_path = self.coder.abs_root_path(matched_file)
|
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):
|
if not abs_file_path.startswith(self.coder.root) and not is_image_file(matched_file):
|
||||||
self.io.tool_error(
|
self.io.tool_error(
|
||||||
f"Can not add {abs_file_path}, which is not within {self.coder.root}"
|
f"Can not add {abs_file_path}, which is not within {self.coder.root}"
|
||||||
)
|
)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
if self.coder.repo and self.coder.repo.git_ignored_file(matched_file):
|
||||||
|
self.io.tool_error(f"Can't add {matched_file} which is in gitignore")
|
||||||
|
continue
|
||||||
|
|
||||||
if abs_file_path in self.coder.abs_fnames:
|
if abs_file_path in self.coder.abs_fnames:
|
||||||
self.io.tool_error(f"{matched_file} is already in the chat as an editable file")
|
self.io.tool_error(f"{matched_file} is already in the chat as an editable file")
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue