Extra request with protocol v2 and git ls-remote
- From
brian m. carlson <sandals@crustytoothpaste.net>
- Date
- Jan 8, 2020, 03:34 UTC
- Message-ID
- <20200108033451.GN6570@camp.crustytoothpaste.net>
A colleague (Jon Simons) today pointed out an interesting behavior of git ls-remote with protocol v2: it makes a second POST request and sends only a flush packet. This can be demonstrated with the following:
GIT_CURL_VERBOSE=1 git -c protocol.version=2 ls-remote origin
The Content-Length header on the second request will be exactly 4 bytes.
I'm not sure exactly how to fix this by looking at remote-curl.c, but I suspect that we can avoid sending a request if all we're going to do is send a flush packet. If I were a bit more familiar with the code, I'd send a patch, but I'm not.
I just thought I'd point this out since it was surprising to me.
-- brian m. carlson: Houston, Texas, US OpenPGP: https://keybase.io/bk2204