Re: [PATCH v2 3/8] setup: don't apply "GIT_REFERENCE_BACKEND" without a repository
On Wed, Jun 17, 2026 at 12:43:02PM -0500, Justin Tobler wrote:
Show 30 quoted lines
> On 26/06/15 03:56PM, Patrick Steinhardt wrote:
> > @@ -2030,6 +2031,24 @@ const char *setup_git_directory_gently(struct repository *repo, int *nongit_ok)
> > setup_git_env_internal(repo, gitdir);
> > }
> >
> > + /*
> > + * The env variable should override the repository config
> > + * for 'extensions.refStorage'.
> > + */
> > + ref_backend_uri = getenv(GIT_REFERENCE_BACKEND_ENVIRONMENT);
> > + if (ref_backend_uri) {
> > + char *format;
> > +
> > + free(repo_fmt.ref_storage_payload);
> > +
> > + parse_reference_uri(ref_backend_uri, &format, &repo_fmt.ref_storage_payload);
> > + repo_fmt.ref_storage_format = ref_storage_format_by_name(format);
> > + if (repo_fmt.ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
> > + die(_("unknown ref storage format: '%s'"), format);
> > +
> > + free(format);
> > + }
> > +
> > if (startup_info->have_repository) {
> > struct strbuf err = STRBUF_INIT;
>
> Hmmm, we only invoke `apply_repository_format()` if we indeed have a
> repository (having just GIT_DIR_ENVIRONMENT set isn't enough). Should we
> instead nest this logic right above `apply_repository_format()` in the
> same block?Yup, that makes sense indeed.
Patrick