Type Traversable.traverse() better, start types of submodule · gitpython-developers/GitPython@82b131c · GitHub
Skip to content

Commit 82b131c

Browse files
committed
Type Traversable.traverse() better, start types of submodule
1 parent 75dbf90 commit 82b131c

17 files changed

Lines changed: 352 additions & 156 deletions

File tree

git/config.py

Lines changed: 1 addition & 3 deletions

git/index/base.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# This module is part of GitPython and is released under
55
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
6-
from git.refs.reference import Reference
6+
77
import glob
88
from io import BytesIO
99
import os
@@ -74,6 +74,7 @@
7474
if TYPE_CHECKING:
7575
from subprocess import Popen
7676
from git.repo import Repo
77+
from git.refs.reference import Reference
7778

7879

7980
StageType = int
@@ -1191,7 +1192,7 @@ def handle_stderr(proc: 'Popen[bytes]', iter_checked_out_files: Iterable[PathLik
11911192
assert "Should not reach this point"
11921193

11931194
@default_index
1194-
def reset(self, commit: Union[Commit, Reference, str] = 'HEAD', working_tree: bool = False,
1195+
def reset(self, commit: Union[Commit, 'Reference', str] = 'HEAD', working_tree: bool = False,
11951196
paths: Union[None, Iterable[PathLike]] = None,
11961197
head: bool = False, **kwargs: Any) -> 'IndexFile':
11971198
"""Reset the index to reflect the tree at the given commit. This will not

git/objects/base.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,12 @@
1717

1818
from typing import Any, TYPE_CHECKING, Optional, Union
1919

20-
from git.types import PathLike
20+
from git.types import PathLike, Commit_ish
2121

2222
if TYPE_CHECKING:
2323
from git.repo import Repo
2424
from gitdb.base import OStream
25-
from .tree import Tree
26-
from .blob import Blob
27-
from .tag import TagObject
28-
from .commit import Commit
25+
# from .tree import Tree, Blob, Commit, TagObject
2926

3027
# --------------------------------------------------------------------------
3128

@@ -71,7 +68,7 @@ def new(cls, repo: 'Repo', id): # @ReservedAssignment
7168
return repo.rev_parse(str(id))
7269

7370
@classmethod
74-
def new_from_sha(cls, repo: 'Repo', sha1: bytes) -> Union['Commit', 'TagObject', 'Tree', 'Blob']:
71+
def new_from_sha(cls, repo: 'Repo', sha1: bytes) -> Commit_ish:
7572
"""
7673
:return: new object instance of a type appropriate to represent the given
7774
binary sha1

git/objects/commit.py

Lines changed: 31 additions & 15 deletions

git/objects/output.txt

Whitespace-only changes.

0 commit comments

Comments
 (0)