Przeglądaj źródła

gitolite requires single quotes (') around the repository name.

Thomas Liebetraut 9 lat temu
rodzic
commit
47ca2d0883

+ 1 - 1
dulwich/client.py

@@ -909,7 +909,7 @@ class SSHGitClient(TraditionalGitClient):
             raise TypeError(path)
         if path.startswith(b"/~"):
             path = path[1:]
-        argv = self._get_cmd_path(cmd) + [path]
+        argv = self._get_cmd_path(cmd) + ["'" + path + "'"]
         con = self.ssh_vendor.run_command(
             self.host, argv, port=self.port, username=self.username)
         return (Protocol(con.read, con.write, con.close,

+ 1 - 0
dulwich/tests/compat/test_client.py

@@ -326,6 +326,7 @@ class TestSSHVendor(object):
     def run_command(host, command, username=None, port=None):
         cmd, path = command
         cmd = cmd.split(b'-', 1)
+        path = path.replace("'", "")
         p = subprocess.Popen(cmd + [path], bufsize=0, env=get_safe_env(), stdin=subprocess.PIPE,
                              stdout=subprocess.PIPE, stderr=subprocess.PIPE)
         return client.SubprocessWrapper(p)

+ 2 - 2
dulwich/tests/test_client.py

@@ -560,10 +560,10 @@ class SSHGitClientTests(TestCase):
         client._connect(b"command", b"/path/to/repo")
         self.assertEqual(b"username", server.username)
         self.assertEqual(1337, server.port)
-        self.assertEqual([b"git-command", b"/path/to/repo"], server.command)
+        self.assertEqual([b"git-command", b"'/path/to/repo'"], server.command)
 
         client._connect(b"relative-command", b"/~/path/to/repo")
-        self.assertEqual([b"git-relative-command", b"~/path/to/repo"],
+        self.assertEqual([b"git-relative-command", b"'~/path/to/repo'"],
                           server.command)