2
0
Эх сурвалжийг харах

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 1 сар өмнө
parent
commit
88c145a976

+ 4 - 0
dulwich/client.py

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