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

Re: [PATCH 02/13] setup: mark bogus worktree in `apply_repository_format()`

From
Patrick Steinhardt <ps@pks.im>
Date
Jul 7, 2026, 06:25 UTC
Message-ID
<akyb3o5yG4QMSudd@pks.im>
In-Reply-To
<akwfAmyeIVJYXj1h@denethor>
On Mon, Jul 06, 2026 at 04:49:41PM -0500, Justin Tobler wrote:
> On 26/06/30 01:47PM, Patrick Steinhardt wrote:
[snip]
Show 9 quoted lines
> > Note that this change requires us to also explicitly unset the value of
> > "core.worktree" in case we have the "GIT_WORK_TREE" environment variable
> > set. This is because the environment variable overrides the repository's
> > configuration, and we don't want to warn or die in case the work tree
> > has been configured explicitly regardless of whether or not "core.bare"
> > is set.
> 
> Hmmm, does this mean we now just silently ignore the misconfiguration if
> done via environment variable?

We do, but we also ignored those cases before. So the behaviour with and without this change is (supposed) to be the exact same.

Show 18 quoted lines
> > diff --git a/setup.c b/setup.c
> > index 118416e350..f54eac5e5a 100644
> > --- a/setup.c
> > +++ b/setup.c
> > @@ -1768,6 +1767,12 @@ int apply_repository_format(struct repository *repo,
> >  	if (verify_repository_format(format, err) < 0)
> >  		return -1;
> >  
> > +	if (format->is_bare > 0 && format->work_tree) {
> > +		/* #22.2, #30 */
> > +		warning("core.bare and core.worktree do not make sense");
> > +		repo->worktree_config_is_bogus = true;
> > +	}
> 
> We now perform this validation in `apply_repository_format()`. Does
> deferring this check have any meaningful impact? Or is
> `apply_repository_format()` always called after
> `setup_explicit_git_dir()`?

No, it shouldn't have an impact on any user-visible behaviour. We always call `apply_repository_format()` eventually, as that function is what does the final setup of our repository.

Patrick
Previous: Justin ToblerNext: Patrick Steinhardt
Message 8 of 24 in “setup: split up repository discovery and setup”
  1. 00/13 setup: split up repository discovery and setupPatrick Steinhardt, Jun 30, 2026
  2. 01/13 setup: rename `check_repository_format_gently()`Patrick Steinhardt, Jun 30, 2026
  3. Justin ToblerJul 6, 2026
  4. 02/13 setup: mark bogus worktree in `apply_repository_format()`Patrick Steinhardt, Jun 30, 2026
  5. Junio C HamanoJun 30, 2026
  6. Patrick SteinhardtJul 1, 2026
  7. Justin ToblerJul 6, 2026
  8. Patrick SteinhardtJul 7, 2026
  9. 03/13 setup: unify setup of shallow filePatrick Steinhardt, Jun 30, 2026
  10. Justin ToblerJul 6, 2026
  11. Patrick SteinhardtJul 7, 2026
  12. 04/13 setup: split up concerns of `setup_git_env_internal()`Patrick Steinhardt, Jun 30, 2026
  13. 05/13 setup: introduce explicit repository discoveryPatrick Steinhardt, Jun 30, 2026
  14. Justin ToblerJul 6, 2026
  15. Patrick SteinhardtJul 7, 2026
  16. 06/13 setup: embed repository format in discoveryPatrick Steinhardt, Jun 30, 2026
  17. 07/13 setup: move prefix into repositoryPatrick Steinhardt, Jun 30, 2026
  18. Justin ToblerJul 6, 2026
  19. 08/13 setup: drop static `cwd` variablePatrick Steinhardt, Jun 30, 2026
  20. 09/13 setup: propagate prefix via repository discoveryPatrick Steinhardt, Jun 30, 2026
  21. 10/13 setup: make repository discovery self-containedPatrick Steinhardt, Jun 30, 2026
  22. 11/13 setup: drop redundant configuration of `startup_info->have_repository`Patrick Steinhardt, Jun 30, 2026
  23. 12/13 setup: pass worktree to `init_db()`Patrick Steinhardt, Jun 30, 2026
  24. 13/13 setup: mark `set_git_work_tree()` as file-localPatrick Steinhardt, Jun 30, 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.