fix: Handle ANY_GIT_ERROR when reading staged files in repo.py

This commit is contained in:
Paul Gauthier (aider) 2025-03-05 17:40:04 -08:00
parent ad4bd91751
commit 38acbf6970

View file

@ -309,9 +309,11 @@ class GitRepo:
# Add staged files # Add staged files
index = self.repo.index index = self.repo.index
# index.entries.keys can throw ANY_GIT_ERROR ai! try:
staged_files = [path for path, _ in index.entries.keys()] staged_files = [path for path, _ in index.entries.keys()]
files.update(self.normalize_path(path) for path in staged_files) files.update(self.normalize_path(path) for path in staged_files)
except ANY_GIT_ERROR as err:
self.io.tool_error(f"Unable to read staged files: {err}")
res = [fname for fname in files if not self.ignored_file(fname)] res = [fname for fname in files if not self.ignored_file(fname)]