소스 검색

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 개월 전
부모
커밋
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