Re: [PATCH v3 15/20] init: allow alternate backends to be set for new repos
- From
David Turner <dturner@twopensource.com>
- Date
- Feb 4, 2016, 20:05 UTC
- Message-ID
- <1454616308.5545.9.camel@twopensource.com>
- In-Reply-To
- <CACsJy8DUpOGtZmBr2F2R+8xvzvHOxLc_YOSnF8eQRvHYq15ttA@mail.gmail.com>
On Thu, 2016-02-04 at 16:48 +0700, Duy Nguyen wrote:
Show 30 quoted lines
> (picking a random series version because I didn't follow it closely)
>
> On Thu, Jan 14, 2016 at 11:26 PM, David Turner <
> dturner@twopensource.com> wrote:
> > + if (requested_ref_storage_backend)
> > + ref_storage_backend =
> > requested_ref_storage_backend;
> > + if (strcmp(ref_storage_backend, "files")) {
> > + git_config_set("extensions.refStorage",
> > ref_storage_backend);
> > + git_config_set("core.repositoryformatversion",
> > ref_storage_backend);
> > +#ifdef USE_LIBLMDB
> > + register_ref_storage_backend(&refs_be_lmdb);
> > +#endif
> > + set_ref_storage_backend(ref_storage_backend);
> > + repo_version = 1;
> > + }
> > +
> > + if (refs_init_db(&err, shared_repository))
> > + die("failed to set up refs db: %s", err.buf);
> > +
>
> I was surprised that "git init --ref-storage=lmdb abc" ran
> successfully even on non-lmdb build. Of course running any commands
> in
> the new repo will fail, suggesting to rebuild with lmdb. But should
> "git init" fail in the first place? I see Thomas' comment about this
> block, but not sure why it still passes for me. It does not catch
> unrecognized backend names either.This was broken in this patchset and is fixed in the set I've got in -progress (with a test).
Show 6 quoted lines
> Also it would be nice if we could hide #ifdef USE_LIBLMDB (here and > in > config.c) away, maybe in refs directory. I imagine a new backend > would > need the same set of #ifdef. Spreading them across files does not > sound ideal.
Good point. Moved to a single one in refs.c. Thanks.