mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-25 14:55:00 +00:00
/add and /drop should work on untracked files in a repo (without committing them)
This commit is contained in:
parent
f6aa09ca85
commit
95fe1be4c5
2 changed files with 27 additions and 36 deletions
|
@ -283,8 +283,6 @@ class Commands:
|
|||
"Add files to the chat so GPT can edit them or review them in detail"
|
||||
|
||||
added_fnames = []
|
||||
git_added = []
|
||||
git_files = self.coder.repo.get_tracked_files() if self.coder.repo else []
|
||||
|
||||
all_matched_files = set()
|
||||
|
||||
|
@ -311,7 +309,6 @@ class Commands:
|
|||
|
||||
for matched_file in all_matched_files:
|
||||
abs_file_path = self.coder.abs_root_path(matched_file)
|
||||
rel_path = self.coder.get_rel_fname(matched_file)
|
||||
|
||||
if not abs_file_path.startswith(self.coder.root):
|
||||
self.io.tool_error(
|
||||
|
@ -319,14 +316,6 @@ class Commands:
|
|||
)
|
||||
continue
|
||||
|
||||
if self.coder.repo and rel_path not in git_files:
|
||||
try:
|
||||
self.coder.repo.repo.git.add(abs_file_path)
|
||||
git_added.append(matched_file)
|
||||
except git.exc.GitCommandError as e:
|
||||
self.io.tool_error(f"Unable to add {matched_file}: {str(e)}")
|
||||
continue
|
||||
|
||||
if abs_file_path in self.coder.abs_fnames:
|
||||
self.io.tool_error(f"{matched_file} is already in the chat")
|
||||
else:
|
||||
|
@ -338,11 +327,6 @@ class Commands:
|
|||
self.io.tool_output(f"Added {matched_file} to the chat")
|
||||
added_fnames.append(matched_file)
|
||||
|
||||
if self.coder.repo and git_added and self.coder.auto_commits:
|
||||
git_added = " ".join(git_added)
|
||||
commit_message = f"aider: Added {git_added}"
|
||||
self.coder.repo.commit(message=commit_message)
|
||||
|
||||
if not added_fnames:
|
||||
return
|
||||
|
||||
|
@ -372,7 +356,7 @@ class Commands:
|
|||
matched_files = self.glob_filtered_to_repo(word)
|
||||
|
||||
if not matched_files:
|
||||
self.io.tool_error(f"No files matched '{word}'")
|
||||
matched_files.append(word)
|
||||
|
||||
for matched_file in matched_files:
|
||||
abs_fname = self.coder.abs_root_path(matched_file)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue