GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Is gitdb an implementation detail? · Issue #933 · gitpython-developers/GitPython

Is gitdb an implementation detail? #933

New issue
Copy link
New issue
Copy link
Closed as not planned
Task
Closed as not planned
Is gitdb an implementation detail?#933
Task
Copy link
Labels
acknowledgedhelp wanted

Description

@tucked
tucked
opened on Oct 10, 2019
Issue body actions
git.Repo(path).commit(bad_hash)

This raises gitdb.exc.BadName (which is not catchable with git.exc.GitError "Base class for all package exceptions").

Do I need to catch gitdb exceptions too? I don't have a dep on gitdb otherwise.

Reacted by Jean-Claude Graf

Activity

  1. stsewd commented on Oct 10, 2019

    @stsewd
    stsewd
    on Oct 10, 2019
    Contributor
    More actions

    Yes, gitdb is part of the requirements https://gitpython.readthedocs.io/en/stable/intro.html#requirements

  2. tucked commented on Oct 10, 2019

    @tucked
    tucked
    on Oct 10, 2019
    Author
    More actions

    Those are GitPython's requirements, though, not my requirements...
    For example, gitdb2 depends on smmap, but GitPython doesn't have that in its requirements.txt.

  3. Byron
    added
    acknowledged
    help wanted
    on Oct 10, 2019
  4. Byron commented on Oct 10, 2019

    @Byron
    Byron
    on Oct 10, 2019
    Member
    More actions

    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 the git <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 Tucker
  5. tucked commented on Oct 11, 2019

    @tucked
    tucked
    on Oct 11, 2019
    Author
    More actions

    That 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:

    GitPython/git/repo/fun.py

    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.BadName directly which works because GitPython imports gitdb exceptions:

    GitPython/git/exc.py

    Line 8 in 23b83cd

    from gitdb.exc import * # NOQA @UnusedWildImport

    Reacted by Sebastian Thiel
  6. Byron commented on Oct 15, 2019

    @Byron
    Byron
    on Oct 15, 2019
    Member
    More actions

    @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
  7. Byron
    added the
    Task
    issue type on Jul 20, 2026
  8. Byron
    closed this as not plannedon Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    acknowledgedhelp wanted

    Type

    Task

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402520 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.