From cfa37825b011af682bc12047b82d8cec0121fe4e Mon Sep 17 00:00:00 2001
From: yobmod <yobmod@gmail.com>
Date: Thu, 13 May 2021 22:16:54 +0100
Subject: [PATCH] revert util.expand_path() due to regression

---
 git/util.py | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/git/util.py b/git/util.py
index 300183101..ef8ea8d6c 100644
--- a/git/util.py
+++ b/git/util.py
@@ -382,13 +382,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