Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

typing fixes - DiffIndex generic type and IndexFile items #1925

Merged
merged 2 commits into from
Jun 3, 2024
Merged

typing fixes - DiffIndex generic type and IndexFile items #1925

merged 2 commits into from
Jun 3, 2024

Conversation

Andrej730
Copy link
Contributor

Example issue with DiffIndex:

repo = git.Repo(path_dir)
diff = repo.index.diff(None)
modified_files = [d for d in repo.index.diff(None)]
reveal_type(modified_files) # list[Unknown] instead of list[Diff]

Example issue with IndexFile:

path: os.PathLike = ...
repo = git.Repo(path_dir)
# Argument of type "PathLike[Unknown]"
# cannot be assigned to parameter "items" of type "Sequence[git.types.PathLike | Blob | BaseIndexEntry | Submodule]" in function "add"
# "PathLike[Unknown]" is incompatible with "Sequence[git.types.PathLike | Blob | BaseIndexEntry | Submodule]"
repo.index.add(path)

Andrej730 added 2 commits June 3, 2024 00:32
Error before commit:

path: os.PathLike = ...
repo = git.Repo(path_dir)
repo.index.add(path)
Example before this commit:

repo = git.Repo(path_dir)
diff = repo.index.diff(None)
modified_files = [d for d in repo.index.diff(None)]
reveal_type(modified_files) # list[Unknown] instead of list[Diff]
Copy link
Member

@Byron Byron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for the typing fix, it's much appreciated.

@Byron Byron merged commit e51bfdf into gitpython-developers:main Jun 3, 2024
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants