On Tue, Mar 01, 2016 at 03:48:30AM -0500, Jeff King wrote:
> On Mon, Feb 29, 2016 at 07:53:02PM -0500, David Turner wrote:
>
> > diff --git a/setup.c b/setup.c
> > index bd3a2cf..e2e1220 100644
> > --- a/setup.c
> > +++ b/setup.c
> > @@ -457,6 +457,10 @@ static int check_repository_format_gently(const char
> > *gitdir, int *nongit_ok)
> > ret = -1;
> > }
> >
> > + register_ref_storage_backends();
> > + if (set_ref_storage_backend(ref_storage_backend))
> > + die(_("Unknown ref storage backend %s"), ref_storage_backend);
> > +
> > strbuf_release(&sb);
> > return ret;
> > }
>
> Much nicer than the one it replaces, I think.
>
> This whole block should probably go inside
>
> if (ret == 0) {
> ...
> }
>
> If we are doing setup_git_repository_gently() and we do _not_ find a
> valid repository, we would not want to enable the ref storage.
So in the new world order of the patch series I just posted, this would
probably look like:
1. Add a ref_backend string to "struct repository_format", and parse it
in the callback.
2. The bottom of check_repository_format_gently() is only reached when
we have a workable repo. So from there, you can:
set_ref_storage_backend(candidate.ref_backend);
I think you'd probably want to check nongit_ok before dying on
failure (even without my patches).
3. Elsewhere, you can use read_repository_format() to get the backend
speculatively (e.g., for submodules), rather than doing a custom
git_config_from_file invocation.
None of which is to say that building on my series is a foregone
conclusion; I just wanted to point you in the right direction if you do
want to.
-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html