Prechádzať zdrojové kódy

fix detection of HEAD symref with protocol v2 over HTTP and add a test case

related to issue #1389
Stefan Sperling 4 mesiacov pred
rodič
commit
d440d64f2e
2 zmenil súbory, kde vykonal 7 pridanie a 1 odobranie
  1. 3 1
      dulwich/client.py
  2. 4 0
      tests/compat/test_client.py

+ 3 - 1
dulwich/client.py

@@ -2609,9 +2609,11 @@ class AbstractHttpGitClient(GitClient):
         )
         (
             negotiated_capabilities,
-            symrefs,
+            capa_symrefs,
             agent,
         ) = self._negotiate_upload_pack_capabilities(server_capabilities)
+        if not symrefs and capa_symrefs:
+            symrefs = capa_symrefs
         if depth is not None:
             wants = determine_wants(refs, depth=depth)
         else:

+ 4 - 0
tests/compat/test_client.py

@@ -226,6 +226,10 @@ class DulwichClientTestBase:
         c = self._client()
         with repo.Repo(os.path.join(self.gitroot, "dest")) as dest:
             result = c.fetch(self._build_path("/server_new.export"), dest)
+            self.assertEqual(
+                {b"HEAD": b"refs/heads/master"},
+                result.symrefs,
+            )
             for r in result.refs.items():
                 dest.refs.set_if_equals(r[0], None, r[1])
             self.assertDestEqualsSrc()