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

Re: [PATCH v2 2/2] fetch: send "refs/tags/" prefix upon CLI refspecs

From
JTJonathan Tan <jonathantanmy@google.com>
Date
Jun 18, 2018, 21:07 UTC
Message-ID
<20180618210731.152140-1-jonathantanmy@google.com>
In-Reply-To
<xmqq1sd3yii2.fsf@gitster-ct.c.googlers.com>
Show 26 quoted lines
> Jonathan Tan <jonathantanmy@google.com> writes:
> 
> > When performing tag following, in addition to using the server's
> > "include-tag" capability to send tag objects (and emulating it if the
> > server does not support that capability), "git fetch" relies upon the
> > presence of refs/tags/* entries in the initial ref advertisement to
> > locally create refs pointing to the aforementioned tag objects. When
> > using protocol v2, refs/tags/* entries in the initial ref advertisement
> > may be suppressed by a ref-prefix argument, leading to the tag object
> > being downloaded, but the ref not being created.
> 
> I wonder if it is reasonable to define the protocol v2 semantics of
> "include-tag" request a bit differently.
> 
> Unlike v0 protocol where the client iterates though the advertised
> refs and see if objects at the tip of them, even if they weren't
> what the client initially wanted to fetch, to find these unsolicited
> followed tag objects, allow the server to say, "I've included some
> objects you did not explicitly ask for, and here are the refs/tags/*
> names you should place on them", somewhat similar to the way how the
> ref-in-want thing would work (i.e. the client does not really ask
> for just objects and decides what name to place on them---instead it
> lets the server to make part of the decision).
> 
> Wouldn't that allow us not having to advertise the whole tags
> namespace only to implement the tag following?

Yes, it would, but as far as I can tell, it would add an extra burden on the server to walk all refs requested in the ls-refs call (in order to determine which tags to send back in the response). Also, this walk must be done before any negotiation (since this is a ls-refs call), so the walk is done all the way to the commits without any parents (and so an overestimate of tags might be sent).

It might be better to have this functionality with ref-in-want, not only because of its conceptual similarity, but because ref-in-want provides a way for us to send refs at packfile generation time. So it is more efficient (since the server has to iterate through all the refs anyway to include objects for include-tag, it can probably just remember which refs caused objects to be added and return them), and also, the list of tags will not include any tags that point to non-sent objects.

So my current inclination is to let v2 "include-tag" have the same semantics as v0 "include-tag", and only provide automatic sending of the ref itself when we have ref-in-want.

Previous: Junio C HamanoNext: Junio C Hamano
Message 16 of 23 in “Fix protocol v2 tag following with CLI refspec”
  1. 0/2 Fix protocol v2 tag following with CLI refspecJonathan Tan, Jun 5, 2018
  2. 1/2 t5702: test fetch with multiple refspecs at a timeJonathan Tan, Jun 5, 2018
  3. 2/2 fetch: send "refs/tags/" prefix upon CLI refspecsJonathan Tan, Jun 5, 2018
  4. Brandon WilliamsJun 5, 2018
  5. Brandon WilliamsJun 5, 2018
  6. 0/2 Fix protocol v2 tag following with CLI refspecJonathan Tan, Jun 5, 2018
  7. 1/2 t5702: test fetch with multiple refspecs at a timeJonathan Tan, Jun 5, 2018
  8. Stefan BellerJun 18, 2018
  9. Jonathan TanJun 18, 2018
  10. Stefan BellerJun 18, 2018
  11. 2/2 fetch: send "refs/tags/" prefix upon CLI refspecsJonathan Tan, Jun 5, 2018
  12. Stefan BellerJun 18, 2018
  13. Jonathan TanJun 18, 2018
  14. Brandon WilliamsJun 18, 2018
  15. Junio C HamanoJun 18, 2018
  16. Jonathan TanJun 18, 2018
  17. Junio C HamanoJun 18, 2018
  18. Jonathan TanJun 18, 2018
  19. Jonathan NiederJul 9, 2018
  20. Brandon WilliamsJul 9, 2018
  21. Junio C HamanoJul 9, 2018
  22. Brandon WilliamsJul 9, 2018
  23. Junio C HamanoJul 9, 2018

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.