summaryrefslogtreecommitdiff
path: root/git/cmd.py
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2016-10-22 11:11:25 +0200
committerSebastian Thiel <byronimo@gmail.com>2016-10-22 11:11:25 +0200
commitcaa0ea7a0893fe90ea043843d4e6ad407126d7b8 (patch)
tree2f688eb182f2e76091134c47c4a327681c12e15b /git/cmd.py
parentafcd64ebbb770908bd2a751279ff070dea5bb97c (diff)
parentcc77e6b2862733a211c55cf29cc7a83c36c27919 (diff)
downloadgitpython-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.py23
1 files changed, 21 insertions, 2 deletions
diff --git a/git/cmd.py b/git/cmd.py
index ddce9824..72ba82c3 100644
--- a/git/cmd.py
+++ b/git/cmd.py
@@ -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