mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-30 09:14: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:
|
try:
|
||||||
commit = self.repo.head.commit
|
commit = self.repo.head.commit
|
||||||
except ValueError:
|
except ValueError:
|
||||||
return set()
|
commit = None
|
||||||
|
|
||||||
files = []
|
files = []
|
||||||
for blob in commit.tree.traverse():
|
if commit:
|
||||||
if blob.type == "blob": # blob is a file
|
for blob in commit.tree.traverse():
|
||||||
files.append(blob.path)
|
if blob.type == "blob": # blob is a file
|
||||||
|
files.append(blob.path)
|
||||||
|
|
||||||
# Add staged files
|
# Add staged files
|
||||||
index = self.repo.index
|
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)
|
files.extend(staged_files)
|
||||||
|
|
||||||
# convert to appropriate os.sep, since git always normalizes to /
|
# convert to appropriate os.sep, since git always normalizes to /
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue