Fix GitError being raised in initial `import git` by terminalmage · Pull Request #658 · gitpython-developers/GitPython

@terminalmage

This catches any raise of one of the custom exceptions defined in
`git.exc` during the imports in the dunder init, and raises an
`ImportError` in those cases.

terminalmage added a commit to terminalmage/GitPython that referenced this pull request

Jun 1, 2018
This is related to my fix in gitpython-developers#658. Apparently, MacOS adds a git
executable that is just a stub which displays an error. This gets past
the try/except I added in gitpython-developers#658, and allows all of the GitPython
components to be imported, but since the executable is not *actually*
git, it results in an exception when ``refresh()`` attemepts to run a
``git version``.

This was referenced

Jun 1, 2018

Byron pushed a commit that referenced this pull request

Jun 5, 2018
This is related to my fix in #658. Apparently, MacOS adds a git
executable that is just a stub which displays an error. This gets past
the try/except I added in #658, and allows all of the GitPython
components to be imported, but since the executable is not *actually*
git, it results in an exception when ``refresh()`` attemepts to run a
``git version``.

riley-martine pushed a commit to riley-martine/GitPython that referenced this pull request

Dec 7, 2023
Fix GitError being raised in initial `import git`

riley-martine pushed a commit to riley-martine/GitPython that referenced this pull request

Dec 7, 2023
This is related to my fix in gitpython-developers#658. Apparently, MacOS adds a git
executable that is just a stub which displays an error. This gets past
the try/except I added in gitpython-developers#658, and allows all of the GitPython
components to be imported, but since the executable is not *actually*
git, it results in an exception when ``refresh()`` attemepts to run a
``git version``.