Commit Diff


commit - d440d64f2e95346d38a0a068769456e891a0c82d
commit + 754b5b4a4c9c63e894ff15d9fc8383fc2a390532
blob - 8b22a3d8f1e586113a2440400fbbb7caee331c5d
blob + 8c54a1ae7a8e69e18e2e8c04f9362ff99208800c
--- tests/compat/test_client.py
+++ 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: