From a341c98ec6dcd85c755da1cb5e4bf4792cefeb73 Mon Sep 17 00:00:00 2001 From: Krazer Date: Fri, 3 Jan 2025 08:58:42 -0600 Subject: [PATCH 1/3] handle repo index errors --- aider/repo.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/aider/repo.py b/aider/repo.py index 35905df6e..463d3ccd8 100644 --- a/aider/repo.py +++ b/aider/repo.py @@ -285,9 +285,17 @@ class GitRepo: files = self.tree_files[commit] else: try: - for blob in commit.tree.traverse(): - if blob.type == "blob": # blob is a file - files.add(blob.path) + iterator = commit.tree.traverse() + while True: + try: + blob = next(iterator) + if blob.type == "blob": # blob is a file + files.add(blob.path) + except (IndexError,) + ANY_GIT_ERROR: + self.io.tool_output(f"GitRepo: read error skipping {blob.path}") + continue + except StopIteration: + break except ANY_GIT_ERROR as err: self.git_repo_error = err self.io.tool_error(f"Unable to list files in git repo: {err}") From 50d3b305d4a36386b31191849a6673d2ea288fe0 Mon Sep 17 00:00:00 2001 From: Krazer Date: Fri, 3 Jan 2025 09:01:34 -0600 Subject: [PATCH 2/3] make it a warning --- aider/repo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aider/repo.py b/aider/repo.py index 463d3ccd8..de71c1603 100644 --- a/aider/repo.py +++ b/aider/repo.py @@ -292,7 +292,7 @@ class GitRepo: if blob.type == "blob": # blob is a file files.add(blob.path) except (IndexError,) + ANY_GIT_ERROR: - self.io.tool_output(f"GitRepo: read error skipping {blob.path}") + self.io.tool_warning(f"GitRepo: read error skipping {blob.path}") continue except StopIteration: break From 1bcc27d2be36cabcab6446f9bdc9a8290c14294b Mon Sep 17 00:00:00 2001 From: Krazer Date: Fri, 3 Jan 2025 09:07:27 -0600 Subject: [PATCH 3/3] little clean up --- aider/repo.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/aider/repo.py b/aider/repo.py index de71c1603..5a8f0b52e 100644 --- a/aider/repo.py +++ b/aider/repo.py @@ -291,9 +291,11 @@ class GitRepo: blob = next(iterator) if blob.type == "blob": # blob is a file files.add(blob.path) - except (IndexError,) + ANY_GIT_ERROR: + except IndexError: self.io.tool_warning(f"GitRepo: read error skipping {blob.path}") continue + except ANY_GIT_ERROR as err: + raise err except StopIteration: break except ANY_GIT_ERROR as err: