Subject: Re: [PATCH v2 00/18] setup: drop uses of `the_repository`

From: Patrick Steinhardt <[email-masked]>
Date: Tue, 19 May 2026 11:51:51 +0200

On Tue, May 19, 2026 at 02:26:35AM -0700, Karthik Nayak wrote:
> Patrick Steinhardt <[email-masked]> writes:
> 
> > Hi,
> >
> > I've had enough of "setup.c" and its complexities, so I finally decided
> > to take the bullet and start refactoring this subsystem. This here is
> > the first out of the following three steps:
> >
> >   1. Drop all uses of `the_repository`. This doesn't yet allow us to get
> >      rid of `USE_THE_REPOSITORY_VARIABLE`.
> >
> >   2. Convert a couple of global variables and drop
> >      `is_bare_repository_cfg`, which then allows us to drop
> >      `USE_THE_REPOSITORY_VARIABLE`.
> >
> >   3. Refactor the subsystem a bit so that we stop intermixing repository
> >      discovery and repository initialization. This is my original
> >      motivation as I want to get rid of `odb_prepare_alternates()`, but
> >      due to the way we initialize the repository it has proven to be
> >      extremely tedious.
> >
> > Most of the patches in this series here are rather mechanical. There's
> > only a handful of patches that warrant more attention:
> >
> >   -  2/18: setup: stop using `the_repository` in `is_inside_worktree()`
> >   -  3/18: setup: stop using `the_repository` in `is_inside_git_dir()`
> >   -  9/18: setup: stop using `the_repository` in `setup_work_tree()`
> >   - 10/18: setup: stop using `the_repository` in `set_git_work_tree()`
> >
> 
> I think the series looks to be in a good state, I left some small nits,
> feel free to ignore.

I'll send one more round to address your feedback. Thanks!

Patrick