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

Re: [PATCH 0/2] negotiator: improve recent behavior + docs

From
JTJonathan Tan <jonathantanmy@google.com>
Date
Sep 27, 2018, 19:41 UTC
Message-ID
<20180927194125.8380-1-jonathantanmy@google.com>
In-Reply-To
<87in4tu6wb.fsf@evledraar.gmail.com>
Show 22 quoted lines
> > If you wanted to do this, it seems better to me to just declare a "null"
> > negotiation algorithm that does not perform any negotiation at all.
> 
> I think such an algorithm is a good idea in general, especially for
> testing, and yeah, maybe that's the best way out of this, i.e. to do:
> 
>     if git rev-parse {}/HEAD 2>/dev/null
>     then
>         git fetch --negotiation-tip={}/HEAD {}
>     else
>         git -c fetch.negotiationAlgorithm=null fetch {}
>     fi
> 
> Would such an algorithm be added by overriding default.c's add_tip
> function to never add anything by calling default_negotiator_init()
> followed by null_negotiator_init(), which would only override add_tip?
> (yay C OO)
> 
> If so from fetch-pack.c it looks like there may be the limitation on the
> interface that the negotiator can't exit early (in
> fetch-pack.c:mark_tips). But I've just skimmed this, so maybe I've
> missed something.
(I was reminded to reply to this offlist - sorry for the late reply.)

I think too many things need to be replaced (known_common, add_tip, and ack all need to do nothing), so it's best to start from scratch. That way, we also don't need to deal with the subtleties of C OO :-)

> Also, looks like because of the current interface =null and
> --negotiation-tip=* would (somewhat confusingly) do a "real" negotiation
> if done that way, since it'll bypass the API and insert tips for it to
> negotiate, but it looks like overriding next() will get around that.

If you do it as I suggest (in particular, add_tip doing nothing) then there is the opposite problem that it won't be easy to inform the user that --negotiation-tip does nothing in this case. Maybe there needs to be an "accepts_tips" field in struct fetch_negotiator that, if false, means that custom tips (or any tips) are not accepted, allowing the caller of the negotiator to print a warning message in this case.

Previous: Ævar Arnfjörð BjarmasonNext: Ævar Arnfjörð Bjarmason
Message 13 of 17 in “negotiator/skipping: skip commits during fetch”
  1. negotiator/skipping: skip commits during fetchJonathan Tan, Jul 16, 2018
  2. Junio C HamanoJul 16, 2018
  3. Johannes SchindelinJul 26, 2018
  4. Johannes SchindelinJul 26, 2018
  5. Jonathan TanJul 26, 2018
  6. Johannes SchindelinJul 27, 2018
  7. Johannes SchindelinAug 3, 2018
  8. Ævar Arnfjörð BjarmasonJul 31, 2018
  9. Jonathan TanJul 31, 2018
  10. 0/2 negotiator: improve recent behavior + docsÆvar Arnfjörð Bjarmason, Aug 1, 2018
  11. Jonathan TanAug 1, 2018
  12. Ævar Arnfjörð BjarmasonAug 1, 2018
  13. Jonathan TanSep 27, 2018
  14. Ævar Arnfjörð BjarmasonSep 27, 2018
  15. Jonathan TanSep 27, 2018
  16. 1/2 negotiator: unknown fetch.negotiationAlgorithm should error outÆvar Arnfjörð Bjarmason, Aug 1, 2018
  17. 2/2 fetch doc: cross-link two new negotiation optionsÆvar Arnfjörð Bjarmason, Aug 1, 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.