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 — 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
Copy link
New issue
Copy link
Closed
#1859
Closed
Wrong type annotation on Index.commit for parent_commits#1866
#1859
Copy link
Labels
acknowledged

Description

@mshonichev
mshonichev
opened on Mar 12, 2024
Issue body actions

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

Activity

  1. Byron
    added
    acknowledged
    on Mar 12, 2024
  2. Byron commented on Mar 12, 2024

    @Byron
    Byron
    on Mar 12, 2024
    Member
    More actions

    Thanks for reporting!

    I think this issue might be fixed once #1859, which touches on what constitutes Commit_ish. @EliahKagan certainly has a much better understanding of the matter though, and I wouldn't want the PR to become larger than it has to be just to include an actual fix (if it's not fixed naturally).

  3. EliahKagan commented on Mar 12, 2024

    @EliahKagan
    EliahKagan
    on Mar 12, 2024
    Member
    More actions

    Yes, this is part of what #1859 fixes (b4b6e1e).

  4. mshonichev commented on Mar 12, 2024

    @mshonichev
    mshonichev
    on Mar 12, 2024
    Author
    More actions

    Great! Wow, just understood, that @Byron at stack overflow threads related to GitPython is actually the package maintainer, so silly of me :). Nice to meet, looking forward PR

  5. Byron
    closed this as completedin #1859on Mar 14, 2024
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

    acknowledged

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — 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.