git/list[1] front-page[2] threads[3] people[4] search[5] about
wed 2026-10-07 17:03 UTC

Re: [PATCH 04/13] odb: refactor `odb_for_each_alternate()` to yield dirs

From
Karthik Nayak <karthik.188@gmail.com>
Date
Oct 6, 2026, 08:42 UTC
Message-ID
<CAOLa=ZT-=VQNXBs=i8ZkB1yZoJV_i_n90S+Ygdgt5=tmquVOOA@mail.gmail.com>
In-Reply-To
<20261002-pks-odb-move-alternates-v1-4-8a63507b88c4@pks.im>
Patrick Steinhardt <ps@pks.im> writes:
[snip]
Show 25 quoted lines
> @@ -468,9 +470,11 @@ static int refs_from_alternate_cb(struct odb_source *alternate,
>  void odb_for_each_alternate_ref(struct object_database *odb,
>  				odb_for_each_alternate_ref_fn cb, void *payload)
>  {
> -	struct alternate_refs_data data;
> -	data.fn = cb;
> -	data.payload = payload;
> +	struct alternate_refs_data data = {
> +		.fn = cb,
> +		.payload = payload,
> +		.repo = odb->repo,
> +	};
>  	odb_for_each_alternate(odb, refs_from_alternate_cb, &data);
>  }
>
> @@ -481,7 +485,7 @@ int odb_for_each_alternate(struct object_database *odb,
>  	int r = 0;
>
>  	for (alternate = odb->sources->next; alternate; alternate = alternate->next) {
> -		r = cb(alternate, payload);
> +		r = cb(odb_source_files_downcast(alternate)->dirs, payload);
>  		if (r)
>  			break;
>  	}
>

Okay, so here we call the callbacks with the `dirs` now and this corresponds with the changes in the rest of the patch. Makes sense.

[snip]
Previous: Karthik NayakNext: Patrick Steinhardt
Message 17 of 26 in “odb/source-files: move alternates into the backend”
  1. 00/13 odb/source-files: move alternates into the backendPatrick Steinhardt, Oct 2, 2026
  2. 01/13 commit-graph: require resolved packfile paths for `stdin_packs`Patrick Steinhardt, Oct 2, 2026
  3. 02/13 commit-graph: stop depending on `struct odb_source`Patrick Steinhardt, Oct 2, 2026
  4. 03/13 odb/source-files: introduce `struct odb_files_dir`Patrick Steinhardt, Oct 2, 2026
  5. 04/13 odb: refactor `odb_for_each_alternate()` to yield dirsPatrick Steinhardt, Oct 2, 2026
  6. 05/13 odb: refactor `odb_find_source()` to yield dirsPatrick Steinhardt, Oct 2, 2026
  7. 06/13 odb/source-files: add the ability to have multiple object dirsPatrick Steinhardt, Oct 2, 2026
  8. 07/13 tmp-objdir: absorb logic to set and restore primary sourcesPatrick Steinhardt, Oct 2, 2026
  9. 08/13 tmp-objdir: manage quarantine as an object directoryPatrick Steinhardt, Oct 2, 2026
  10. 09/13 tmp-objdir: replace primary source at creation timePatrick Steinhardt, Oct 2, 2026
  11. 10/13 odb/source: make `will_destroy` an implementation detailPatrick Steinhardt, Oct 2, 2026
  12. 11/13 odb/source-files: extract reading alternatesPatrick Steinhardt, Oct 2, 2026
  13. 12/13 odb/source-files: move alternates into the backendPatrick Steinhardt, Oct 2, 2026
  14. 13/13 odb/source: drop `read_alternates` callbackPatrick Steinhardt, Oct 2, 2026
  15. Karthik NayakOct 5, 2026
  16. Karthik NayakOct 5, 2026
  17. Karthik NayakOct 6, 2026
  18. Patrick SteinhardtOct 6, 2026
  19. Patrick SteinhardtOct 6, 2026
  20. Karthik NayakOct 6, 2026
  21. Karthik NayakOct 6, 2026
  22. Karthik NayakOct 6, 2026
  23. Karthik NayakOct 6, 2026
  24. Karthik NayakOct 6, 2026
  25. Patrick SteinhardtOct 7, 2026
  26. Patrick SteinhardtOct 7, 2026

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.