← Winnitude! Search  ·  Reader Mode (964 ms)
Links: Stay in Reader Retro Site Converter Retro Mode: OFF Original Page ↗
GITHUB · 12 LINKS

Wrong type annotation on `Index.commit` for `parent_commits` · Issue #1866 · gitpython-developers/GitPython

Wrong type annotation on Index.commit for parent_commits  #1866


New issue

New issue

Closed
#1859
Closed
Wrong type annotation on Index.commit for parent_commits #1866 #1859 Labels
acknowledged

Description

@mshonichev's profile mshonichev opened on Mar 12, 2024

With GitPython==3.1.42 one can observe following annotation of parent_commits argument to IndexFile.commit ([1]):

...
parent_commits: Union[Commit_ish, None] = None,
...

which is obviously not correct, because that argument just passed unmodified downwards to Commit.create_from_tree, which has following annotation instead ([2]):

parent_commits: Union[None, List["Commit"]] = None

That leads to nasty Mypy warnings when one's trying to use IndexFile.commit with anything different than None.


[1] - https://github.com/gitpython-developers/GitPython/blob/3.1.42/git/index/base.py#L1080
[2] - https://github.com/gitpython-developers/GitPython/blob/3.1.42/git/objects/commit.py#L506

Metadata

Metadata

Assignees

No one assigned

    Labels


    acknowledged

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions