catch all git.exc.ODBError

This commit is contained in:
Paul Gauthier 2024-08-31 08:24:53 -07:00
parent c32a991b2c
commit 72c9ac460b
5 changed files with 9 additions and 9 deletions

View file

@ -57,6 +57,7 @@ def make_new_repo(git_root, io):
repo = git.Repo.init(git_root)
check_gitignore(git_root, io, False)
except (git.exc.ODBError, git.exc.GitCommandNotFound) as err: # issue #1233
# git.exc.GitCommandNotFound is not a subclass of git.exc.ODBError
io.tool_error(f"Unable to create git repo in {git_root}")
io.tool_error(str(err))
return
@ -114,7 +115,8 @@ def check_gitignore(git_root, io, ask=True):
repo = git.Repo(git_root)
if repo.ignored(".aider"):
return
except git.exc.InvalidGitRepositoryError:
except (git.exc.ODBError, git.exc.GitCommandNotFound):
# git.exc.GitCommandNotFound is not a subclass of git.exc.ODBError
pass
pat = ".aider*"