Repository navigation
Is gitdb an implementation detail? #933
Description
Activity
Yes,
gitdbis part of the requirements https://gitpython.readthedocs.io/en/stable/intro.html#requirementsThose are GitPython's requirements, though, not my requirements...
For example,gitdb2depends onsmmap, butGitPythondoesn't have that in itsrequirements.txt.Thanks for posting! I believe this is indeed an issue, and it's worth fixing for better usability and less surprises.
Historically, GitDB was meant as standalone low-level library anyone could use, but practically it's only used by GitPython. And if memory serves, at some point I did my best to reduce the dependency by using thegit <command>backend instead. However, depending on the method, GitDB is still used as indicated here.I believe everyone would benefit by removing or merging GitDB into GitPython for good, and PRs are very welcome.
Reacted by Santos Gallegos and David TuckerThat sounds like a big task... In the meantime, maybe something like this could suffice:
try: gitdb.op() except gitdb.exc.ODBError as exc: raise git.exc.GitDBError from exc
Actually though, I just realized that GitPython (not GitDB) is raising
gitdb.exc.BadName:
Line 147 in 23b83cd
raise BadName(name) So, maybe more like:
class BadName(git.exc.GitError, gitdb.exc.BadName): pass raise BadName(name)
edit: FWIW, my workaround is to catch
git.exc.BadNamedirectly which works because GitPython importsgitdbexceptions:
Line 8 in 23b83cd
from gitdb.exc import * # NOQA @UnusedWildImport Reacted by Sebastian Thiel@tucked Wow, fantastic write up! I would be so happy if this could be fixed for everyone with what seems like a small PR. (Still catching up on emails, maybe the PR is already there)
Reacted by David Tucker and Jean-Claude Graf
This raises
gitdb.exc.BadName(which is not catchable withgit.exc.GitError"Base class for all package exceptions").Do I need to catch
gitdbexceptions too? I don't have a dep ongitdbotherwise.