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

Re: [PATCH] setup: warn if extensions exist on old format

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 13, 2020, 19:36 UTC
Message-ID
<xmqqblkjnr5m.fsf@gitster.c.googlers.com>
In-Reply-To
<pull.674.git.1594668051847.gitgitgadget@gmail.com>
"Derrick Stolee via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 14 quoted lines
> From: Derrick Stolee <dstolee@microsoft.com>
>
> Prior to 14c7fa269e4 (check_repository_format_gently(): refuse extensions
> for old repositories, 2020-06-05), Git was honoring configured
> extensions, even if core.repositoryFormatVersion was 0 (or unset). This
> was incorrect, and is now fixed.
>
> The issue now is that users who relied on that previously bad behavior
> will upgrade to the next version of Git and suddently be in a bad
> situation. In particular, users of the 'git sparse-checkout' builting
> will rely on the extensions.worktreeConfig for the core.sparseCheckout
> and core.sparseCheckoutCone config options. Without that extension,
> these users will suddenly have repositories stop acting like a sparse
> repo.
s/builting/command/ perhaps???
Show 14 quoted lines
>
> What is worse is that a user will be confronted with the following
> error if they try to run 'git sparse-checkout init' again:
>
> 	warning: unable to upgrade repository format from 0 to 1
>
> This is because the logic in 14c7fa269e4 refuses to upgrae repos when
> the version is unset but extensions exist.
>
> While it is important to correct this improper behavior, create a
> warning so users in this situation can correct themselves without too
> much guesswork. By creating a warning in
> check_repository_format_gently(), we can alert the user if they have a
> ocnfigured extension but not a configured repository version.
s/ocn/con/
> Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
> ---

Thanks for a thoughtful analysis of the situation and coming up with a plan to remedy.

> +	if (candidate->version == 0 && candidate->has_extensions) {
> +		warning(_("some extensions are enabled, but core.repositoryFormatVersion=0"));
> +		warning(_("if you intended to use extensions, run 'git config core.repositoryFormatVersion 1'"));
> +	}
That reads well.

An alternative may be to grandfather some extensions that were enabled by git by mistake without updating the format version, and we update the repository even if the repository has extensions that should not exist, but those offending extensions are limited only to those that we decide to special case. That would make the end-user experience even smoother.

Is extenions.worktreeCOnfig the only one that needs this escape hatch?

Previous: Derrick StoleeNext: Junio C Hamano
Message 4 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.