git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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
Next: Jeff King
Message 1 of 4 in “Extra request with protocol v2 and git ls-remote”
  1. brian m. carlsonJan 8, 2020
  2. transport: don't flush when disconnecting stateless-rpc helperJeff King, Jan 8, 2020
  3. brian m. carlsonJan 8, 2020
  4. Derrick StoleeJan 8, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.