commit 6322250a9af5c57abec2d06badfe67e89c0c0278 from: Seppo Yli-Olli via: GitHub date: Mon Aug 21 06:46:56 2023 UTC Raise GitProtocolError on unexpected pkt There are some packets (like NAK) which have no sha. This does not change them to be handled but you get in exception always the command that failed to be unpacked instead of strange exception about there not being enough values to unpack. commit - 4af6b54c4cdae8dbfd19cc0da92660d53239127e commit + 6322250a9af5c57abec2d06badfe67e89c0c0278 blob - bf6b9086caaaf69f33873e012000da2e0f9e5e4d blob + 881c45f7ed5d6595a88ed25e0a37af2239e99e2c --- dulwich/client.py +++ dulwich/client.py @@ -413,7 +413,10 @@ def _read_shallow_updates(pkt_seq): new_shallow = set() new_unshallow = set() for pkt in pkt_seq: - cmd, sha = pkt.split(b" ", 1) + try: + cmd, sha = pkt.split(b" ", 1) + except ValueError: + raise GitProtocolError("unknown command %s" % pkt) if cmd == COMMAND_SHALLOW: new_shallow.add(sha.strip()) elif cmd == COMMAND_UNSHALLOW: