Re: [PATCH 1/7] setup: extract function to create the refdb
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Dec 8, 2023, 22:54 UTC
- Message-ID
- <xmqq1qbw1f0j.fsf@gitster.g>
- In-Reply-To
- <ZXFy0_T1AZLh058g@tanuki>
Patrick Steinhardt <ps@pks.im> writes:
Show 28 quoted lines
> 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?