diff options
author | Sebastian Thiel <byronimo@gmail.com> | 2016-10-22 11:11:25 +0200 |
---|---|---|
committer | Sebastian Thiel <byronimo@gmail.com> | 2016-10-22 11:11:25 +0200 |
commit | caa0ea7a0893fe90ea043843d4e6ad407126d7b8 (patch) | |
tree | 2f688eb182f2e76091134c47c4a327681c12e15b /git/cmd.py | |
parent | afcd64ebbb770908bd2a751279ff070dea5bb97c (diff) | |
parent | cc77e6b2862733a211c55cf29cc7a83c36c27919 (diff) | |
download | gitpython-caa0ea7a0893fe90ea043843d4e6ad407126d7b8.tar.gz |
Merge branch 'cygwin' of https://github.com/ankostis/GitPython into ankostis-cygwin
Diffstat (limited to 'git/cmd.py')
-rw-r--r-- | git/cmd.py | 23 |
1 files changed, 21 insertions, 2 deletions
@@ -31,6 +31,7 @@ from git.compat import ( ) from git.exc import CommandError from git.odict import OrderedDict +from git.util import is_cygwin_git, cygpath from .exc import ( GitCommandError, @@ -191,8 +192,26 @@ class Git(LazyMixin): USE_SHELL = False @classmethod - def polish_url(cls, url): - return url.replace("\\\\", "\\").replace("\\", "/") + def is_cygwin(cls): + return is_cygwin_git(cls.GIT_PYTHON_GIT_EXECUTABLE) + + @classmethod + def polish_url(cls, url, is_cygwin=None): + if is_cygwin is None: + is_cygwin = cls.is_cygwin() + + if is_cygwin: + url = cygpath(url) + else: + """Remove any backslahes from urls to be written in config files. + + Windows might create config-files containing paths with backslashed, + but git stops liking them as it will escape the backslashes. + Hence we undo the escaping just to be sure. + """ + url = url.replace("\\\\", "\\").replace("\\", "/") + + return url class AutoInterrupt(object): """Kill/Interrupt the stored process instance once this instance goes out of scope. It is |