mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-24 22:34:59 +00:00
explicitly find and report untracked files
This commit is contained in:
parent
d32ae99de9
commit
daac07c062
1 changed files with 4 additions and 5 deletions
7
coder.py
7
coder.py
|
@ -96,13 +96,12 @@ class Coder:
|
||||||
for fname in self.fnames:
|
for fname in self.fnames:
|
||||||
relative_fname = os.path.relpath(fname, repo.working_tree_dir)
|
relative_fname = os.path.relpath(fname, repo.working_tree_dir)
|
||||||
tracked_files = set(repo.git.ls_files().splitlines())
|
tracked_files = set(repo.git.ls_files().splitlines())
|
||||||
if relative_fname not in tracked_files and relative_fname not in repo.untracked_files:
|
if relative_fname not in tracked_files:
|
||||||
continue
|
|
||||||
new_files.append(relative_fname)
|
new_files.append(relative_fname)
|
||||||
|
|
||||||
if new_files:
|
if new_files:
|
||||||
new_files_str = ', '.join(new_files)
|
new_files_str = '\n '.join(new_files)
|
||||||
question = f"[red bold]Add the following new files to the git repo? {new_files_str}"
|
question = f"[red bold]These files are not tracked in the repo:\n {new_files_str}\nAdd them?"
|
||||||
if Confirm.ask(question, console=self.console):
|
if Confirm.ask(question, console=self.console):
|
||||||
for relative_fname in new_files:
|
for relative_fname in new_files:
|
||||||
repo.git.add(relative_fname)
|
repo.git.add(relative_fname)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue