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

Re: [PATCH 0/3] SHA-256: Update commit-graph and multi-pack-index formats

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 14, 2020, 21:41 UTC
Message-ID
<xmqqbljcvrbj.fsf@gitster.c.googlers.com>
In-Reply-To
<04ebec72-07de-4494-688f-a9f48442906e@gmail.com>
Derrick Stolee <stolee@gmail.com> writes:
Show 55 quoted lines
> On 8/14/2020 3:25 PM, Junio C Hamano wrote:
>> "Derrick Stolee via GitGitGadget" <gitgitgadget@gmail.com> writes:
>> 
>>> As discussed [1], there is some concern around binary file formats requiring
>>> the context of the repository config in order to infer hash lengths. Two
>>> formats that were designed with the hash transition in mind (commit-graph
>>> and multi-pack-index) have bytes available to indicate the hash algorithm
>>> used. Let's actually update these formats to be more self-contained with the
>>> two hash algorithms being available.
>>> ...
>>> If this is the way we want to go with the formats, then I'll assist
>>> coordinating these textual and semantic merge conflicts.
>> 
>> I agree that the files should be self-identifying, but have these
>> changes tested without sha256 hash?
>
> All of the test scripts pass with and without GIT_TEST_DEFAULT_HASH=sha256,
> and this test in t5318 (and a similar one in t5319) are explicit about
> testing both options:
>
> +test_expect_success 'warn on improper hash version' '
> +	git init --object-format=sha1 sha1 &&
> +	(
> +		cd sha1 &&
> +		test_commit 1 &&
> +		git commit-graph write --reachable &&
> +		mv .git/objects/info/commit-graph ../cg-sha1
> +	) &&
> +	git init --object-format=sha256 sha256 &&
> +	(
> +		cd sha256 &&
> +		test_commit 1 &&
> +		git commit-graph write --reachable &&
> +		mv .git/objects/info/commit-graph ../cg-sha256
> +	) &&
> +	(
> +		cd sha1 &&
> +		mv ../cg-sha256 .git/objects/info/commit-graph &&
> +		git log -1 2>err &&
> +		test_i18ngrep "commit-graph hash version 2 does not match version 1" err
> +	) &&
> +	(
> +		cd sha256 &&
> +		mv ../cg-sha1 .git/objects/info/commit-graph &&
> +		git log -1 2>err &&
> +		test_i18ngrep "commit-graph hash version 1 does not match version 2" err
> +	)
> +'
> +
>
> Since this tests exactly that the "hash version" byte is the same in
> a SHA-1 repo, this checks that the new version of Git writes backwards-
> compatible data in SHA-1 repos.
>
> Or are you hinting at a more subtle test scenario that I missed?

No, I was just wondering how ready we are, as the four tests looked too easy ;-)

Previous: Derrick StoleeNext: Derrick Stolee via GitGitGadget
Message 17 of 22 in “SHA-256: Update commit-graph and multi-pack-index formats”
  1. 0/3 SHA-256: Update commit-graph and multi-pack-index formatsDerrick Stolee via GitGitGadget, Aug 14, 2020
  2. 1/3 t/README: document GIT_TEST_DEFAULT_HASHDerrick Stolee via GitGitGadget, Aug 14, 2020
  3. Junio C HamanoAug 14, 2020
  4. Eric SunshineAug 14, 2020
  5. Derrick StoleeAug 14, 2020
  6. 2/3 commit-graph: use the hash version byteDerrick Stolee via GitGitGadget, Aug 14, 2020
  7. Junio C HamanoAug 14, 2020
  8. Taylor BlauAug 14, 2020
  9. brian m. carlsonAug 14, 2020
  10. Junio C HamanoAug 14, 2020
  11. Derrick StoleeAug 14, 2020
  12. Martin ÅgrenAug 15, 2020
  13. 3/3 multi-pack-index: use hash version byteDerrick Stolee via GitGitGadget, Aug 14, 2020
  14. brian m. carlsonAug 14, 2020
  15. Junio C HamanoAug 14, 2020
  16. Derrick StoleeAug 14, 2020
  17. Junio C HamanoAug 14, 2020
  18. 0/3 SHA-256: Update commit-graph and multi-pack-index formatsDerrick Stolee via GitGitGadget, Aug 17, 2020
  19. 1/3 t/README: document GIT_TEST_DEFAULT_HASHDerrick Stolee via GitGitGadget, Aug 17, 2020
  20. 2/3 commit-graph: use the "hash version" byteDerrick Stolee via GitGitGadget, Aug 17, 2020
  21. 3/3 multi-pack-index: use hash version byteDerrick Stolee via GitGitGadget, Aug 17, 2020
  22. brian m. carlsonAug 17, 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.