summaryrefslogtreecommitdiff
path: root/git/util.py
diff options
context:
space:
mode:
Diffstat (limited to 'git/util.py')
-rw-r--r--git/util.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/git/util.py b/git/util.py
index b7d18023..9668f7b3 100644
--- a/git/util.py
+++ b/git/util.py
@@ -222,7 +222,7 @@ def _cygexpath(drive, path):
# It's an error, leave it alone just slashes)
p = path
else:
- p = osp.normpath(osp.expandvars(os.path.expanduser(path)))
+ p = path and osp.normpath(osp.expandvars(os.path.expanduser(path)))
if osp.isabs(p):
if drive:
# Confusing, maybe a remote system should expand vars.
@@ -278,6 +278,18 @@ def cygpath(path):
return path
+_decygpath_regex = re.compile(r"/cygdrive/(\w)(/.*)?")
+
+
+def decygpath(path):
+ m = _decygpath_regex.match(path)
+ if m:
+ drive, rest_path = m.groups()
+ path = '%s:%s' % (drive.upper(), rest_path or '')
+
+ return path.replace('/', '\\')
+
+
#: Store boolean flags denoting if a specific Git executable
#: is from a Cygwin installation (since `cache_lru()` unsupported on PY2).
_is_cygwin_cache = {}