Skip to content

repo.blame should allow passing None as the rev parameter. #1835

Description

@Gaubbe

This issue only affects the type hint given to the rev parameter, as passing None to the function does work and gives the expected behavior, which is running the git blame -p -- <file> command without a revision, which gives back the blame including changes to the local working directory that haven't been committed yet.

While the code works at runtime, language servers such as pylance give back an error, as None is not a valid type according to the type hints.

Activity

  1. Byron commented on Feb 21, 2024

    @Byron
    Member

    Thanks for sharing your finding!

    It does seems to make sense to adjust the annotations to explicitly allow this use-case.

  2. Gaubbe commented on Feb 22, 2024

    @Gaubbe
    ContributorAuthor

    I'll gladly make a pull request with the fix if you or other contributors don't have anything more to say about this issue.

    Are there any other places in the code that comes to mind for which such a fix could also make sense? The only other git command that I use without specifiying a revision is git diff, but the Diffable interface seems to already support passing None as the other parameter.

  3. Byron commented on Feb 22, 2024

    @Byron
    Member

    Thanks for offering! It's OK to keep the PR focussed on the problem at hand.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions