diff options
author | DWesl <22566757+DWesl@users.noreply.github.com> | 2022-06-10 18:13:06 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-10 18:13:06 -0400 |
commit | 3fc07acfc9a9824307cf1c41c5bfa4ed7f760f50 (patch) | |
tree | a4154abca88dd62c8cf49b5220f53c3163fda8ad /git/util.py | |
parent | a67862c6d9e6835382ebbb255ad3a121c4cdc6a7 (diff) | |
download | gitpython-3fc07acfc9a9824307cf1c41c5bfa4ed7f760f50.tar.gz |
ENH: Update cygpath recodes to work with all installs
People can change the `/cygdrive` prefix for mounting Windows drives; `/` and `/mnt` are both popular. `/proc/cygdrive` is always going to have the drive letters under it.
Diffstat (limited to 'git/util.py')
-rw-r--r-- | git/util.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/git/util.py b/git/util.py index e55f15d3..6a4a6557 100644 --- a/git/util.py +++ b/git/util.py @@ -310,7 +310,7 @@ def _cygexpath(drive: Optional[str], path: str) -> str: else: p = cygpath(p) elif drive: - p = "/cygdrive/%s/%s" % (drive.lower(), p) + p = "/proc/cygdrive/%s/%s" % (drive.lower(), p) p_str = str(p) # ensure it is a str and not AnyPath return p_str.replace("\\", "/") @@ -334,7 +334,7 @@ def cygpath(path: str) -> str: """Use :meth:`git.cmd.Git.polish_url()` instead, that works on any environment.""" path = str(path) # ensure is str and not AnyPath. # Fix to use Paths when 3.5 dropped. or to be just str if only for urls? - if not path.startswith(("/cygdrive", "//")): + if not path.startswith(("/cygdrive", "//", "/proc/cygdrive")): for regex, parser, recurse in _cygpath_parsers: match = regex.match(path) if match: @@ -348,7 +348,7 @@ def cygpath(path: str) -> str: return path -_decygpath_regex = re.compile(r"/cygdrive/(\w)(/.*)?") +_decygpath_regex = re.compile(r"(?:/proc)?/cygdrive/(\w)(/.*)?") def decygpath(path: PathLike) -> str: |