use git.exc not gitdb.exc

This commit is contained in:
Paul Gauthier 2024-08-31 08:21:07 -07:00
parent 01964ca294
commit c32a991b2c
2 changed files with 2 additions and 4 deletions

View file

@ -6,7 +6,6 @@ import threading
from pathlib import Path from pathlib import Path
import git import git
import gitdb
from dotenv import load_dotenv from dotenv import load_dotenv
from prompt_toolkit.enums import EditingMode from prompt_toolkit.enums import EditingMode
@ -57,7 +56,7 @@ def make_new_repo(git_root, io):
try: try:
repo = git.Repo.init(git_root) repo = git.Repo.init(git_root)
check_gitignore(git_root, io, False) check_gitignore(git_root, io, False)
except (gitdb.exc.ODBError, git.exc.GitCommandNotFound) as err: # issue #1233 except (git.exc.ODBError, git.exc.GitCommandNotFound) as err: # issue #1233
io.tool_error(f"Unable to create git repo in {git_root}") io.tool_error(f"Unable to create git repo in {git_root}")
io.tool_error(str(err)) io.tool_error(str(err))
return return

View file

@ -3,7 +3,6 @@ import time
from pathlib import Path, PurePosixPath from pathlib import Path, PurePosixPath
import git import git
import gitdb
import pathspec import pathspec
from aider import prompts, utils from aider import prompts, utils
@ -376,7 +375,7 @@ class GitRepo:
def get_head_commit(self): def get_head_commit(self):
try: try:
return self.repo.head.commit return self.repo.head.commit
except (ValueError, gitdb.exc.ODBError): except (ValueError, git.exc.ODBError):
return None return None
def get_head_commit_sha(self, short=False): def get_head_commit_sha(self, short=False):