Explorar el Código

Fix repeat HTTP requests using the same smart HTTP client.

Jelmer Vernooij hace 7 años
padre
commit
eee273e3ca
Se han modificado 3 ficheros con 17 adiciones y 1 borrados
  1. 3 0
      NEWS
  2. 1 1
      dulwich/client.py
  3. 13 0
      dulwich/tests/compat/test_client.py

+ 3 - 0
NEWS

@@ -15,6 +15,9 @@
   * Factor out `dulwich.client.parse_rsync_url` function.
     (Jelmer Vernooij)
 
+  * Fix repeat HTTP requests using the same smart HTTP client.
+    (Jelmer Vernooij)
+
  API CHANGES
 
   * Index.iterblobs has been renamed to Index.iterobjects.

+ 1 - 1
dulwich/client.py

@@ -1426,7 +1426,7 @@ class HttpGitClient(GitClient):
         assert base_url[-1] == "/"
         tail = "info/refs"
         headers = {"Accept": "*/*"}
-        if self.dumb is not False:
+        if self.dumb is not True:
             tail += "?service=%s" % service.decode('ascii')
         url = urlparse.urljoin(base_url, tail)
         resp, read = self._http_request(url, headers, allow_compression=True)

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

@@ -210,6 +210,19 @@ class DulwichClientTestBase(object):
                 dest.refs.set_if_equals(r[0], None, r[1])
             self.assertDestEqualsSrc()
 
+    def test_repeat(self):
+        c = self._client()
+        with repo.Repo(os.path.join(self.gitroot, 'dest')) as dest:
+            result = c.fetch(self._build_path('/server_new.export'), dest)
+            for r in result.refs.items():
+                dest.refs.set_if_equals(r[0], None, r[1])
+            self.assertDestEqualsSrc()
+            result = c.fetch(self._build_path('/server_new.export'), dest)
+            for r in result.refs.items():
+                dest.refs.set_if_equals(r[0], None, r[1])
+            self.assertDestEqualsSrc()
+
+
     def test_incremental_fetch_pack(self):
         self.test_fetch_pack()
         dest, dummy = self.disable_ff_and_make_dummy_commit()