Re: [PATCH 2/3] setup: do not use invalid `repository_format`
- Date: Wed, 19 Dec 2018 22:46:52 +0100
- From: Martin Ågren <martin.agren@xxxxxxxxx>
- Subject: Re: [PATCH 2/3] setup: do not use invalid `repository_format`
On Wed, 19 Dec 2018 at 16:38, Jeff King <peff@xxxxxxxx> wrote:
> On Tue, Dec 18, 2018 at 08:25:27AM +0100, Martin Ågren wrote:
> > Check that `version` is non-negative before using `hash_algo`.
> Hmm. It looks like we never set repo_fmt.hash_algo to anything besides
> GIT_HASH_SHA1 anyway. I guess the existing field is really just there in
> preparation for us eventually respecting extensions.hashAlgorithm (or
> whatever it's called).
That was my understanding as well. Maybe I should have spelled it out.
I think of the diff of this patch as "let's check `foo->valid` before we
`use(foo->bar)`", which should only be able to regress in case foo isn't
valid. And ...
> Given what I said in my previous email about repos with a missing
> "version" field, I wondered if this patch would be breaking config like:
> # no repositoryformatversion!
> hashAlgorithm = sha256
> But I'd argue that:
> 1. That's pretty dumb config that we shouldn't need to support. Even
> if we care about handling the missing version for historical repos,
> they wouldn't be talking sha256.
... this matches my thinking.
> 2. Arguably we should not even look at extensions.* unless we see a
> version >= 1. But we do process them as we parse the config file.
> This is mostly an oversight, I think. We have to handle them as we
> see them, because they may come out of order with respect to the
> repositoryformatversion field. But we could put them into a
> string_list, and then only process them after we've decided which
> version we have.
I hadn't thought too much about this. I guess that for some simpler
extensions--versions dependencies it would be feasible to first parse
everything, then, depending on the version we've identified, forget
about any "irrelevant" extensions. Again, nothing I've thought much
about, and seems to be safely out of scope for this patch.
> So I think your patch is doing the right thing, and won't hurt any real
> cases. But (of course) there are more opportunities to clean things up.