Przeglądaj źródła

client: Ensure thin_packs parameter is honored with git protocol v2

With git protocol v2, requesting a thin pack must be done through an
argument to the fetch command sent to the git server.

This was missed when the initial support of git protocol v2 was
introduced in 2b975ec.
Antoine Lambert 3 miesięcy temu
rodzic
commit
88c145a976
1 zmienionych plików z 4 dodań i 0 usunięć
  1. 4 0
      dulwich/client.py

+ 4 - 0
dulwich/client.py

@@ -1415,6 +1415,8 @@ class TraditionalGitClient(GitClient):
             if self.protocol_version == 2:
                 proto.write_pkt_line(b"command=fetch\n")
                 proto.write(b"0001")  # delim-pkt
+                if CAPABILITY_THIN_PACK in self._fetch_capabilities:
+                    proto.write(pkt_line(b"thin-pack\n"))
                 if (
                     find_capability(
                         negotiated_capabilities, CAPABILITY_FETCH, CAPABILITY_FILTER
@@ -2693,6 +2695,8 @@ class AbstractHttpGitClient(GitClient):
         )
         if self.protocol_version == 2:
             data = pkt_line(b"command=fetch\n") + b"0001"
+            if CAPABILITY_THIN_PACK in self._fetch_capabilities:
+                data += pkt_line(b"thin-pack\n")
             if (
                 find_capability(
                     negotiated_capabilities, CAPABILITY_FETCH, CAPABILITY_FILTER