mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-29 16:54:59 +00:00
refactor: improve error handling for git version check
This commit is contained in:
parent
00f42590c8
commit
bd21122e64
2 changed files with 6 additions and 2 deletions
|
@ -307,8 +307,12 @@ def sanity_check_repo(repo, io):
|
|||
error_msg = str(repo.git_repo_error)
|
||||
except ANY_GIT_ERROR as exc:
|
||||
error_msg = str(exc)
|
||||
bad_ver = "version in (1, 2)" in error_msg
|
||||
except AssertionError as exc:
|
||||
error_msg = str(exc)
|
||||
bad_ver = True
|
||||
|
||||
if "version in (1, 2)" in error_msg:
|
||||
if bad_ver:
|
||||
io.tool_error("Aider only works with git repos with version number 1 or 2.")
|
||||
io.tool_output("You may be able to convert your repo: git update-index --index-version=2")
|
||||
io.tool_output("Or run aider --no-git to proceed without using git.")
|
||||
|
|
|
@ -10,7 +10,7 @@ from aider.sendchat import simple_send_with_retries
|
|||
|
||||
from .dump import dump # noqa: F401
|
||||
|
||||
ANY_GIT_ERROR = (git.exc.ODBError, git.exc.GitError, OSError, AssertionError)
|
||||
ANY_GIT_ERROR = (git.exc.ODBError, git.exc.GitError, OSError)
|
||||
|
||||
|
||||
class GitRepo:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue