Commit Diff


commit - e543e98283fde9297ed69e2a25168e4c1ca56ba3
commit + 26344f80565be46e3d97014f055d027ce72b5def
blob - 02d2acd706a90f271fe2780d6b328ec51f5fc700
blob + 1d14db8be813ca5db392fb5a9d0017148f943716
--- dulwich/client.py
+++ dulwich/client.py
@@ -545,7 +545,7 @@ def _handle_upload_pack_head(
     wants,
     can_read,
     depth,
-    protocol_version=0,
+    protocol_version=None,
 ):
     """Handle the head of a 'git-upload-pack' request.
 
@@ -561,6 +561,8 @@ def _handle_upload_pack_head(
     """
     assert isinstance(wants, list) and isinstance(wants[0], bytes)
     wantcmd = COMMAND_WANT + b" " + wants[0]
+    if protocol_version is None:
+        protocol_version = 0
     if protocol_version != 2:
         wantcmd += b" " + b" ".join(sorted(capabilities))
     wantcmd += b"\n"