diff options
author | Sebastian Thiel <sebastian.thiel@icloud.com> | 2021-05-14 09:21:30 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-14 09:21:30 +0800 |
commit | 572bbb39bf36fecb502c9fdf251b760c92080e1e (patch) | |
tree | 8c9ea1d658e69bb623a657a02e42881ecd072f24 /git/util.py | |
parent | e76b5379cf55fcd31a2e8696fb97adf8c4df1a8d (diff) | |
parent | cfa37825b011af682bc12047b82d8cec0121fe4e (diff) | |
download | gitpython-572bbb39bf36fecb502c9fdf251b760c92080e1e.tar.gz |
Merge pull request #1240 from Yobmod/addtypes
revert util.expand_path() due to regression
Diffstat (limited to 'git/util.py')
-rw-r--r-- | git/util.py | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/git/util.py b/git/util.py index 403e66a6..220901a4 100644 --- a/git/util.py +++ b/git/util.py @@ -381,13 +381,10 @@ def expand_path(p: PathLike, expand_vars: bool = ...) -> str: def expand_path(p: Union[None, PathLike], expand_vars: bool = True) -> Optional[str]: try: - if p is not None: - p_out = osp.expanduser(p) - if expand_vars: - p_out = osp.expandvars(p_out) - return osp.normpath(osp.abspath(p_out)) - else: - return None + p = osp.expanduser(p) # type: ignore + if expand_vars: + p = osp.expandvars(p) # type: ignore + return osp.normpath(osp.abspath(p)) # type: ignore except Exception: return None |