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

Re: [PATCH v5 04/16] promisor-remote: implement promisor_remote_get_direct()

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
May 31, 2019, 11:35 UTC
Message-ID
<nycvar.QRO.7.76.6.1905311332560.44@tvgsbejvaqbjf.bet>
In-Reply-To
<2329a4c7-bfb9-10ce-9d1c-8c754d6dee05@gmail.com>
Hi Stolee,
On Thu, 30 May 2019, Derrick Stolee wrote:
Show 42 quoted lines
> On 5/30/2019 4:46 PM, Johannes Schindelin wrote:
> >
> > On Thu, 30 May 2019, Derrick Stolee wrote:
> >
> >> On 4/9/2019 12:11 PM, Christian Couder wrote:
> >>> From: Christian Couder <christian.couder@gmail.com>
> >>>
> >>> +{
> >>> +	int i, missing_nr = 0;
> >>> +	int *missing = xcalloc(oid_nr, sizeof(*missing));
> >>> +	struct object_id *old_oids = *oids;
> >>> +	struct object_id *new_oids;
> >>> +	int old_fetch_if_missing = fetch_if_missing;
> >>> +
> >>> +	fetch_if_missing = 0;
> >>
> >> This global 'fetch_if_missing' swap seems very fragile. I'm guessing you
> >> are using it to prevent a loop when calling oid_object_info_extended()
> >> below. Can you instead pass a flag to the method that disables the
> >> fetch_if_missing behavior?
> >
> > FWIW I mentioned the very same concern here:
> > https://public-inbox.org/git/nycvar.QRO.7.76.6.1903272300020.41@tvgsbejvaqbjf.bet/
> >
> > The situation is *pretty* bad by now. I see `fetch_if_missing` mentioned
> > 25 times in `master`, and all but one are in .c files or in cache.h.
> >
> > The flag is actually used only in `oid_object_info_extended()`, and that
> > function accepts an `unsigned flags`, so one might think that it could be
> > extended to accept also a `OBJECT_INFO_LOOKUP_FETCH_IF_MISSING`. But then,
> > there are many callers of that function, some of them also pretty low in
> > the food chain. For example, `oid_object_info()` (does not accept `flags`)
> > or `read_object()` (does not accept flags either).
> >
> > So it looks as if the idea to pass this flag down the call chain entailed
> > a pretty serious avalanche effect.
>
> It could be approached in small bits.
>
> First, add an OBJECT_INFO_NEVER_FETCH_IF_MISSING flag that overrides
> fetch_if_missing, and then use the flag in small places like this one.
> Then, build up to the other methods as appropriate.

That is a good idea. I fear that it will still take a Herculean effort to get there, as some of the call paths strike me as rather deep...

Show 6 quoted lines
> > An alternative that strikes me as inelegant, still, but nevertheless
> > better would be to move `fetch_if_missing` into `struct repository`.
>
> This is literally the _least_ we should do to reduce our dependence on
> globals. Maybe this happens first, then the flag idea could be done bits
> at a time.

Okay, then, I added https://github.com/gitgitgadget/git/issues/251 so we won't forget.

BTW I am rather happy about the way the GitGitGadget issues turn out: I added a couple of left-over bits, and could already close two tickets after other developers pointed out that they had already been addressed, something an unsuspecting GSoC student, for example, could not otherwise have found out very easily (or for that matter, I myself...).

Ciao, Dscho

Previous: Derrick StoleeNext: Junio C Hamano
Message 11 of 28 in “Many promisor remotes”
  1. 00/16 Many promisor remotesChristian Couder, Apr 9, 2019
  2. 01/16 t0410: remove pipes after git commandsChristian Couder, Apr 9, 2019
  3. 02/16 fetch-object: make functions return an error codeChristian Couder, Apr 9, 2019
  4. 03/16 Add initial support for many promisor remotesChristian Couder, Apr 9, 2019
  5. 05/16 promisor-remote: add promisor_remote_reinit()Christian Couder, Apr 9, 2019
  6. 06/16 promisor-remote: use repository_format_partial_cloneChristian Couder, Apr 9, 2019
  7. 04/16 promisor-remote: implement promisor_remote_get_direct()Christian Couder, Apr 9, 2019
  8. Derrick StoleeMay 30, 2019
  9. Johannes SchindelinMay 30, 2019
  10. Derrick StoleeMay 30, 2019
  11. Johannes SchindelinMay 31, 2019
  12. Junio C HamanoMay 31, 2019
  13. Christian CouderMay 31, 2019
  14. Christian CouderJun 25, 2019
  15. 07/16 Use promisor_remote_get_direct() and has_promisor_remote()Christian Couder, Apr 9, 2019
  16. 08/16 diff: use promisor-remote.h instead of fetch-object.hChristian Couder, Apr 9, 2019
  17. 09/16 promisor-remote: parse remote.*.partialclonefilterChristian Couder, Apr 9, 2019
  18. 10/16 builtin/fetch: remove unique promisor remote limitationChristian Couder, Apr 9, 2019
  19. 12/16 partial-clone: add multiple remotes in the docChristian Couder, Apr 9, 2019
  20. 11/16 t0410: test fetching from many promisor remotesChristian Couder, Apr 9, 2019
  21. 13/16 remote: add promisor and partial clone config to the docChristian Couder, Apr 9, 2019
  22. 14/16 Remove fetch-object.{c,h} in favor of promisor-remote.{c,h}Christian Couder, Apr 9, 2019
  23. 15/16 Move repository_format_partial_clone to promisor-remote.cChristian Couder, Apr 9, 2019
  24. 16/16 Move core_partial_clone_filter_default to promisor-remote.cChristian Couder, Apr 9, 2019
  25. Junio C HamanoApr 15, 2019
  26. Junio C HamanoApr 15, 2019
  27. Christian CouderApr 15, 2019
  28. Christian CouderApr 15, 2019

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.