mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-29 00:35:00 +00:00
Allow adding of existing non-git files
This commit is contained in:
parent
63d98b30d8
commit
b5c497b6a6
1 changed files with 11 additions and 7 deletions
|
@ -223,6 +223,7 @@ class Commands:
|
||||||
|
|
||||||
def glob_filtered_to_repo(self, pattern):
|
def glob_filtered_to_repo(self, pattern):
|
||||||
matched_files = Path(self.coder.root).glob(pattern)
|
matched_files = Path(self.coder.root).glob(pattern)
|
||||||
|
matched_files = [fn.relative_to(self.coder.root) for fn in matched_files]
|
||||||
|
|
||||||
# if repo, filter against it
|
# if repo, filter against it
|
||||||
if self.coder.repo:
|
if self.coder.repo:
|
||||||
|
@ -243,7 +244,10 @@ class Commands:
|
||||||
|
|
||||||
if not matched_files:
|
if not matched_files:
|
||||||
if any(char in word for char in "*?[]"):
|
if any(char in word for char in "*?[]"):
|
||||||
self.io.tool_error(f"No files matched pattern: {word}")
|
self.io.tool_error(f"No files to add matching pattern: {word}")
|
||||||
|
else:
|
||||||
|
if Path(word).exists():
|
||||||
|
matched_files = [word]
|
||||||
elif self.io.confirm_ask(
|
elif self.io.confirm_ask(
|
||||||
f"No files matched '{word}'. Do you want to create the file?"
|
f"No files matched '{word}'. Do you want to create the file?"
|
||||||
):
|
):
|
||||||
|
@ -267,7 +271,7 @@ class Commands:
|
||||||
|
|
||||||
if self.coder.repo and git_added:
|
if self.coder.repo and git_added:
|
||||||
git_added = " ".join(git_added)
|
git_added = " ".join(git_added)
|
||||||
commit_message = f"aider: Created {git_added}"
|
commit_message = f"aider: Added {git_added}"
|
||||||
self.coder.repo.git.commit("-m", commit_message, "--no-verify")
|
self.coder.repo.git.commit("-m", commit_message, "--no-verify")
|
||||||
commit_hash = self.coder.repo.head.commit.hexsha[:7]
|
commit_hash = self.coder.repo.head.commit.hexsha[:7]
|
||||||
self.io.tool_output(f"Commit {commit_hash} {commit_message}")
|
self.io.tool_output(f"Commit {commit_hash} {commit_message}")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue