Subject: Re: [PATCH 04/10] refs/files: support symbolic and root refs in initial transaction

From: Patrick Steinhardt <[email-masked]>
Date: Mon, 11 Nov 2024 13:53:09 +0100

On Mon, Nov 11, 2024 at 02:42:11AM -0800, karthik nayak wrote:
> Patrick Steinhardt <[email-masked]> writes:
> 
> > The "files" backend has implemented special logic when committing
> > the first transactions in an otherwise empty ref store: instead of
> > writing all refs as separate loose files, it instead knows to write them
> > all into a "packed-refs" file directly. This is significantly more
> > efficient than having to write each of the refs as separate "loose" ref.
> >
> > The only user of this optimization is git-clone(1), which only uses this
> > mechanism to write regular refs. Consequently, the implementation does
> > not know how to handle both symbolic and root refs. While fine in the
> > context of git-clone(1), this keeps us from using the mechanism in more
> > cases.
> >
> > Adapt the logic to also support symbolic and root refs by using a second
> > transaction that we use for all of the refs that need to be written as
> > loose refs.
> >
> 
> The patch looks good. I was wondering if another way would be to just
> add symref and root ref support to packed-refs. But that might be a
> bigger undertaking than what we're doing here.
> 
> But thinking about it, seems like we can do that in a backwards
> compatible way too.

I don't think you can without introducing a new version of the format,
mostly because you also have to think about clients that don't support
the new format. So all of this would be a big undertaking, and given
that we have the reftable backend nowadays I don't think it'd be all
that valuable.

Patrick