mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-29 08:44:59 +00:00
Scan the git index using entries, which does not rely on a prior commit
This commit is contained in:
parent
96f15c4533
commit
745b3c320b
1 changed files with 7 additions and 5 deletions
|
@ -1007,16 +1007,18 @@ class Coder:
|
|||
try:
|
||||
commit = self.repo.head.commit
|
||||
except ValueError:
|
||||
return set()
|
||||
commit = None
|
||||
|
||||
files = []
|
||||
for blob in commit.tree.traverse():
|
||||
if blob.type == "blob": # blob is a file
|
||||
files.append(blob.path)
|
||||
if commit:
|
||||
for blob in commit.tree.traverse():
|
||||
if blob.type == "blob": # blob is a file
|
||||
files.append(blob.path)
|
||||
|
||||
# Add staged files
|
||||
index = self.repo.index
|
||||
staged_files = [item.a_path for item in index.diff("HEAD")]
|
||||
staged_files = [path for path, _ in index.entries.keys()]
|
||||
|
||||
files.extend(staged_files)
|
||||
|
||||
# convert to appropriate os.sep, since git always normalizes to /
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue