mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-24 22:34:59 +00:00
fix: Handle missing git module gracefully
This commit is contained in:
parent
65555b5dd0
commit
f62ef34715
4 changed files with 36 additions and 11 deletions
|
@ -2,7 +2,17 @@ import os
|
|||
import time
|
||||
from pathlib import Path, PurePosixPath
|
||||
|
||||
import git
|
||||
try:
|
||||
import git
|
||||
|
||||
ANY_GIT_ERROR = [
|
||||
git.exc.ODBError,
|
||||
git.exc.GitError,
|
||||
]
|
||||
except ImportError:
|
||||
git = None
|
||||
ANY_GIT_ERROR = []
|
||||
|
||||
import pathspec
|
||||
|
||||
from aider import prompts, utils
|
||||
|
@ -10,15 +20,14 @@ from aider.sendchat import simple_send_with_retries
|
|||
|
||||
from .dump import dump # noqa: F401
|
||||
|
||||
ANY_GIT_ERROR = (
|
||||
git.exc.ODBError,
|
||||
git.exc.GitError,
|
||||
ANY_GIT_ERROR += [
|
||||
OSError,
|
||||
IndexError,
|
||||
BufferError,
|
||||
TypeError,
|
||||
ValueError,
|
||||
)
|
||||
]
|
||||
ANY_GIT_ERROR = tuple(ANY_GIT_ERROR)
|
||||
|
||||
|
||||
class GitRepo:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue