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

Re: [PATCH v2 16/17] midx: refactor interfaces to work on "packed" source

From
Patrick Steinhardt <ps@pks.im>
Date
Jun 17, 2026, 07:26 UTC
Message-ID
<ajJMNk5eMYR0CjJx@pks.im>
In-Reply-To
<ajHKmbimHJnFV2IE@denethor>
On Tue, Jun 16, 2026 at 05:37:53PM -0500, Justin Tobler wrote:
Show 24 quoted lines
> On 26/06/09 10:51AM, Patrick Steinhardt wrote:
> > diff --git a/builtin/multi-pack-index.c b/builtin/multi-pack-index.c
> > index 00ffb36394..6e73c85cde 100644
> > --- a/builtin/multi-pack-index.c
> > +++ b/builtin/multi-pack-index.c
> > @@ -85,12 +86,12 @@ static int parse_object_dir(const struct option *opt, const char *arg,
> >  	return 0;
> >  }
> >  
> > -static struct odb_source *handle_object_dir_option(struct repository *repo)
> > +static struct odb_source_files *handle_object_dir_option(struct repository *repo)
> >  {
> >  	struct odb_source *source = odb_find_source(repo->objects, opts.object_dir);
> >  	if (!source)
> >  		source = odb_add_to_alternates_memory(repo->objects, opts.object_dir);
> > -	return source;
> > +	return odb_source_files_downcast(source);
> 
> Now that we are passing around concrete ODB sources to many of these
> interfaces, callers may have to handle downcasting explicitly. Since now
> the downcasting may happen a bit ealier than previously in some cases, I
> wondered if this would alter any error flows. I don't think this would
> be the case though because ultimately we only have the "files" source
> currently anyways.

Well, we'd be calling `BUG()` all the same. So as we don't have conditional logic anywhere (yet?) that checks whether or not we use the "files" backend all error flows are expected to ultimately be the same. It's only that we may `BUG()` a bit earlier, but I guess the user is going to be somewhat indifferent about this.

Patrick
Previous: Justin ToblerNext: Patrick Steinhardt
Message 59 of 85 in “odb: make packed object source a proper `struct odb_source`”
  1. 00/16 odb: make packed object source a proper `struct odb_source`Patrick Steinhardt, Jun 4, 2026
  2. 01/16 packfile: rename `struct packfile_store` to `odb_source_packed`Patrick Steinhardt, Jun 4, 2026
  3. Karthik NayakJun 5, 2026
  4. Patrick SteinhardtJun 8, 2026
  5. 02/16 packfile: move packed source into "odb/" subsystemPatrick Steinhardt, Jun 4, 2026
  6. Karthik NayakJun 8, 2026
  7. Patrick SteinhardtJun 9, 2026
  8. 03/16 odb/source-packed: store pointer to "files" instead of generic sourcePatrick Steinhardt, Jun 4, 2026
  9. 04/16 odb/source-packed: start converting to a proper `struct odb_source`Patrick Steinhardt, Jun 4, 2026
  10. Karthik NayakJun 8, 2026
  11. Patrick SteinhardtJun 9, 2026
  12. Patrick SteinhardtJun 9, 2026
  13. 05/16 odb/source-packed: wire up `close()` callbackPatrick Steinhardt, Jun 4, 2026
  14. Karthik NayakJun 8, 2026
  15. 06/16 odb/source-packed: wire up `reprepare()` callbackPatrick Steinhardt, Jun 4, 2026
  16. 07/16 packfile: use higher-level interface to implement `has_object_pack()`Patrick Steinhardt, Jun 4, 2026
  17. Karthik NayakJun 8, 2026
  18. 08/16 odb/source-packed: wire up `read_object_info()` callbackPatrick Steinhardt, Jun 4, 2026
  19. 09/16 odb/source-packed: wire up `read_object_stream()` callbackPatrick Steinhardt, Jun 4, 2026
  20. 10/16 odb/source-packed: wire up `for_each_object()` callbackPatrick Steinhardt, Jun 4, 2026
  21. 11/16 odb/source-packed: wire up `count_objects()` callbackPatrick Steinhardt, Jun 4, 2026
  22. Karthik NayakJun 8, 2026
  23. Patrick SteinhardtJun 9, 2026
  24. 12/16 odb/source-packed: wire up `find_abbrev_len()` callbackPatrick Steinhardt, Jun 4, 2026
  25. 13/16 odb/source-packed: wire up `freshen_object()` callbackPatrick Steinhardt, Jun 4, 2026
  26. 14/16 odb/source-packed: stub out remaining functionsPatrick Steinhardt, Jun 4, 2026
  27. 15/16 midx: refactor interfaces to work on "packed" sourcePatrick Steinhardt, Jun 4, 2026
  28. 16/16 odb/source-packed: drop pointer to "files" parent sourcePatrick Steinhardt, Jun 4, 2026
  29. Karthik NayakJun 8, 2026
  30. Patrick SteinhardtJun 9, 2026
  31. 00/17 odb: make packed object source a proper `struct odb_source`Patrick Steinhardt, Jun 9, 2026
  32. 01/17 packfile: rename `struct packfile_store` to `odb_source_packed`Patrick Steinhardt, Jun 9, 2026
  33. Justin ToblerJun 16, 2026
  34. 02/17 packfile: split out packfile list logicPatrick Steinhardt, Jun 9, 2026
  35. 03/17 packfile: move packed source into "odb/" subsystemPatrick Steinhardt, Jun 9, 2026
  36. 04/17 odb/source-packed: store pointer to "files" instead of generic sourcePatrick Steinhardt, Jun 9, 2026
  37. Justin ToblerJun 16, 2026
  38. Justin ToblerJun 16, 2026
  39. Patrick SteinhardtJun 17, 2026
  40. 05/17 odb/source-packed: start converting to a proper `struct odb_source`Patrick Steinhardt, Jun 9, 2026
  41. Justin ToblerJun 16, 2026
  42. Patrick SteinhardtJun 17, 2026
  43. 06/17 odb/source-packed: wire up `close()` callbackPatrick Steinhardt, Jun 9, 2026
  44. 07/17 odb/source-packed: wire up `reprepare()` callbackPatrick Steinhardt, Jun 9, 2026
  45. Justin ToblerJun 16, 2026
  46. Patrick SteinhardtJun 17, 2026
  47. 08/17 packfile: use higher-level interface to implement `has_object_pack()`Patrick Steinhardt, Jun 9, 2026
  48. 09/17 odb/source-packed: wire up `read_object_info()` callbackPatrick Steinhardt, Jun 9, 2026
  49. 10/17 odb/source-packed: wire up `read_object_stream()` callbackPatrick Steinhardt, Jun 9, 2026
  50. 11/17 odb/source-packed: wire up `for_each_object()` callbackPatrick Steinhardt, Jun 9, 2026
  51. Justin ToblerJun 16, 2026
  52. Patrick SteinhardtJun 17, 2026
  53. 12/17 odb/source-packed: wire up `count_objects()` callbackPatrick Steinhardt, Jun 9, 2026
  54. 13/17 odb/source-packed: wire up `find_abbrev_len()` callbackPatrick Steinhardt, Jun 9, 2026
  55. 14/17 odb/source-packed: wire up `freshen_object()` callbackPatrick Steinhardt, Jun 9, 2026
  56. 15/17 odb/source-packed: stub out remaining functionsPatrick Steinhardt, Jun 9, 2026
  57. 16/17 midx: refactor interfaces to work on "packed" sourcePatrick Steinhardt, Jun 9, 2026
  58. Justin ToblerJun 16, 2026
  59. Patrick SteinhardtJun 17, 2026
  60. 17/17 odb/source-packed: drop pointer to "files" parent sourcePatrick Steinhardt, Jun 9, 2026
  61. Justin ToblerJun 16, 2026
  62. Patrick SteinhardtJun 17, 2026
  63. 00/17 odb: make packed object source a proper `struct odb_source`Patrick Steinhardt, Jun 17, 2026
  64. 01/17 packfile: rename `struct packfile_store` to `odb_source_packed`Patrick Steinhardt, Jun 17, 2026
  65. 02/17 packfile: split out packfile list logicPatrick Steinhardt, Jun 17, 2026
  66. 03/17 packfile: move packed source into "odb/" subsystemPatrick Steinhardt, Jun 17, 2026
  67. 04/17 odb/source-packed: store pointer to "files" instead of generic sourcePatrick Steinhardt, Jun 17, 2026
  68. 05/17 odb/source-packed: start converting to a proper `struct odb_source`Patrick Steinhardt, Jun 17, 2026
  69. 06/17 odb/source-packed: wire up `close()` callbackPatrick Steinhardt, Jun 17, 2026
  70. 07/17 odb/source-packed: wire up `reprepare()` callbackPatrick Steinhardt, Jun 17, 2026
  71. 08/17 packfile: use higher-level interface to implement `has_object_pack()`Patrick Steinhardt, Jun 17, 2026
  72. 09/17 odb/source-packed: wire up `read_object_info()` callbackPatrick Steinhardt, Jun 17, 2026
  73. 10/17 odb/source-packed: wire up `read_object_stream()` callbackPatrick Steinhardt, Jun 17, 2026
  74. 11/17 odb/source-packed: wire up `for_each_object()` callbackPatrick Steinhardt, Jun 17, 2026
  75. 12/17 odb/source-packed: wire up `count_objects()` callbackPatrick Steinhardt, Jun 17, 2026
  76. 13/17 odb/source-packed: wire up `find_abbrev_len()` callbackPatrick Steinhardt, Jun 17, 2026
  77. 14/17 odb/source-packed: wire up `freshen_object()` callbackPatrick Steinhardt, Jun 17, 2026
  78. 15/17 odb/source-packed: stub out remaining functionsPatrick Steinhardt, Jun 17, 2026
  79. Junio C HamanoJun 18, 2026
  80. Patrick SteinhardtJun 19, 2026
  81. Junio C HamanoJun 19, 2026
  82. 16/17 midx: refactor interfaces to work on "packed" sourcePatrick Steinhardt, Jun 17, 2026
  83. 17/17 odb/source-packed: drop pointer to "files" parent sourcePatrick Steinhardt, Jun 17, 2026
  84. Justin ToblerJun 17, 2026
  85. Junio C HamanoJun 17, 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.