Skip to content

Commit

Permalink
Don't patch IndexObject and Object into git.objects.submodule.util
Browse files Browse the repository at this point in the history
Such patching, which was introduced in 9519f18, seems no longer to
be necessary. Since git.objects.submodule.util.__all__ has existed
for a long time without including those names, they are not
conceptually public attributes of git.objects.submodule.util, so
they should not be in use by any code outside GitPython either.

The modattrs.py script shows the change, as expected, showing these
two names as no longer being in the git.objects.submodule.util
module dictionary, in output of:

    python modattrs.py >b
    git diff --no-index a b

However, because the removal is intentional, this is okay.
  • Loading branch information
EliahKagan committed Mar 18, 2024
1 parent c58be4c commit 01c95eb
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions git/objects/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,10 @@
from .base import * # noqa: F403
from .blob import * # noqa: F403
from .commit import * # noqa: F403
from .submodule import util as smutil
from .submodule.base import * # noqa: F403
from .submodule.root import * # noqa: F403
from .tag import * # noqa: F403
from .tree import * # noqa: F403

# Fix import dependency - add IndexObject to the util module, so that it can be imported
# by the submodule.base.
smutil.IndexObject = IndexObject # type: ignore[attr-defined] # noqa: F405
smutil.Object = Object # type: ignore[attr-defined] # noqa: F405
del smutil

# Must come after submodule was made available.
__all__ = [name for name, obj in locals().items() if not (name.startswith("_") or inspect.ismodule(obj))]

0 comments on commit 01c95eb

Please sign in to comment.