mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-28 08:14:59 +00:00
Add ability to check if files are untracked and add them to the git repo.
This commit is contained in:
parent
ffc44bd014
commit
65e6a0abde
1 changed files with 10 additions and 1 deletions
11
coder.py
11
coder.py
|
@ -87,7 +87,16 @@ class Coder:
|
||||||
self.console.print("[red bold]Files are in different git repos, can't commit edits to allow easy undo")
|
self.console.print("[red bold]Files are in different git repos, can't commit edits to allow easy undo")
|
||||||
return
|
return
|
||||||
|
|
||||||
# todo: need to check if files are added to the repo, and add if not
|
for fname in self.fnames:
|
||||||
|
relative_fname = os.path.relpath(fname, self.repo.working_tree_dir)
|
||||||
|
if relative_fname not in self.repo.untracked_files:
|
||||||
|
continue
|
||||||
|
question = f"[red bold]Add {fname} to the git repo?"
|
||||||
|
if Confirm.ask(question, console=self.console):
|
||||||
|
self.repo.git.add(relative_fname)
|
||||||
|
self.console.print(f"[red]Added {fname} to the git repo")
|
||||||
|
else:
|
||||||
|
self.console.print(f"[red]Skipped adding {fname} to the git repo")
|
||||||
|
|
||||||
self.repo = git.Repo(repo_paths.pop())
|
self.repo = git.Repo(repo_paths.pop())
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue