From: Patrick Steinhardt Date: Wed, 09 Sep 2026 07:03:51 GMT Subject: Re: [PATCH v2 07/11] refs: expose function to parse reference URIs Message-ID: In-Reply-To: <54fc5f97-a8ed-4927-8b48-1b4c3c7b413a@gmail.com> On Tue, Sep 08, 2026 at 07:17:06PM +0530, Kaartic Sivaraam wrote: > On 9/7/26 16:48, Patrick Steinhardt wrote: > > diff --git a/setup.c b/setup.c > > index dfe05d9a03..3be7dac452 100644 > > --- a/setup.c > > +++ b/setup.c > > > > @@ -2069,16 +2051,12 @@ const char *setup_git_directory_gently(struct repository *repo, int *nongit_ok) > > */ > > ref_backend_uri = getenv(GIT_REFERENCE_BACKEND_ENVIRONMENT); > > if (ref_backend_uri) { > > - char *format; > > - > > - free(discovery.format.ref_storage_payload); > > - > > - parse_reference_uri(ref_backend_uri, &format, &discovery.format.ref_storage_payload); > > - discovery.format.ref_storage_format = ref_storage_format_by_name(format); > > + FREE_AND_NULL(discovery.format.ref_storage_payload); > > + discovery.format.ref_storage_format = > > + ref_storage_format_by_uri(ref_backend_uri, > > + &discovery.format.ref_storage_payload); > > if (discovery.format.ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN) > > - die(_("unknown ref storage format: '%s'"), format); > > - > > - free(format); > > + die(_("unknown ref storage format: '%s'"), ref_backend_uri); > > If I'm not mistaken, we have now started printing the whole ref storage > backend configuration rather than just the name. I could see that we don't > actually have any variable that returns just the name part after the > refactor. I could also understand that we can't always expect a '://' in the > GIT_REF_STORAGE_FORMAT configuration so printing the whole configuration may > make sense. But could we possibly improve the error message a bit? May be > phrase it as follows: > > $ GIT_REF_STORAGE_FORMAT=garbage://hello-world ./git status > fatal: invalid ref storage format configuration: 'garbage://hello-world' I think "invalid" would be less precise though compared to "unknown", so I'm inclined to keep the wording here. I don't think it's too bad that we're now printing the whole URI, as that may also make the user wonder less about where specifically that string even comes from. So for now, I'll leave this as-is. Patrick