From: David Turner Date: Mon, 05 Oct 2015 20:14:33 GMT Subject: Re: [PATCH v2 22/43] refs-be-files.c: add do_for_each_per_worktree_ref Message-ID: <1444076073.5158.10.camel@twopensource.com> In-Reply-To: <56123279.4060605@alum.mit.edu> On Mon, 2015-10-05 at 10:19 +0200, Michael Haggerty wrote: > On 09/29/2015 12:01 AM, David Turner wrote: > > Alternate refs backends might still use files to store per-worktree > > refs. So the files backend's ref-loading infrastructure should be > > available to those backends, just for use on per-worktree refs. Add > > do_for_each_per_worktree_ref, which iterates over per-worktree refs. > > > > Signed-off-by: David Turner > > --- > > refs-be-files.c | 15 ++++++++++++--- > > refs.h | 11 +++++++++++ > > 2 files changed, 23 insertions(+), 3 deletions(-) > > > > diff --git a/refs-be-files.c b/refs-be-files.c > > index eb18a20..dc89289 100644 > > --- a/refs-be-files.c > > +++ b/refs-be-files.c > > @@ -587,9 +587,6 @@ static void sort_ref_dir(struct ref_dir *dir) > > dir->sorted = dir->nr = i; > > } > > > > -/* Include broken references in a do_for_each_ref*() iteration: */ > > -#define DO_FOR_EACH_INCLUDE_BROKEN 0x01 > > - > > /* > > * Return true iff the reference described by entry can be resolved to > > * an object in the database. Emit a warning if the referred-to > > [...] > > diff --git a/refs.h b/refs.h > > index 5875fe5..09d140d 100644 > > --- a/refs.h > > +++ b/refs.h > > @@ -152,6 +152,12 @@ struct ref_transaction; > > */ > > #define REF_BAD_NAME 0x08 > > > > +/* Include broken references in a do_for_each_ref*() iteration */ > > +#define DO_FOR_EACH_INCLUDE_BROKEN 0x01 > > Why do you move this definition from refs-be-files.c? Because the lmdb backend will need it. > > + > > +/* Only include per-worktree refs in a do_for_each_ref*() iteration */ > > +#define DO_FOR_EACH_PER_WORKTREE_ONLY 0x02 > > And why do you define this one here instead of in refs-be-files.c? Because other backends might need it (even though at present lmdb doesn't).