Browse Source

Fixed parsing of HTTP Git URLs

Bruno Renié 13 years ago
parent
commit
80a341c0b6
2 changed files with 8 additions and 2 deletions
  1. 1 2
      dulwich/client.py
  2. 7 0
      dulwich/tests/test_client.py

+ 1 - 2
dulwich/client.py

@@ -715,8 +715,7 @@ def get_transport_and_path(uri):
         return SSHGitClient(parsed.hostname, port=parsed.port,
                             username=parsed.username), parsed.path
     elif parsed.scheme in ('http', 'https'):
-        return HttpGitClient(urlparse.urlunparse(
-            parsed.scheme, parsed.netloc, path='/'))
+        return HttpGitClient(urlparse.urlunparse(parsed)), parsed.path
 
     if parsed.scheme and not parsed.netloc:
         # SSH with no user@, zero or one leading slash.

+ 7 - 0
dulwich/tests/test_client.py

@@ -23,6 +23,7 @@ from dulwich.client import (
     TCPGitClient,
     SubprocessGitClient,
     SSHGitClient,
+    HttpGitClient,
     ReportStatusParser,
     SendPackError,
     UpdateRefsError,
@@ -137,6 +138,12 @@ class GitClientTests(TestCase):
         self.assertRaises(ValueError, get_transport_and_path,
         'prospero://bar/baz')
 
+    def test_get_transport_and_path_http(self):
+        url = 'https://github.com/jelmer/dulwich'
+        client, path = get_transport_and_path(url)
+        self.assertTrue(isinstance(client, HttpGitClient))
+        self.assertEquals('/jelmer/dulwich', path)
+
 
 class SSHGitClientTests(TestCase):