mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-24 22:34:59 +00:00
Accept either a git dname or a list of fnames
This commit is contained in:
parent
256dd7bbd9
commit
64c50bab48
3 changed files with 109 additions and 27 deletions
|
@ -98,6 +98,7 @@ class Coder:
|
|||
main_model,
|
||||
io,
|
||||
fnames=None,
|
||||
git_dname=None,
|
||||
pretty=True,
|
||||
show_diffs=False,
|
||||
auto_commits=True,
|
||||
|
@ -155,11 +156,14 @@ class Coder:
|
|||
fname.parent.mkdir(parents=True, exist_ok=True)
|
||||
fname.touch()
|
||||
|
||||
if not fname.is_file():
|
||||
raise ValueError(f"{fname} is not a file")
|
||||
|
||||
self.abs_fnames.add(str(fname.resolve()))
|
||||
|
||||
if use_git:
|
||||
try:
|
||||
self.repo = GitRepo(self.io, fnames)
|
||||
self.repo = GitRepo(self.io, fnames, git_dname)
|
||||
self.root = self.repo.root
|
||||
except FileNotFoundError:
|
||||
self.repo = None
|
||||
|
@ -197,7 +201,7 @@ class Coder:
|
|||
self.io.tool_output(f"Added {fname} to the chat.")
|
||||
|
||||
if self.repo:
|
||||
self.repo.add_new_files(fnames)
|
||||
self.repo.add_new_files(fname for fname in fnames if not Path(fname).is_dir())
|
||||
|
||||
# validate the functions jsonschema
|
||||
if self.functions:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue