Subject: Re: [PATCH v2 38/43] refs: make some files backend functions public

From: David Turner <[email-masked]>
Date: Mon, 05 Oct 2015 21:24:04 -0400

On Mon, 2015-10-05 at 11:03 +0200, Michael Haggerty wrote:
> On 09/29/2015 12:02 AM, David Turner wrote:
> > Because HEAD and stash are per-worktree, other backends need to
> > go through the files backend to manage these refs and their reflogs.
> > 
> > To enable this, we make some files backend functions public.
> 
> I have a bad feeling about this change.
> 
> Naively I would expect a reference backend that cannot handle its own
> (e.g.) stash to instantiate internally a files backend object and to
> delegate stash-related calls to that object. That way neither class's
> interface has to be changed.
> 
> Here you are adding a separate interface to the files backend. That
> seems like a more complicated and less flexible design. But I'm open to
> be persuaded otherwise...

OK, I've switched over most of these to use an internal files backend.

While doing so, I thought I needed to keep files_log_ref_write, 
because we need to  handle refs that cross over between the lmdb 
backend and the files backend.

But on reflection, I have realized that I'm doing cross-backend refs 
wrong anyway (I'm prematurely committing the files backend ones, and
doing it without locks).  So I think I need to rethink this a bit. 
Probably I can split out a files transaction using REF_NODEREF or 
something.

Will do something about this.