From 38acbf6970cbc0e0ffcfc2f861d56c23ae2c1439 Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Wed, 5 Mar 2025 17:40:04 -0800 Subject: [PATCH] fix: Handle ANY_GIT_ERROR when reading staged files in repo.py --- aider/repo.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/aider/repo.py b/aider/repo.py index 6c10296d9..b0956973f 100644 --- a/aider/repo.py +++ b/aider/repo.py @@ -309,9 +309,11 @@ class GitRepo: # Add staged files index = self.repo.index - # index.entries.keys can throw ANY_GIT_ERROR ai! - staged_files = [path for path, _ in index.entries.keys()] - files.update(self.normalize_path(path) for path in staged_files) + try: + staged_files = [path for path, _ in index.entries.keys()] + 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)]