Re: [PATCH 1/7] setup: extract function to create the refdb
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Dec 11, 2023, 11:34 UTC
- Message-ID
- <ZXbz2eQoz0ReP_IF@tanuki>
- In-Reply-To
- <xmqq1qbw1f0j.fsf@gitster.g>
On Sat, Dec 09, 2023 at 07:54:52AM +0900, Junio C Hamano wrote:
Show 33 quoted lines
> Patrick Steinhardt <ps@pks.im> writes:
>
> > On Wed, Dec 06, 2023 at 10:10:37PM +0100, Karthik Nayak wrote:
> >> On Wed, Dec 6, 2023 at 1:40 PM Patrick Steinhardt <ps@pks.im> wrote:
> >> > +static void create_reference_database(const char *initial_branch, int quiet)
> >> > +{
> >> > + struct strbuf err = STRBUF_INIT;
> >> > + int reinit = is_reinit();
> >> > +
> >> > + /*
> >> > + * We need to create a "refs" dir in any case so that older
> >> > + * versions of git can tell that this is a repository.
> >> > + */
> >>
> >> How does this work though, even if an earlier version of git can tell
> >> that this is a repository, it still won't be able to read the reftable
> >> backend. In that sense, what do we achieve here?
> >
> > This is a good question, and there is related ongoing discussion about
> > this topic in the thread starting at [1]. There are a few benefits to
> > letting clients discover such repos even if they don't understand the
> > new reference backend format:
> >
> > - They know to stop walking up the parent-directory chain. Otherwise a
> > client might end up detecting a Git repository in the parent dir.
> >
> > - The user gets a proper error message why the repository cannot be
> > accessed. Instead of failing to detect the repository altogether we
> > instead say that we don't understand the "extensions.refFormat"
> > extension.
>
> Yup, both are very good reasons. Would it help to sneak a condensed
> version of it in the in-code comment, perhaps?Sure, let's do so. I failed to condense this meaningfully, but hope that the result will be okay regardless of that.
Patrick