So here, we are partial-cloning from a shallow remote and some objects are not sent due to our clone filters. Let's say that the shallow remote has a 5-commit history and we are cloning it into another repository with a blob:none filter. The expected behavior is cloning the 5 commits, with no blobs, except for the HEAD. When executing the above process, it leads to errors: fatal: the remote end hung up unexpectedly fatal: protocol error: bad pack header warning: Clone succeeded, but checkout failed You can inspect what was checked out with 'git status' and retry with 'git restore --source=HEAD :/' I looked into it a bit and it seems that packet_read() is not successful. I'm not really sure how packet reading fits into the big picture but it looks like the buffer is not read completely. It is a similar case with "bad pack header" too. The function read_pack_header() fails because the pack header was not fully read. Also, is the shallow object not sent when cloning due to the partial clone filter and hence a subsequent fetching is done to ask for this object? If so, then will such a fetch counted as an args->update_shallow?