mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-29 00:35:00 +00:00
fix: Prevent UnboundLocalError in get_tracked_files on IndexError
This commit is contained in:
parent
a9c9877580
commit
8cd106fc8a
1 changed files with 7 additions and 1 deletions
|
@ -293,13 +293,19 @@ class GitRepo:
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
iterator = commit.tree.traverse()
|
iterator = commit.tree.traverse()
|
||||||
|
blob = None # Initialize blob
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
blob = next(iterator)
|
blob = next(iterator)
|
||||||
if blob.type == "blob": # blob is a file
|
if blob.type == "blob": # blob is a file
|
||||||
files.add(blob.path)
|
files.add(blob.path)
|
||||||
except IndexError:
|
except IndexError:
|
||||||
self.io.tool_warning(f"GitRepo: read error skipping {blob.path}")
|
# Handle potential index error during tree traversal
|
||||||
|
# without relying on potentially unassigned 'blob'
|
||||||
|
self.io.tool_warning(
|
||||||
|
"GitRepo: Index error encountered while reading git tree object."
|
||||||
|
" Skipping."
|
||||||
|
)
|
||||||
continue
|
continue
|
||||||
except StopIteration:
|
except StopIteration:
|
||||||
break
|
break
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue