git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] setup: tweak upgrade policy to grandfather worktreeconfig

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Jul 14, 2020, 04:06 UTC
Message-ID
<20200714040616.GA2208896@google.com>
In-Reply-To
<b8ae18f7-a0af-bd62-2553-92989e1dbe7e@gmail.com>
Hi,
Derrick Stolee wrote:
> On 7/13/2020 4:18 PM, Junio C Hamano wrote:
Show 18 quoted lines
>> The "fail and warn" approach introduced in the previous step may be
>> with smaller impact to the codebase, but
>>
>>  - it requires the end-user to read, understand and execute the
>>    manual upgrade
>>
>>  - it encourages to follow the same procedure blindly, making the
>>    protection even less useful
>>
>> Let's instead keep failing hard without teaching how to bypass the
>> repository protection, but allow upgrading even when only the
>> worktreeconfig extension exists in an old repository, which is
>> likely to be set by a broke version of Git that did not update the
>> repository version when setting the extension.
>
> This is a more subtle way to handle the case. In fact, it
> silently makes extensions.worktreeConfig work as it did in 2.27,
> which means users will not have any troubles after upgrading.
I'd like to propose a different endgame:

Instead of looking at `extensions.*` settings one by one to see how various implementations handled them with repositoryFormatVersion=0, what if we treat repositoryFormatVersion=0 as a synonym of version=1?

That is:
1. in new repositories, set repositoryFormatVersion = 1, since (1) Git
   versions in the wild should all already know how to handle it and
   (2) as we've learned, other Git implementations need to understand
   some of extensions.* anyway
2. whenever setting any extensions.*, automatically upgrade to
   repositoryFormatVersion = 1
3. when in an existing repository with extensions.* set and
   repositoryFormatVersion = 0, act as though repositoryFormatVersion = 1
4. document this new behavior with repositoryFormatVersion = 0 in
   Documentation/technical/repository-version.txt
This way, the result is simpler than where we started.

Unfortunately, we are not even that consistent about what to do with extensions.* settings when repositoryFormatVersion = 0 today. So we'll have to exercise some care and analyze them one by one to make sure this is safe (and if it isn't, at *that* point we'd come up with a more complex variant on (2) and (3) above).

It's too late to go that far for 2.28. It would be tempting to try a simple revert of 14c7fa269e4 (check_repository_format_gently(): refuse extensions for old repositories, 2020-06-05) to get back to tried and true behavior but that does not do enough --- it still produces an error when trying to upgrade repository format when any extensions are set. So how about such a revert plus Junio's patch plus the analogous change to Junio's patch for

  extensions.preciousObjects
  extensions.partialClone
?

Thanks, Jonathan

Previous: Junio C HamanoNext: Junio C Hamano
Message 9 of 15 in “setup: warn if extensions exist on old format”
  1. setup: warn if extensions exist on old formatDerrick Stolee via GitGitGadget, Jul 13, 2020
  2. Taylor BlauJul 13, 2020
  3. Derrick StoleeJul 13, 2020
  4. Junio C HamanoJul 13, 2020
  5. Junio C HamanoJul 13, 2020
  6. setup: tweak upgrade policy to grandfather worktreeconfigJunio C Hamano, Jul 13, 2020
  7. Derrick StoleeJul 13, 2020
  8. Junio C HamanoJul 13, 2020
  9. Jonathan NiederJul 14, 2020
  10. Junio C HamanoJul 14, 2020
  11. 0/2 setup: warn if extensions exist on old formatDerrick Stolee via GitGitGadget, Jul 14, 2020
  12. 1/2 setup: tweak upgrade policy to grandfather worktreeconfigDerrick Stolee via GitGitGadget, Jul 14, 2020
  13. Johannes SchindelinJul 14, 2020
  14. 2/2 config: provide extra detail about worktree configDerrick Stolee via GitGitGadget, Jul 14, 2020
  15. Johannes SchindelinJul 14, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.