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

Re: [PATCH 4/4] upload-pack: only accept packfile-uris if we advertised it

From
Jeff King <peff@peff.net>
Date
Mar 1, 2024, 07:10 UTC
Message-ID
<20240301071041.GA2682168@coredump.intra.peff.net>
In-Reply-To
<xmqqmsrji5zr.fsf@gitster.g>
On Thu, Feb 29, 2024 at 08:34:48AM -0800, Junio C Hamano wrote:
Show 12 quoted lines
> > Otherwise the server complains that the other side did not respect its
> > advertised object-format (I sure am glad to have included the final
> > "hey, this input works, right?" test there, as that is what caught it).
> 
> Ah, good finding.  Will use it to amend.
> 
> I wonder if it is still worth testing if the command is happy with
> an input that lacks object-format capability under SHA-1 mode.  This
> test piece is primarily about packfile-uris, so in that sense, we
> are not all that interested in that unspecified client object-format
> defaults to the initial value of serve.c:client_hash_algo (which is
> SHA-1), and not testing that here is perfectly fine, I guess.

Yeah, if we want to test it, I'd prefer to do so separately as its own test rather than keeping it as a subtle side effect of this one. I looked around to see if it might exist already, but I didn't find one (OTOH, it is hard to grep for since we are looking for the _absence_ of an object-format line in hand-crafted input).

But taking a step back, why do we care about this case? It is because older clients that speak v2 but do not yet know about object-format will make a request without it, and they should still work in sha1 mode. So the more general thing to test here is whether those older versions can successfully fetch from a newer server.

There are tests in t/interop for cloning and fetching from a different version. I kind of doubt anybody runs them regularly, though (and picking the interesting versions to find this case isn't entirely trivial). So I dunno.

-Peff
Previous: Junio C HamanoNext: Patrick Steinhardt
Message 10 of 15 in “some v2 capability advertisement cleanups”
  1. 0/4 some v2 capability advertisement cleanupsJeff King, Feb 28, 2024
  2. 1/4 upload-pack: use repository struct to get configJeff King, Feb 28, 2024
  3. Patrick SteinhardtMar 4, 2024
  4. 2/4 upload-pack: centralize setup of sideband-all configJeff King, Feb 28, 2024
  5. 3/4 upload-pack: use existing config mechanism for advertisementJeff King, Feb 28, 2024
  6. 4/4 upload-pack: only accept packfile-uris if we advertised itJeff King, Feb 28, 2024
  7. Junio C HamanoFeb 28, 2024
  8. Jeff KingFeb 29, 2024
  9. Junio C HamanoFeb 29, 2024
  10. Jeff KingMar 1, 2024
  11. Patrick SteinhardtMar 4, 2024
  12. Junio C HamanoFeb 28, 2024
  13. Jeff KingFeb 29, 2024
  14. Patrick SteinhardtMar 4, 2024
  15. Jeff KingMar 4, 2024

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.