changeset 5159:c44885d0e546 stable

vcs: added proper windows quoting to git commands (Issue #135) Git repositories could not be forked on windows.
author Matthias Zilk <matthias.zilk@gmail.com>
date Fri, 22 May 2015 23:56:50 +0200
parents 442d81c381dc
children 0e03fb3384df
files kallithea/lib/vcs/backends/git/repository.py
diffstat 1 files changed, 12 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/lib/vcs/backends/git/repository.py	Wed May 13 01:26:45 2015 +0200
+++ b/kallithea/lib/vcs/backends/git/repository.py	Fri May 22 23:56:50 2015 +0200
@@ -17,12 +17,18 @@
 import logging
 import posixpath
 import string
-try:
-    # Python <=2.7
-    from pipes import quote
-except ImportError:
-    # Python 3.3+
-    from shlex import quote
+import sys
+if sys.platform == "win32":
+    from subprocess import list2cmdline
+    def quote(s):
+        return list2cmdline([s])
+else:
+    try:
+        # Python <=2.7
+        from pipes import quote
+    except ImportError:
+        # Python 3.3+
+        from shlex import quote
 
 from dulwich.objects import Tag
 from dulwich.repo import Repo, NotGitRepository