summaryrefslogtreecommitdiff
path: root/git/index/util.py
diff options
context:
space:
mode:
authorYobmod <yobmod@gmail.com>2021-07-06 14:25:23 +0100
committerYobmod <yobmod@gmail.com>2021-07-06 14:25:23 +0100
commit647101833ae276f3b923583e202faa3f7d78e218 (patch)
tree298db9f851fe2f4adc4e48554ca2a79f6faf2da8 /git/index/util.py
parent3ce319f1296a5402079e9280500e96cc1d12fd04 (diff)
downloadgitpython-647101833ae276f3b923583e202faa3f7d78e218.tar.gz
Improve types of @unbare_repo and @git_working_dir decorators
Diffstat (limited to 'git/index/util.py')
-rw-r--r--git/index/util.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/git/index/util.py b/git/index/util.py
index 471e9262..e0daef0c 100644
--- a/git/index/util.py
+++ b/git/index/util.py
@@ -13,7 +13,7 @@ import os.path as osp
from typing import (Any, Callable)
-from git.types import PathLike
+from git.types import PathLike, _T
# ---------------------------------------------------------------------------------
@@ -88,12 +88,12 @@ def default_index(func: Callable[..., Any]) -> Callable[..., Any]:
return check_default_index
-def git_working_dir(func: Callable[..., Any]) -> Callable[..., None]:
+def git_working_dir(func: Callable[..., _T]) -> Callable[..., _T]:
"""Decorator which changes the current working dir to the one of the git
repository in order to assure relative paths are handled correctly"""
@wraps(func)
- def set_git_working_dir(self, *args: Any, **kwargs: Any) -> None:
+ def set_git_working_dir(self, *args: Any, **kwargs: Any) -> _T:
cur_wd = os.getcwd()
os.chdir(self.repo.working_tree_dir)
try: