fix: handle git errors when listing files in the repository

This commit is contained in:
Paul Gauthier 2024-09-09 12:42:20 -07:00 committed by Paul Gauthier (aider)
parent 82f8aa5d6a
commit 73e7d7bd2a

View file

@ -257,6 +257,10 @@ class GitRepo:
commit = self.repo.head.commit commit = self.repo.head.commit
except ValueError: except ValueError:
commit = None commit = None
except ANY_GIT_ERROR as err:
self.io.tool_error(f"Unable to list files in git repo: {err}")
self.io.tool_output("Is your git repo corrupted?")
return []
files = set() files = set()
if commit: if commit: