Browse Source

add compat test case which verifies behaviour with a non-default symref

Stefan Sperling 4 months ago
parent
commit
754b5b4a4c
1 changed files with 15 additions and 0 deletions
  1. 15 0
      tests/compat/test_client.py

+ 15 - 0
tests/compat/test_client.py

@@ -234,6 +234,21 @@ class DulwichClientTestBase:
                 dest.refs.set_if_equals(r[0], None, r[1])
             self.assertDestEqualsSrc()
 
+    def test_fetch_pack_with_nondefault_symref(self):
+        c = self._client()
+        src = repo.Repo(os.path.join(self.gitroot, "server_new.export"))
+        src.refs.add_if_new(b"refs/heads/main", src.refs[b"refs/heads/master"])
+        src.refs.set_symbolic_ref(b"HEAD", b"refs/heads/main")
+        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/main"},
+                result.symrefs,
+            )
+            for r in result.refs.items():
+                dest.refs.set_if_equals(r[0], None, r[1])
+            self.assertDestEqualsSrc()
+
     def test_fetch_pack_depth(self):
         c = self._client()
         with repo.Repo(os.path.join(self.gitroot, "dest")) as dest: