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

Re: [PATCH 2/2] repository: allow repository format upgrade with extensions

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 16, 2020, 07:01 UTC
Message-ID
<xmqqh7u8hrka.fsf@gitster.c.googlers.com>
In-Reply-To
<20200716062818.GC3242764@google.com>
Jonathan Nieder <jrnieder@gmail.com> writes:
Show 13 quoted lines
> Now that we officially permit repository extensions in repository
> format v0, permit upgrading a repository with extensions from v0 to v1
> as well.
>
> For example, this means a repository where the user has set
> "extensions.preciousObjects" can use "git fetch --filter=blob:none
> origin" to upgrade the repository to use v1 and the partial clone
> extension.
>
> To avoid mistakes, continue to forbid repository format upgrades in v0
> repositories with an unrecognized extension.  This way, a v0 user
> using a misspelled extension field gets a chance to correct the
> mistake before updating to the less forgiving v1 format.

This needs to be managed carefully. When the next extension is added to the codebase, that extension may be "known" to Git, but I do not think it is a good idea to honor it in v0 repository, or allow upgrading v0 repository to v1 with such an extension that weren't "known" to Git. For example, a topic in flight adds objectformat extension and I do not think it should be honored in v0 repository.

Having said that, the approach is OK for now at the tip of tonight's master, but the point is "known" vs "unknown" must be fixed right with some means. E.g. tell people to throw the "new" extensions to the list of "unknown extensions" in check_repo_format() when they add new ones, or something.

Thanks.
Show 29 quoted lines
> +	if (!repo_fmt.version && repo_fmt.unknown_extensions.nr)
> +		return error("cannot upgrade repository format: "
> +			     "unknown extension %s",
> +			     repo_fmt.unknown_extensions.items[0].string);
>  
>  	strbuf_addf(&repo_version, "%d", target_version);
>  	git_config_set("core.repositoryformatversion", repo_version.buf);
> diff --git a/t/t0410-partial-clone.sh b/t/t0410-partial-clone.sh
> index 51d1eba6050..6aa0f313bdd 100755
> --- a/t/t0410-partial-clone.sh
> +++ b/t/t0410-partial-clone.sh
> @@ -42,7 +42,7 @@ test_expect_success 'convert shallow clone to partial clone' '
>  	test_cmp_config -C client 1 core.repositoryformatversion
>  '
>  
> -test_expect_success 'converting to partial clone fails with noop extension' '
> +test_expect_success 'convert to partial clone with noop extension' '
>  	rm -fr server client &&
>  	test_create_repo server &&
>  	test_commit -C server my_commit 1 &&
> @@ -50,7 +50,7 @@ test_expect_success 'converting to partial clone fails with noop extension' '
>  	git clone --depth=1 "file://$(pwd)/server" client &&
>  	test_cmp_config -C client 0 core.repositoryformatversion &&
>  	git -C client config extensions.noop true &&
> -	test_must_fail git -C client fetch --unshallow --filter="blob:none"
> +	git -C client fetch --unshallow --filter="blob:none"
>  '
>  
>  test_expect_success 'converting to partial clone fails with unrecognized extension' '
Previous: Jonathan NiederNext: Jeff King
Message 23 of 39 in “setup: warn about un-enabled extensions”
  1. setup: warn about un-enabled extensionsJohannes Schindelin via GitGitGadget, Jul 13, 2020
  2. Junio C HamanoJul 13, 2020
  3. Derrick StoleeJul 14, 2020
  4. Johannes SchindelinJul 14, 2020
  5. Junio C HamanoJul 14, 2020
  6. Derrick StoleeJul 14, 2020
  7. Johannes SchindelinJul 14, 2020
  8. Junio C HamanoJul 14, 2020
  9. Junio C HamanoJul 15, 2020
  10. Junio C HamanoJul 15, 2020
  11. Derrick StoleeJul 15, 2020
  12. Junio C HamanoJul 15, 2020
  13. Derrick StoleeJul 15, 2020
  14. Johannes SchindelinJul 15, 2020
  15. Junio C HamanoJul 15, 2020
  16. Johannes SchindelinJul 15, 2020
  17. Jonathan NiederJul 15, 2020
  18. Junio C HamanoJul 16, 2020
  19. 0/2 extensions.* fixes for 2.28 (Re: [PATCH] setup: warn about un-enabled extensions)Jonathan Nieder, Jul 16, 2020
  20. 1/2 Revert "check_repository_format_gently(): refuse extensions for old repositories"Jonathan Nieder, Jul 16, 2020
  21. Jeff KingJul 16, 2020
  22. 2/2 repository: allow repository format upgrade with extensionsJonathan Nieder, Jul 16, 2020
  23. Junio C HamanoJul 16, 2020
  24. Jeff KingJul 16, 2020
  25. Jeff KingJul 16, 2020
  26. Derrick StoleeJul 16, 2020
  27. Junio C HamanoJul 16, 2020
  28. Jeff KingJul 16, 2020
  29. Junio C HamanoJul 16, 2020
  30. Junio C HamanoJul 16, 2020
  31. Jeff KingJul 16, 2020
  32. Junio C HamanoJul 16, 2020
  33. Jonathan NiederJul 16, 2020
  34. Junio C HamanoJul 16, 2020
  35. Jeff KingJul 17, 2020
  36. Junio C HamanoJul 17, 2020
  37. Jeff KingJul 17, 2020
  38. Johannes SchindelinJul 16, 2020
  39. Derrick StoleeJul 16, 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.