浏览代码

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 月之前
父节点
当前提交
88c145a976
共有 1 个文件被更改,包括 4 次插入0 次删除
  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