Improve types of @unbare_repo and @git_working_dir decorators · gitpython-developers/GitPython@6471018 · GitHub
Skip to content

Commit 6471018

Browse files
committed
Improve types of @unbare_repo and @git_working_dir decorators
1 parent 3ce319f commit 6471018

3 files changed

Lines changed: 7 additions & 6 deletions

File tree

git/index/base.py

Lines changed: 3 additions & 3 deletions

git/index/util.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
from typing import (Any, Callable)
1515

16-
from git.types import PathLike
16+
from git.types import PathLike, _T
1717

1818
# ---------------------------------------------------------------------------------
1919

@@ -88,12 +88,12 @@ def check_default_index(self, *args: Any, **kwargs: Any) -> Any:
8888
return check_default_index
8989

9090

91-
def git_working_dir(func: Callable[..., Any]) -> Callable[..., None]:
91+
def git_working_dir(func: Callable[..., _T]) -> Callable[..., _T]:
9292
"""Decorator which changes the current working dir to the one of the git
9393
repository in order to assure relative paths are handled correctly"""
9494

9595
@wraps(func)
96-
def set_git_working_dir(self, *args: Any, **kwargs: Any) -> None:
96+
def set_git_working_dir(self, *args: Any, **kwargs: Any) -> _T:
9797
cur_wd = os.getcwd()
9898
os.chdir(self.repo.working_tree_dir)
9999
try:

git/types.py

Lines changed: 1 addition & 0 deletions

0 commit comments

Comments
 (0)