From: Justin Tobler Date: Mon, 06 Jul 2026 22:33:36 GMT Subject: Re: [PATCH 07/13] setup: move prefix into repository Message-ID: In-Reply-To: <20260630-pks-setup-split-discovery-and-setup-v1-7-13864eb5a032@pks.im> On 26/06/30 01:47PM, Patrick Steinhardt wrote: > The repository prefix is currently stored in the startup info. This > feels somewhat awkward though, as it is inherently a property of a given > repository. Agreed. > Move the prefix into the repository accordingly. > > Signed-off-by: Patrick Steinhardt > --- [snip] > @@ -832,7 +832,8 @@ int cmd_rev_parse(int argc, > prefix = argv[++i]; > if (!prefix) > die(_("--prefix requires an argument")); > - startup_info->prefix = prefix; > + FREE_AND_NULL(the_repository->prefix); > + the_repository->prefix = xstrdup(prefix); git-rev-parse(1) has an option to explicitly set the prefix and we honor that here. [snip] > @@ -2105,10 +2105,10 @@ const char *setup_git_directory_gently(struct repository *repo, int *nongit_ok) > */ > if (prefix) { > prefix = precompose_string_if_needed(prefix); > - startup_info->prefix = prefix; > + repo->prefix = xstrdup(prefix); > setenv(GIT_PREFIX_ENVIRONMENT, prefix, 1); > } else { > - startup_info->prefix = NULL; > + FREE_AND_NULL(repo->prefix); > setenv(GIT_PREFIX_ENVIRONMENT, "", 1); > } We set the startup_info prefix here is `setup_git_directory_gently()` aleady, so we might as well just set it in the repository. I think this is a good change. -Justin