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

Re: [PATCH 12/13] odb: handle changing a repository's commondir

From
Patrick Steinhardt <ps@pks.im>
Date
Nov 21, 2025, 08:12 UTC
Message-ID
<aSAfAJscjYHAg3Mc@pks.im>
In-Reply-To
<xmqq34687414.fsf@gitster.g>
On Thu, Nov 20, 2025 at 02:06:15PM -0800, Junio C Hamano wrote:
Show 28 quoted lines
> Patrick Steinhardt <ps@pks.im> writes:
> 
> > -static void set_git_dir_1(const char *path)
> > +static void setup_git_env_internal(const char *git_dir,
> > +				   bool skip_initializing_odb)
> > +{
> 
> Hopefully we won't gain too many callers of this function, and ...
> 
> > +static void set_git_dir_1(const char *path, bool skip_initializing_odb)
> >  {
> 
> ... this function, as ...
> 
> > -	set_git_dir_1(path);
> > +	set_git_dir_1(path, true);
> > ...
> > -	set_git_dir_1(path);
> > +	set_git_dir_1(path, false);
> 
> ... it is almost impossible to tell from the call site which one is
> for initializing the ODB (hint: "true" does initialize the ODB, oh,
> no it is the other way around, or is it correct?  now everybody is
> confused).
> 
> We could do "enum { INIT_DB, NO_INIT_DB }" instead of bool and the
> calling sites would become self-describing, but as long as we won't
> have too many calling sites, the current code should be OK.

Quite frankly, the whole "setup.c" file could use a makeover. I would claim it's almost impossible to understand the different flows we have here, and the setup of a repository (or `the_reposiory`) is awfully complex and non-obvious.

Some ICs in my team might tackle this in the Git 2.53 release cycle, hopefully.

Patrick
Previous: Junio C HamanoNext: Patrick Steinhardt
Message 20 of 21 in “Centralize management of object database sources”
  1. 00/13 Centralize management of object database sourcesPatrick Steinhardt, Nov 19, 2025
  2. 01/13 path: move `enter_repo()` into "setup.c"Patrick Steinhardt, Nov 19, 2025
  3. 02/13 setup: convert `set_git_dir()` to have file scopePatrick Steinhardt, Nov 19, 2025
  4. 03/13 odb: adopt logic to close object databasesPatrick Steinhardt, Nov 19, 2025
  5. 04/13 odb: refactor `odb_clear()` to `odb_free()`Patrick Steinhardt, Nov 19, 2025
  6. 05/13 odb: move logic to disable ref updates into repoPatrick Steinhardt, Nov 19, 2025
  7. Junio C HamanoNov 19, 2025
  8. Patrick SteinhardtNov 21, 2025
  9. 06/13 oidset: introduce `oidset_equal()`Patrick Steinhardt, Nov 19, 2025
  10. Junio C HamanoNov 19, 2025
  11. 07/13 builtin/index-pack: fix deferred fsck outside reposPatrick Steinhardt, Nov 19, 2025
  12. Junio C HamanoNov 19, 2025
  13. Patrick SteinhardtNov 21, 2025
  14. 08/13 t/helper: stop setting up `the_repository` repeatedlyPatrick Steinhardt, Nov 19, 2025
  15. 09/13 http-push: stop setting up `the_repository` for each referencePatrick Steinhardt, Nov 19, 2025
  16. 10/13 odb: handle initialization of sources in `odb_new()`Patrick Steinhardt, Nov 19, 2025
  17. 11/13 chdir-notify: add function to unregister listenersPatrick Steinhardt, Nov 19, 2025
  18. 12/13 odb: handle changing a repository's commondirPatrick Steinhardt, Nov 19, 2025
  19. Junio C HamanoNov 20, 2025
  20. Patrick SteinhardtNov 21, 2025
  21. 13/13 odb: handle recreation of quarantine directoriesPatrick Steinhardt, Nov 19, 2025

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.