{"thread":{"id":"53925","subject":"[PATCH v4 01/39] t: make test-bloom initialize repository","startedAt":"2020-07-26T19:54:43Z","lastAt":"2020-07-26T23:57:10Z","messageCount":58,"participants":["brian m. carlson","Eric Sunshine"],"isPatch":true,"patchVersion":4,"patchTotal":39},"messages":[{"id":"402065","messageId":"20200726195424.626969-2-sandals@crustytoothpaste.net","threadId":"53925","inReplyTo":"20200726195424.626969-1-sandals@crustytoothpaste.net","subject":"[PATCH v4 01/39] t: make test-bloom initialize repository","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-26T19:53:46Z","receivedAt":"2020-07-26T19:54:43Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"The bloom filter code relies on reading object IDs using parse_oid_hex.\nIn order to make that work with an appropriate size, we need to have\ninitialized the repository's hash algorithm.  Since the values we're\nprocessing depend on the repository in use, let's set up the repository\nwhen we run the test helper.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n t/helper/test-bloom.c | 2 ++\n 1 file changed, 2 insertions(+)\n\ndiff --git a/t/helper/test-bloom.c b/t/helper/test-bloom.c\nindex f0aa80b98e..5e77d56f59 100644\n--- a/t/helper/test-bloom.c\n+++ b/t/helper/test-bloom.c\n@@ -50,6 +50,8 @@ static const char *bloom_usage = \"\\n\"\n \n int cmd__bloom(int argc, const char **argv)\n {\n+\tsetup_git_directory();\n+\n \tif (argc < 2)\n \t\tusage(bloom_usage);\n \n"},{"id":"402066","messageId":"20200726195424.626969-3-sandals@crustytoothpaste.net","threadId":"53925","inReplyTo":"20200726195424.626969-1-sandals@crustytoothpaste.net","subject":"[PATCH v4 02/39] t1001: use $ZERO_OID","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-26T19:53:47Z","receivedAt":"2020-07-26T19:54:51Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Use $ZERO_OID to make the test hash independent.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n t/t1091-sparse-checkout-builtin.sh | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t1091-sparse-checkout-builtin.sh b/t/t1091-sparse-checkout-builtin.sh\nindex 7cd45fc139..84acfc48b6 100755\n--- a/t/t1091-sparse-checkout-builtin.sh\n+++ b/t/t1091-sparse-checkout-builtin.sh\n@@ -369,7 +369,7 @@ test_expect_success 'sparse-checkout (init|set|disable) warns with unmerged stat\n \tgit clone repo unmerged &&\n \n \tcat >input <<-EOF &&\n-\t0 0000000000000000000000000000000000000000\tfolder1/a\n+\t0 $ZERO_OID\tfolder1/a\n \t100644 $(git -C unmerged rev-parse HEAD:folder1/a) 1\tfolder1/a\n \tEOF\n \tgit -C unmerged update-index --index-info <input &&\n@@ -396,7 +396,7 @@ test_expect_success 'sparse-checkout reapply' '\n \techo dirty >tweak/deep/deeper2/a &&\n \n \tcat >input <<-EOF &&\n-\t0 0000000000000000000000000000000000000000\tfolder1/a\n+\t0 $ZERO_OID\tfolder1/a\n \t100644 $(git -C tweak rev-parse HEAD:folder1/a) 1\tfolder1/a\n \tEOF\n \tgit -C tweak update-index --index-info <input &&\n"},{"id":"402068","messageId":"20200726195424.626969-8-sandals@crustytoothpaste.net","threadId":"53925","inReplyTo":"20200726195424.626969-1-sandals@crustytoothpaste.net","subject":"[PATCH v4 07/39] t6301: make hash size independent","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-26T19:53:52Z","receivedAt":"2020-07-26T19:54:52Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Instead of hard-coding a fixed length example object ID in the test,\ncompute one using the translation tables.  Move a variable into the\nsetup block so that we can ensure the exit status of test_oid_init is\nchecked.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n t/t6301-for-each-ref-errors.sh | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git a/t/t6301-for-each-ref-errors.sh b/t/t6301-for-each-ref-errors.sh\nindex 49cc65bb58..d545a725a5 100755\n--- a/t/t6301-for-each-ref-errors.sh\n+++ b/t/t6301-for-each-ref-errors.sh\n@@ -5,9 +5,10 @@ test_description='for-each-ref errors for broken refs'\n . ./test-lib.sh\n \n ZEROS=$ZERO_OID\n-MISSING=abababababababababababababababababababab\n \n test_expect_success setup '\n+\ttest_oid_init &&\n+\tMISSING=$(test_oid deadbeef) &&\n \tgit commit --allow-empty -m \"Initial\" &&\n \tgit tag testtag &&\n \tgit for-each-ref >full-list &&\n"},{"id":"402069","messageId":"20200726195424.626969-6-sandals@crustytoothpaste.net","threadId":"53925","inReplyTo":"20200726195424.626969-1-sandals@crustytoothpaste.net","subject":"[PATCH v4 05/39] t6100: make hash size independent","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-26T19:53:50Z","receivedAt":"2020-07-26T19:54:52Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Instead of hard-coding a constant 40, split the output of rev-list by\nfield.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n t/t6100-rev-list-in-order.sh | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t6100-rev-list-in-order.sh b/t/t6100-rev-list-in-order.sh\nindex b2bb0a7f61..e934bc239c 100755\n--- a/t/t6100-rev-list-in-order.sh\n+++ b/t/t6100-rev-list-in-order.sh\n@@ -22,7 +22,7 @@ test_expect_success 'setup a commit history with trees, blobs' '\n \n test_expect_success 'rev-list --in-commit-order' '\n \tgit rev-list --in-commit-order --objects HEAD >actual.raw &&\n-\tcut -c 1-40 >actual <actual.raw &&\n+\tcut -d\" \" -f1 >actual <actual.raw &&\n \n \tgit cat-file --batch-check=\"%(objectname)\" >expect.raw <<-\\EOF &&\n \t\tHEAD^{commit}\n@@ -49,7 +49,7 @@ test_expect_success 'rev-list --in-commit-order' '\n \n test_expect_success 'rev-list lists blobs and trees after commits' '\n \tgit rev-list --objects HEAD >actual.raw &&\n-\tcut -c 1-40 >actual <actual.raw &&\n+\tcut -d\" \" -f1 >actual <actual.raw &&\n \n \tgit cat-file --batch-check=\"%(objectname)\" >expect.raw <<-\\EOF &&\n \t\tHEAD^{commit}\n"},{"id":"402070","messageId":"20200726195424.626969-5-sandals@crustytoothpaste.net","threadId":"53925","inReplyTo":"20200726195424.626969-1-sandals@crustytoothpaste.net","subject":"[PATCH v4 04/39] t3404: prepare 'short SHA-1 collision' tests for SHA-256","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-26T19:53:49Z","receivedAt":"2020-07-26T19:54:52Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nThe idea of the magic value \"ac4f2ee\" in this test is to make the\nreworded commit `collide2` have the same shortened ID as the commit\n`collide3`.\n\nTo port the same idea to the SHA-256 version of Git, we therefore need\nanother magic value that causes the same collision, but this time with\nthe SHA-256 version of the commit IDs.\n\nIn this patch, we add code guarded by `GIT_TEST_FIND_COLLIDER` to do\nexactly that. Essentially, a large number of integers is appended to the\ncommit message \"collide2\" to find such a collision. To make it easier to\nfind such a collision, we reduce the number of digits to 4.\n\nThe `t/oid-info/oid` file now lists the values found in that way, and\nthe test cases are modified to use those values.\n\nAs the tests are no longer dependent on SHA-1, we also rename their\ntitles to talk about \"commit IDs\" instead of \"SHA-1s\".\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n t/t3404-rebase-interactive.sh | 50 ++++++++++++++++++++++++++++-------\n 1 file changed, 41 insertions(+), 9 deletions(-)\n\ndiff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh\nindex 4a7d21f898..2fb2c581cb 100755\n--- a/t/t3404-rebase-interactive.sh\n+++ b/t/t3404-rebase-interactive.sh\n@@ -30,6 +30,7 @@ Initial setup:\n . \"$TEST_DIRECTORY\"/lib-rebase.sh\n \n test_expect_success 'setup' '\n+\ttest_oid_init &&\n \ttest_commit A file1 &&\n \ttest_commit B file1 &&\n \ttest_commit C file2 &&\n@@ -1250,7 +1251,7 @@ test_expect_success 'rebase -i error on commits with \\ in message' '\n \ttest_expect_code 1 grep  \"\temp\" error\n '\n \n-test_expect_success SHA1 'short SHA-1 setup' '\n+test_expect_success 'short commit ID setup' '\n \ttest_when_finished \"git checkout master\" &&\n \tgit checkout --orphan collide &&\n \tgit rm -rf . &&\n@@ -1262,23 +1263,54 @@ test_expect_success SHA1 'short SHA-1 setup' '\n \t)\n '\n \n-test_expect_success SHA1 'short SHA-1 collide' '\n+if test -n \"$GIT_TEST_FIND_COLLIDER\"\n+then\n+\tauthor=\"$(unset test_tick; test_tick; git var GIT_AUTHOR_IDENT)\"\n+\tcommitter=\"$(unset test_tick; test_tick; git var GIT_COMMITTER_IDENT)\"\n+\tblob=\"$(git rev-parse collide2:collide)\"\n+\tfrom=\"$(git rev-parse collide1^0)\"\n+\trepl=\"commit refs/heads/collider-&\\\\n\"\n+\trepl=\"${repl}author $author\\\\ncommitter $committer\\\\n\"\n+\trepl=\"${repl}data <<EOF\\\\ncollide2 &\\\\nEOF\\\\n\"\n+\trepl=\"${repl}from $from\\\\nM 100644 $blob collide\\\\n\"\n+\ttest_seq 1 32768 | sed \"s|.*|$repl|\" >script &&\n+\tgit fast-import <script &&\n+\tgit pack-refs &&\n+\tgit for-each-ref >refs &&\n+\tgrep \"^$(test_oid t3404_collision)\" <refs >matches &&\n+\tcat matches &&\n+\ttest_line_count -gt 2 matches || {\n+\t\techo \"Could not find a collider\" >&2\n+\t\texit 1\n+\t}\n+fi\n+\n+test_expect_success 'short commit ID collide' '\n+\ttest_oid_cache <<-EOF &&\n+\t# collision-related constants\n+\tt3404_collision\tsha1:6bcd\n+\tt3404_collision\tsha256:0161\n+\tt3404_collider\tsha1:ac4f2ee\n+\tt3404_collider\tsha256:16697\n+\tEOF\n \ttest_when_finished \"reset_rebase && git checkout master\" &&\n \tgit checkout collide &&\n-\tcolliding_sha1=6bcda37 &&\n-\ttest $colliding_sha1 = \"$(git rev-parse HEAD | cut -c 1-7)\" &&\n+\tcolliding_id=$(test_oid t3404_collision) &&\n+\thexsz=$(test_oid hexsz) &&\n+\ttest $colliding_id = \"$(git rev-parse HEAD | cut -c 1-4)\" &&\n+\ttest_config core.abbrev 4 &&\n \t(\n \t\tunset test_tick &&\n \t\ttest_tick &&\n \t\tset_fake_editor &&\n-\t\tFAKE_COMMIT_MESSAGE=\"collide2 ac4f2ee\" \\\n+\t\tFAKE_COMMIT_MESSAGE=\"collide2 $(test_oid t3404_collider)\" \\\n \t\tFAKE_LINES=\"reword 1 break 2\" git rebase -i HEAD~2 &&\n-\t\ttest $colliding_sha1 = \"$(git rev-parse HEAD | cut -c 1-7)\" &&\n-\t\tgrep \"^pick $colliding_sha1 \" \\\n+\t\ttest $colliding_id = \"$(git rev-parse HEAD | cut -c 1-4)\" &&\n+\t\tgrep \"^pick $colliding_id \" \\\n \t\t\t.git/rebase-merge/git-rebase-todo.tmp &&\n-\t\tgrep \"^pick [0-9a-f]\\{40\\}\" \\\n+\t\tgrep \"^pick [0-9a-f]\\{$hexsz\\}\" \\\n \t\t\t.git/rebase-merge/git-rebase-todo &&\n-\t\tgrep \"^pick [0-9a-f]\\{40\\}\" \\\n+\t\tgrep \"^pick [0-9a-f]\\{$hexsz\\}\" \\\n \t\t\t.git/rebase-merge/git-rebase-todo.backup &&\n \t\tgit rebase --continue\n \t) &&\n"},{"id":"402071","messageId":"20200726195424.626969-16-sandals@crustytoothpaste.net","threadId":"53925","inReplyTo":"20200726195424.626969-1-sandals@crustytoothpaste.net","subject":"[PATCH v4 15/39] t7405: make hash size independent","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-26T19:54:00Z","receivedAt":"2020-07-26T19:54:52Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Use $ZERO_OID instead of hard-coding a fixed size all-zeros object ID.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n t/t7405-submodule-merge.sh | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t7405-submodule-merge.sh b/t/t7405-submodule-merge.sh\nindex aa33978ed2..6a1e5f8232 100755\n--- a/t/t7405-submodule-merge.sh\n+++ b/t/t7405-submodule-merge.sh\n@@ -195,7 +195,7 @@ test_expect_success 'git submodule status should display the merge conflict prop\n        url = $TRASH_DIRECTORY/sub\n EOF\n        cat >expect <<EOF &&\n-U0000000000000000000000000000000000000000 sub\n+U$ZERO_OID sub\n EOF\n        git submodule status > actual &&\n        test_cmp expect actual &&\n@@ -214,7 +214,7 @@ test_expect_success 'git submodule status should display the merge conflict prop\n        url = $TRASH_DIRECTORY/sub\n EOF\n        cat >expect <<EOF &&\n-U0000000000000000000000000000000000000000 sub\n+U$ZERO_OID sub\n EOF\n        git submodule status > actual &&\n        test_cmp expect actual &&\n"},{"id":"402072","messageId":"20200726195424.626969-1-sandals@crustytoothpaste.net","threadId":"53925","inReplyTo":null,"subject":"[PATCH v4 00/39] SHA-256, part 3/3","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-26T19:53:45Z","receivedAt":"2020-07-26T19:54:52Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"This is the final part required for the stage 4 implementation of\nSHA-256.\n\nChanges from v3:\n\nChanges from v2:\n* Move bundle signature parsing into a function.\n* Improve parsing of bundle capabilities.\n* Improve t5510 to select only the interesting lines with sed.\n* Use cat and a heredoc instead of multiple echos.\n* Use test_i18ngrep where appropriate.\n* Reject extensions.objectFormat for repo v0.\n* Update documentation accordingly.\n\nChanges from v1:\n* Add a patch to add a bundle v3 format with capabilities that include\n  the hash algorithm.\n* Remove bundle detection of hash algorithm using hash algorithm length.\n* Fix typo in the extensions.objectFormat documentation.\n* Document that extensions.objectFormat is ignored for repo v0.\n* Use test instead of brackets.\n* Use a command group instead of a subshell for efficiency.\n* Drop the bizarre test_might_fail, since it isn't needed (and is\n  bizarre and wrong).\n* Write \"SHA-256\" instead of \"NewHash\" in commit messages.\n* Split SHA-256 CI tests to an independent run and avoid running a third\n  test run to a single CI job.\n\nRange-diff below.\n\nJohannes Schindelin (1):\n  t3404: prepare 'short SHA-1 collision' tests for SHA-256\n\nbrian m. carlson (38):\n  t: make test-bloom initialize repository\n  t1001: use $ZERO_OID\n  t3305: make hash agnostic\n  t6100: make hash size independent\n  t6101: make hash size independent\n  t6301: make hash size independent\n  t6500: specify test values for SHA-256\n  t6501: avoid hard-coded objects\n  t7003: compute appropriate length constant\n  t7063: make hash size independent\n  t7201: abstract away SHA-1-specific constants\n  t7102: abstract away SHA-1-specific constants\n  t7400: make hash size independent\n  t7405: make hash size independent\n  t7506: avoid checking for SHA-1-specific constants\n  t7508: use $ZERO_OID instead of hard-coded constant\n  t8002: make hash size independent\n  t8003: make hash size independent\n  t8011: make hash size independent\n  t9300: abstract away SHA-1-specific constants\n  t9300: use $ZERO_OID instead of hard-coded object ID\n  t9301: make hash size independent\n  t9350: make hash size independent\n  t9500: ensure that algorithm info is preserved in config\n  t9700: make hash size independent\n  t5308: make test work with SHA-256\n  t0410: mark test with SHA1 prerequisite\n  http-fetch: set up git directory before parsing pack hashes\n  builtin/verify-pack: implement an --object-format option\n  bundle: add new version for use with SHA-256\n  setup: add support for reading extensions.objectformat\n  Enable SHA-256 support by default\n  t: add test_oid option to select hash algorithm\n  t: allow testing different hash algorithms via environment\n  t: make SHA1 prerequisite depend on default hash\n  ci: run tests with SHA-256\n  docs: add documentation for extensions.objectFormat\n  t: remove test_oid_init in tests\n\n Documentation/config.txt                  |   2 +\n Documentation/config/extensions.txt       |   8 ++\n Documentation/git-bundle.txt              |   9 +-\n Documentation/technical/bundle-format.txt |  30 ++++-\n builtin/bundle.c                          |   5 +-\n builtin/init-db.c                         |   5 -\n builtin/verify-pack.c                     |  29 +++--\n bundle.c                                  |  85 ++++++++----\n bundle.h                                  |   4 +-\n ci/run-build-and-tests.sh                 |   5 +\n config.mak.dev                            |   2 -\n http-fetch.c                              |   4 +-\n repository.c                              |   4 -\n setup.c                                   |  16 ++-\n t/helper/test-bloom.c                     |   2 +\n t/lib-pack.sh                             |  11 +-\n t/lib-submodule-update.sh                 |   1 -\n t/t0000-basic.sh                          |  15 ++-\n t/t0001-init.sh                           |  29 +++++\n t/t0410-partial-clone.sh                  |   4 +-\n t/t1006-cat-file.sh                       |   2 -\n t/t1050-large.sh                          |   1 -\n t/t1091-sparse-checkout-builtin.sh        |   4 +-\n t/t1410-reflog.sh                         |   1 -\n t/t1450-fsck.sh                           |   1 -\n t/t1500-rev-parse.sh                      |   1 -\n t/t3305-notes-fanout.sh                   |   2 +-\n t/t3308-notes-merge.sh                    |   1 -\n t/t3404-rebase-interactive.sh             |  49 +++++--\n t/t3600-rm.sh                             |   1 -\n t/t3800-mktag.sh                          |   1 -\n t/t4002-diff-basic.sh                     |   2 -\n t/t4027-diff-submodule.sh                 |   1 -\n t/t4134-apply-submodule.sh                |   1 -\n t/t4200-rerere.sh                         |   1 -\n t/t4211-line-log.sh                       |   1 -\n t/t5300-pack-object.sh                    |   3 +-\n t/t5302-pack-index.sh                     |   1 -\n t/t5308-pack-detect-duplicates.sh         |  20 +--\n t/t5313-pack-bounds-checks.sh             |   1 -\n t/t5318-commit-graph.sh                   |   3 +-\n t/t5319-multi-pack-index.sh               |   1 -\n t/t5324-split-commit-graph.sh             |   1 -\n t/t5504-fetch-receive-strict.sh           |   1 -\n t/t5510-fetch.sh                          |  15 ++-\n t/t5530-upload-pack-error.sh              |   1 -\n t/t5562-http-backend-content-length.sh    |   1 -\n t/t5607-clone-bundle.sh                   |  31 +++++\n t/t5702-protocol-v2.sh                    |   3 +-\n t/t5703-upload-pack-ref-in-want.sh        |   1 -\n t/t6006-rev-list-format.sh                |   1 -\n t/t6100-rev-list-in-order.sh              |   4 +-\n t/t6101-rev-parse-parents.sh              |   2 +-\n t/t6301-for-each-ref-errors.sh            |   2 +-\n t/t6500-gc.sh                             |  27 +++-\n t/t6501-freshen-objects.sh                |  14 +-\n t/t7003-filter-branch.sh                  |   3 +-\n t/t7063-status-untracked-cache.sh         | 151 ++++++++++++----------\n t/t7102-reset.sh                          |  93 +++++++------\n t/t7201-co.sh                             |   5 +-\n t/t7400-submodule-basic.sh                |  26 ++--\n t/t7405-submodule-merge.sh                |   4 +-\n t/t7506-status-submodule.sh               |  12 +-\n t/t7508-status.sh                         |   2 +-\n t/t8002-blame.sh                          |  15 ++-\n t/t8003-blame-corner-cases.sh             |   3 +-\n t/t8011-blame-split-file.sh               |   2 +-\n t/t9300-fast-import.sh                    | 117 +++++++++--------\n t/t9301-fast-import-notes.sh              |  13 +-\n t/t9350-fast-export.sh                    |  15 +--\n t/t9500-gitweb-standalone-no-errors.sh    |  22 +++-\n t/t9700/test.pl                           |   6 +-\n t/test-lib-functions.sh                   |  16 ++-\n t/test-lib.sh                             |   6 +-\n 74 files changed, 629 insertions(+), 355 deletions(-)\n create mode 100644 Documentation/config/extensions.txt\n\nDiff-intervalle contre v3 :\n 1:  792a7e6b99 =  1:  2d720a6beb t: make test-bloom initialize repository\n 2:  652259edaa =  2:  530704736a t1001: use $ZERO_OID\n 3:  b719726393 =  3:  33e7822d0e t3305: make hash agnostic\n 4:  137c86a4e0 =  4:  82a6827f45 t3404: prepare 'short SHA-1 collision' tests for SHA-256\n 5:  307b90fa2a =  5:  23cbd25060 t6100: make hash size independent\n 6:  f5f4028291 =  6:  9e2553b1f2 t6101: make hash size independent\n 7:  654b95494c =  7:  c2c5dd407e t6301: make hash size independent\n 8:  787bde1ffc =  8:  1ab4ed032a t6500: specify test values for SHA-256\n 9:  b63ed599fe =  9:  54fcc025bb t6501: avoid hard-coded objects\n10:  40847a1490 = 10:  a2f420fcd4 t7003: compute appropriate length constant\n11:  3dbd65993c = 11:  766bba42f6 t7063: make hash size independent\n12:  bba7969017 = 12:  66d242ccd9 t7201: abstract away SHA-1-specific constants\n13:  bf5d06f1fc = 13:  090041ee54 t7102: abstract away SHA-1-specific constants\n14:  a272eafa86 = 14:  4a6991d6a1 t7400: make hash size independent\n15:  4dc14d1ded = 15:  d39bbeb5a2 t7405: make hash size independent\n16:  f291df2f20 = 16:  5b0d52ae0e t7506: avoid checking for SHA-1-specific constants\n17:  ded35216ce = 17:  54d1706107 t7508: use $ZERO_OID instead of hard-coded constant\n18:  a197d7f09a = 18:  f3f4239ce9 t8002: make hash size independent\n19:  7c49d9a8e8 = 19:  719db3822e t8003: make hash size independent\n20:  4ab13f691a = 20:  803e5665e9 t8011: make hash size independent\n21:  81edf64b72 = 21:  d1c4351bc9 t9300: abstract away SHA-1-specific constants\n22:  d8253d9aca = 22:  db74bf3c8c t9300: use $ZERO_OID instead of hard-coded object ID\n23:  7b40da5753 = 23:  fa7daed2bf t9301: make hash size independent\n24:  1890f22a5b = 24:  84aef86ac0 t9350: make hash size independent\n25:  708f599a71 = 25:  541108fc64 t9500: ensure that algorithm info is preserved in config\n26:  33c84a2bc6 = 26:  2de5d2da58 t9700: make hash size independent\n27:  3d7476f28b = 27:  c916058c38 t5308: make test work with SHA-256\n28:  0d80e419e5 = 28:  b0781430ef t0410: mark test with SHA1 prerequisite\n29:  bd812fb0e4 = 29:  230a933e87 http-fetch: set up git directory before parsing pack hashes\n30:  667537e1aa ! 30:  d3dbe9e760 builtin/verify-pack: implement an --object-format option\n    @@ Commit message\n         Since we're not in a repository here, we need to provide git verify-pack\n         help to set things up properly.  git index-pack already knows an\n         --object-format option, so let's accept one as well and pass it down to\n    -    our git index-pack invocation.  Since this argument is optional, let's\n    -    dynamically determine the proper location to insert it into the array.\n    -    Finally, let's make t5702 pass the proper argument on down to its git\n    -    verify-pack caller.\n    +    our git index-pack invocation.  Since we're now dynamically adjusting\n    +    the elements in argv, let's switch to using struct argv_array to manage\n    +    them.  Finally, let's make t5702 pass the proper argument on down to its\n    +    git verify-pack caller.\n     \n         Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n     \n    @@ builtin/verify-pack.c\n      \tstruct child_process index_pack = CHILD_PROCESS_INIT;\n     -\tconst char *argv[] = {\"index-pack\", NULL, NULL, NULL };\n     -\tstruct strbuf arg = STRBUF_INIT;\n    -+\tconst char *argv[] = {\"index-pack\", NULL, NULL, NULL, NULL };\n    ++\tstruct argv_array argv = ARGV_ARRAY_INIT;\n     +\tstruct strbuf arg = STRBUF_INIT, hash_arg = STRBUF_INIT;\n      \tint verbose = flags & VERIFY_PACK_VERBOSE;\n      \tint stat_only = flags & VERIFY_PACK_STAT_ONLY;\n      \tint err;\n    -+\tint argno = 1;\n      \n    ++\targv_array_push(&argv, \"index-pack\");\n    ++\n      \tif (stat_only)\n     -\t\targv[1] = \"--verify-stat-only\";\n    -+\t\targv[argno++] = \"--verify-stat-only\";\n    ++\t\targv_array_push(&argv, \"--verify-stat-only\");\n      \telse if (verbose)\n     -\t\targv[1] = \"--verify-stat\";\n    -+\t\targv[argno++] = \"--verify-stat\";\n    ++\t\targv_array_push(&argv, \"--verify-stat\");\n      \telse\n     -\t\targv[1] = \"--verify\";\n    -+\t\targv[argno++] = \"--verify\";\n    ++\t\targv_array_push(&argv, \"--verify\");\n     +\n     +\tif (hash_algo) {\n     +\t\tstrbuf_addf(&hash_arg, \"--object-format=%s\", hash_algo);\n    -+\t\targv[argno++] = hash_arg.buf;\n    ++\t\targv_array_push(&argv, hash_arg.buf);\n     +\t}\n      \n      \t/*\n    @@ builtin/verify-pack.c: static int verify_one_pack(const char *path, unsigned int\n      \t    !ends_with(arg.buf, \".pack\"))\n      \t\tstrbuf_addstr(&arg, \".pack\");\n     -\targv[2] = arg.buf;\n    -+\targv[argno++] = arg.buf;\n    ++\targv_array_push(&argv, arg.buf);\n      \n    - \tindex_pack.argv = argv;\n    +-\tindex_pack.argv = argv;\n    ++\tindex_pack.argv = argv.argv;\n      \tindex_pack.git_cmd = 1;\n    + \n    + \terr = run_command(&index_pack);\n    +@@ builtin/verify-pack.c: static int verify_one_pack(const char *path, unsigned int flags)\n    + \t\t}\n    + \t}\n    + \tstrbuf_release(&arg);\n    ++\targv_array_clear(&argv);\n    + \n    + \treturn err;\n    + }\n     @@ builtin/verify-pack.c: int cmd_verify_pack(int argc, const char **argv, const char *prefix)\n      {\n      \tint err = 0;\n31:  acdf1d9009 ! 31:  e3805101ce bundle: add new version for use with SHA-256\n    @@ Commit message\n         for SHA-256.\n     \n         In t5510, always use format v3 so we can be sure we produce consistent\n    -    results across hash algorithms.  Note here that head -n N lists the top\n    -    N lines, whereas we want to check only the given line, so while we're at\n    -    it, switch to use sed to make sure we're checking only the line we care\n    -    about for a match.\n    +    results across hash algorithms.  Since head -n N lists the top N lines\n    +    instead of the Nth line, let's run our output through sed to normalize\n    +    it and compare it against a fixed value, which will make sure we get\n    +    exactly what we're expecting.\n     \n         Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n     \n    @@ Documentation/technical/bundle-format.txt: reference    = obj-id SP refname LF\n      == Semantics\n      \n     -A Git bundle consists of three parts.\n    -+A Git bundle consists of four parts.\n    ++A Git bundle consists of several parts.\n     +\n     +* \"Capabilities\", which are only in the v3 format, indicate functionality that\n     +\tthe bundle requires to be read properly.\n    @@ t/t5510-fetch.sh: test_expect_success 'create bundle 1' '\n     -\thead -n 2 \"$D\"/bundle1 | grep \"^-$OID_REGEX \" &&\n     -\thead -n 3 \"$D\"/bundle1 | grep \"^$OID_REGEX \" &&\n     -\thead -n 4 \"$D\"/bundle1 | grep \"^$\"\n    -+\tsed -n -e 1p \"$D\"/bundle1 | grep \"^#\" &&\n    -+\tsed -n -e 2p \"$D\"/bundle1 | grep \"^@object-format=\" &&\n    -+\tsed -n -e 3p \"$D\"/bundle1 | grep \"^-$OID_REGEX \" &&\n    -+\tsed -n -e 4p \"$D\"/bundle1 | grep \"^$OID_REGEX \" &&\n    -+\tsed -n -e 5p \"$D\"/bundle1 | grep \"^$\"\n    ++\tcat >expect <<-EOF &&\n    ++\t# v3 git bundle\n    ++\t@object-format=$(test_oid algo)\n    ++\t-OID message\n    ++\tOID message\n    ++\n    ++\tEOF\n    ++\tsed -e \"s/$OID_REGEX .*/OID message/g\" -e \"5q\" \"$D\"/bundle1 >actual &&\n    ++\ttest_cmp expect actual\n      '\n      \n      test_expect_success 'create bundle 2' '\n    @@ t/t5607-clone-bundle.sh: test_expect_success 'fetch SHA-1 from bundle' '\n     +\t# v3 git bundle\n     +\t@object-format=$(test_oid algo)\n     +\tEOF\n    -+\ttest_cmp actual expect &&\n    ++\ttest_cmp expect actual &&\n     +\tgit bundle verify bundle\n     +'\n     +\n    -+test_expect_success 'git bundle v3 rejects unknown extensions' '\n    -+\thead -n2 bundle >new &&\n    -+\techo \"@unknown=silly\" >>new &&\n    -+\tsed \"1,2d\" bundle >>new &&\n    ++test_expect_success 'git bundle v3 rejects unknown capabilities' '\n    ++\tcat >new <<-EOF &&\n    ++\t# v3 git bundle\n    ++\t@object-format=$(test_oid algo)\n    ++\t@unknown=silly\n    ++\tEOF\n     +\ttest_must_fail git bundle verify new 2>output &&\n     +\ttest_i18ngrep \"unknown capability .unknown=silly.\" output\n     +'\n32:  65310eaf1b = 32:  c941fcf63c setup: add support for reading extensions.objectformat\n33:  f69cf8b1b5 = 33:  7c6264ac79 Enable SHA-256 support by default\n34:  e41d139b78 ! 34:  2719ab94e6 t: add test_oid option to select hash algorithm\n    @@ Commit message\n     \n         In order to do so, we'll need to read both the source algorithm and the\n         current algorithm, so add an optional flag to the test_oid helper that\n    -    lets us read look up a value for a specified hash algorithm. This should\n    +    lets us look up a value for a specified hash algorithm. This should\n         not cause any conflicts with existing tests, since key arguments to\n         test_oid are allowed to contains only shell identifier characters.\n     \n    @@ t/t0000-basic.sh: test_expect_success 'test_oid can look up data for SHA-256' '\n      \ttest \"$hexsz\" -eq 64\n      '\n      \n    -+test_expect_success 'test_oid can look up data a specified algorithm' '\n    ++test_expect_success 'test_oid can look up data for a specified algorithm' '\n     +\trawsz=\"$(test_oid --hash=sha1 rawsz)\" &&\n     +\thexsz=\"$(test_oid --hash=sha1 hexsz)\" &&\n     +\ttest \"$rawsz\" -eq 20 &&\n    @@ t/test-lib-functions.sh: test_oid_cache () {\n     +\tlocal algo=\"${test_hash_algo}\" &&\n     +\n     +\tcase \"$1\" in\n    -+\t\t--hash=*)\n    -+\t\t\talgo=\"${1#--hash=}\" &&\n    -+\t\t\tshift;;\n    -+\t\t*)\n    -+\t\t\t;;\n    ++\t--hash=*)\n    ++\t\talgo=\"${1#--hash=}\" &&\n    ++\t\tshift;;\n    ++\t*)\n    ++\t\t;;\n     +\tesac &&\n     +\n     +\tlocal var=\"test_oid_${algo}_$1\" &&\n35:  20dbc5ff66 = 35:  1c8e5041d1 t: allow testing different hash algorithms via environment\n36:  4ee7f9eec8 = 36:  7213d59222 t: make SHA1 prerequisite depend on default hash\n37:  0080a96f7b = 37:  caf6c026ba ci: run tests with SHA-256\n38:  03e1203a08 = 38:  ec4e6ae166 docs: add documentation for extensions.objectFormat\n39:  fbc015258f = 39:  3185c62cfc t: remove test_oid_init in tests\n"},{"id":"402104","messageId":"20200726195424.626969-13-sandals@crustytoothpaste.net","threadId":"53925","inReplyTo":"20200726195424.626969-1-sandals@crustytoothpaste.net","subject":"[PATCH v4 12/39] t7201: abstract away SHA-1-specific constants","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-26T19:53:57Z","receivedAt":"2020-07-26T19:54:52Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Adjust the test so that it computes variables for object IDs instead of\nusing hard-coded hashes.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n t/t7201-co.sh | 5 +++--\n 1 file changed, 3 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t7201-co.sh b/t/t7201-co.sh\nindex b696bae5f5..d4fd760915 100755\n--- a/t/t7201-co.sh\n+++ b/t/t7201-co.sh\n@@ -230,9 +230,10 @@ test_expect_success 'switch to another branch while carrying a deletion' '\n test_expect_success 'checkout to detach HEAD (with advice declined)' '\n \n \tgit config advice.detachedHead false &&\n+\trev=$(git rev-parse --short renamer^) &&\n \tgit checkout -f renamer && git clean -f &&\n \tgit checkout renamer^ 2>messages &&\n-\ttest_i18ngrep \"HEAD is now at 7329388\" messages &&\n+\ttest_i18ngrep \"HEAD is now at $rev\" messages &&\n \ttest_line_count = 1 messages &&\n \tH=$(git rev-parse --verify HEAD) &&\n \tM=$(git show-ref -s --verify refs/heads/master) &&\n@@ -250,7 +251,7 @@ test_expect_success 'checkout to detach HEAD' '\n \tgit config advice.detachedHead true &&\n \tgit checkout -f renamer && git clean -f &&\n \tGIT_TEST_GETTEXT_POISON=false git checkout renamer^ 2>messages &&\n-\tgrep \"HEAD is now at 7329388\" messages &&\n+\tgrep \"HEAD is now at $rev\" messages &&\n \ttest_line_count -gt 1 messages &&\n \tH=$(git rev-parse --verify HEAD) &&\n \tM=$(git show-ref -s --verify refs/heads/master) &&\n"},{"id":"402067","messageId":"20200726195424.626969-20-sandals@crustytoothpaste.net","threadId":"53925","inReplyTo":"20200726195424.626969-1-sandals@crustytoothpaste.net","subject":"[PATCH v4 19/39] t8003: make hash size independent","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-26T19:54:04Z","receivedAt":"2020-07-26T19:54:53Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"One assertion in this test invokes git with core.abbrev set to \"40\".\nSince we're expecting the full hash length, use test_oid to look up the\nfull hash length for the hash in use.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n t/t8003-blame-corner-cases.sh | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git a/t/t8003-blame-corner-cases.sh b/t/t8003-blame-corner-cases.sh\nindex 9130b887d2..ebe79aa4ea 100755\n--- a/t/t8003-blame-corner-cases.sh\n+++ b/t/t8003-blame-corner-cases.sh\n@@ -6,6 +6,7 @@ test_description='git blame corner cases'\n pick_fc='s/^[0-9a-f^]* *\\([^ ]*\\) *(\\([^ ]*\\) .*/\\1-\\2/'\n \n test_expect_success setup '\n+\ttest_oid_init &&\n \n \techo A A A A A >one &&\n \techo B B B B B >two &&\n@@ -306,7 +307,7 @@ test_expect_success 'blame coalesce' '\n \t$oid 1) ABC\n \t$oid 2) DEF\n \tEOF\n-\tgit -c core.abbrev=40 blame -s giraffe >actual &&\n+\tgit -c core.abbrev=$(test_oid hexsz) blame -s giraffe >actual &&\n \ttest_cmp expect actual\n '\n \n"},{"id":"402073","messageId":"20200726195424.626969-14-sandals@crustytoothpaste.net","threadId":"53925","inReplyTo":"20200726195424.626969-1-sandals@crustytoothpaste.net","subject":"[PATCH v4 13/39] t7102: abstract away SHA-1-specific constants","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-26T19:53:58Z","receivedAt":"2020-07-26T19:54:53Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Adjust the test so that it computes variables for object IDs instead of\nusing hard-coded hashes.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n t/t7102-reset.sh | 93 +++++++++++++++++++++++++++---------------------\n 1 file changed, 53 insertions(+), 40 deletions(-)\n\ndiff --git a/t/t7102-reset.sh b/t/t7102-reset.sh\nindex 97be0d968d..22161b3b2d 100755\n--- a/t/t7102-reset.sh\n+++ b/t/t7102-reset.sh\n@@ -37,17 +37,23 @@ test_expect_success 'creating initial files and commits' '\n \n \techo \"2nd line 1st file\" >>first &&\n \tgit commit -a -m \"modify 1st file\" &&\n+\thead5p2=$(git rev-parse --verify HEAD) &&\n+\thead5p2f=$(git rev-parse --short HEAD:first) &&\n \n \tgit rm first &&\n \tgit mv second secondfile &&\n \tgit commit -a -m \"remove 1st and rename 2nd\" &&\n+\thead5p1=$(git rev-parse --verify HEAD) &&\n+\thead5p1s=$(git rev-parse --short HEAD:secondfile) &&\n \n \techo \"1st line 2nd file\" >secondfile &&\n \techo \"2nd line 2nd file\" >>secondfile &&\n \t# \"git commit -m\" would break MinGW, as Windows refuse to pass\n \t# $test_encoding encoded parameter to git.\n \tcommit_msg $test_encoding | git -c \"i18n.commitEncoding=$test_encoding\" commit -a -F - &&\n-\thead5=$(git rev-parse --verify HEAD)\n+\thead5=$(git rev-parse --verify HEAD) &&\n+\thead5s=$(git rev-parse --short HEAD:secondfile) &&\n+\thead5sl=$(git rev-parse HEAD:secondfile)\n '\n # git log --pretty=oneline # to see those SHA1 involved\n \n@@ -94,7 +100,7 @@ test_expect_success 'giving a non existing revision should fail' '\n \n test_expect_success 'reset --soft with unmerged index should fail' '\n \ttouch .git/MERGE_HEAD &&\n-\techo \"100644 44c5b5884550c17758737edcced463447b91d42b 1\tun\" |\n+\techo \"100644 $head5sl 1\tun\" |\n \t\tgit update-index --index-info &&\n \ttest_must_fail git reset --soft HEAD &&\n \trm .git/MERGE_HEAD &&\n@@ -192,7 +198,7 @@ test_expect_success \\\n >.diff_expect\n cat >.cached_expect <<EOF\n diff --git a/secondfile b/secondfile\n-index 1bbba79..44c5b58 100644\n+index $head5p1s..$head5s 100644\n --- a/secondfile\n +++ b/secondfile\n @@ -1 +1,2 @@\n@@ -207,7 +213,7 @@ secondfile:\n EOF\n test_expect_success '--soft reset only should show changes in diff --cached' '\n \tgit reset --soft HEAD^ &&\n-\tcheck_changes d1a4bc3abce4829628ae2dcb0d60ef3d1a78b1c4 &&\n+\tcheck_changes $head5p1 &&\n \ttest \"$(git rev-parse ORIG_HEAD)\" = \\\n \t\t\t$head5\n '\n@@ -242,7 +248,7 @@ EOF\n test_expect_success \\\n \t'--hard reset should change the files and undo commits permanently' '\n \tgit reset --hard HEAD~2 &&\n-\tcheck_changes ddaefe00f1da16864591c61fdc7adb5d7cd6b74e &&\n+\tcheck_changes $head5p2 &&\n \ttest \"$(git rev-parse ORIG_HEAD)\" = \\\n \t\t\t$head4\n '\n@@ -251,7 +257,7 @@ test_expect_success \\\n cat >.cached_expect <<EOF\n diff --git a/first b/first\n deleted file mode 100644\n-index 8206c22..0000000\n+index $head5p2f..0000000\n --- a/first\n +++ /dev/null\n @@ -1,2 +0,0 @@\n@@ -259,14 +265,14 @@ index 8206c22..0000000\n -2nd line 1st file\n diff --git a/second b/second\n deleted file mode 100644\n-index 1bbba79..0000000\n+index $head5p1s..0000000\n --- a/second\n +++ /dev/null\n @@ -1 +0,0 @@\n -2nd file\n diff --git a/secondfile b/secondfile\n new file mode 100644\n-index 0000000..44c5b58\n+index 0000000..$head5s\n --- /dev/null\n +++ b/secondfile\n @@ -0,0 +1,2 @@\n@@ -286,13 +292,13 @@ test_expect_success \\\n \techo \"1st line 2nd file\" >secondfile &&\n \techo \"2nd line 2nd file\" >>secondfile &&\n \tgit add secondfile &&\n-\tcheck_changes ddaefe00f1da16864591c61fdc7adb5d7cd6b74e\n+\tcheck_changes $head5p2\n '\n \n cat >.diff_expect <<EOF\n diff --git a/first b/first\n deleted file mode 100644\n-index 8206c22..0000000\n+index $head5p2f..0000000\n --- a/first\n +++ /dev/null\n @@ -1,2 +0,0 @@\n@@ -300,7 +306,7 @@ index 8206c22..0000000\n -2nd line 1st file\n diff --git a/second b/second\n deleted file mode 100644\n-index 1bbba79..0000000\n+index $head5p1s..0000000\n --- a/second\n +++ /dev/null\n @@ -1 +0,0 @@\n@@ -314,9 +320,8 @@ secondfile:\n EOF\n test_expect_success '--mixed reset to HEAD should unadd the files' '\n \tgit reset &&\n-\tcheck_changes ddaefe00f1da16864591c61fdc7adb5d7cd6b74e &&\n-\ttest \"$(git rev-parse ORIG_HEAD)\" = \\\n-\t\t\tddaefe00f1da16864591c61fdc7adb5d7cd6b74e\n+\tcheck_changes $head5p2 &&\n+\ttest \"$(git rev-parse ORIG_HEAD)\" = $head5p2\n '\n \n >.diff_expect\n@@ -328,7 +333,7 @@ secondfile:\n EOF\n test_expect_success 'redoing the last two commits should succeed' '\n \tgit add secondfile &&\n-\tgit reset --hard ddaefe00f1da16864591c61fdc7adb5d7cd6b74e &&\n+\tgit reset --hard $head5p2 &&\n \n \tgit rm first &&\n \tgit mv second secondfile &&\n@@ -389,47 +394,55 @@ test_expect_success \\\n \tcheck_changes $head5\n '\n \n-cat > expect << EOF\n-diff --git a/file1 b/file1\n-index d00491f..7ed6ff8 100644\n---- a/file1\n-+++ b/file1\n-@@ -1 +1 @@\n--1\n-+5\n-diff --git a/file2 b/file2\n-deleted file mode 100644\n-index 0cfbf08..0000000\n---- a/file2\n-+++ /dev/null\n-@@ -1 +0,0 @@\n--2\n-EOF\n-cat > cached_expect << EOF\n-diff --git a/file4 b/file4\n-new file mode 100644\n-index 0000000..b8626c4\n---- /dev/null\n-+++ b/file4\n-@@ -0,0 +1 @@\n-+4\n-EOF\n test_expect_success 'test --mixed <paths>' '\n \techo 1 > file1 &&\n \techo 2 > file2 &&\n \tgit add file1 file2 &&\n \ttest_tick &&\n \tgit commit -m files &&\n+\tbefore1=$(git rev-parse --short HEAD:file1) &&\n+\tbefore2=$(git rev-parse --short HEAD:file2) &&\n \tgit rm file2 &&\n \techo 3 > file3 &&\n \techo 4 > file4 &&\n \techo 5 > file1 &&\n+\tafter1=$(git rev-parse --short $(git hash-object file1)) &&\n+\tafter4=$(git rev-parse --short $(git hash-object file4)) &&\n \tgit add file1 file3 file4 &&\n \tgit reset HEAD -- file1 file2 file3 &&\n \ttest_must_fail git diff --quiet &&\n \tgit diff > output &&\n+\n+\tcat > expect <<-EOF &&\n+\tdiff --git a/file1 b/file1\n+\tindex $before1..$after1 100644\n+\t--- a/file1\n+\t+++ b/file1\n+\t@@ -1 +1 @@\n+\t-1\n+\t+5\n+\tdiff --git a/file2 b/file2\n+\tdeleted file mode 100644\n+\tindex $before2..0000000\n+\t--- a/file2\n+\t+++ /dev/null\n+\t@@ -1 +0,0 @@\n+\t-2\n+\tEOF\n+\n \ttest_cmp expect output &&\n \tgit diff --cached > output &&\n+\n+\tcat > cached_expect <<-EOF &&\n+\tdiff --git a/file4 b/file4\n+\tnew file mode 100644\n+\tindex 0000000..$after4\n+\t--- /dev/null\n+\t+++ b/file4\n+\t@@ -0,0 +1 @@\n+\t+4\n+\tEOF\n+\n \ttest_cmp cached_expect output\n '\n \n"},{"id":"402074","messageId":"20200726195424.626969-19-sandals@crustytoothpaste.net","threadId":"53925","inReplyTo":"20200726195424.626969-1-sandals@crustytoothpaste.net","subject":"[PATCH v4 18/39] t8002: make hash size independent","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-26T19:54:03Z","receivedAt":"2020-07-26T19:54:54Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Compute the length of an object ID instead of of hard-coding 40-based\nvalues.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n t/t8002-blame.sh | 19 ++++++++++++-------\n 1 file changed, 12 insertions(+), 7 deletions(-)\n\ndiff --git a/t/t8002-blame.sh b/t/t8002-blame.sh\nindex eea048e52c..557c886559 100755\n--- a/t/t8002-blame.sh\n+++ b/t/t8002-blame.sh\n@@ -6,6 +6,10 @@ test_description='git blame'\n PROG='git blame -c'\n . \"$TEST_DIRECTORY\"/annotate-tests.sh\n \n+test_expect_success 'setup' '\n+\ttest_oid_init\n+'\n+\n test_expect_success 'blame untracked file in empty repo' '\n \t>untracked &&\n \ttest_must_fail git blame untracked\n@@ -105,17 +109,18 @@ test_expect_success 'blame --abbrev=<n> works' '\n '\n \n test_expect_success 'blame -l aligns regular and boundary commits' '\n-\tcheck_abbrev 40 -l HEAD &&\n-\tcheck_abbrev 39 -l ^HEAD\n+\thexsz=$(test_oid hexsz) &&\n+\tcheck_abbrev $hexsz         -l HEAD &&\n+\tcheck_abbrev $((hexsz - 1)) -l ^HEAD\n '\n \n-test_expect_success 'blame --abbrev=40 behaves like -l' '\n-\tcheck_abbrev 40 --abbrev=40 HEAD &&\n-\tcheck_abbrev 39 --abbrev=40 ^HEAD\n+test_expect_success 'blame --abbrev with full length behaves like -l' '\n+\tcheck_abbrev $hexsz         --abbrev=$hexsz HEAD &&\n+\tcheck_abbrev $((hexsz - 1)) --abbrev=$hexsz ^HEAD\n '\n \n-test_expect_success '--no-abbrev works like --abbrev=40' '\n-\tcheck_abbrev 40 --no-abbrev\n+test_expect_success '--no-abbrev works like --abbrev with full length' '\n+\tcheck_abbrev $hexsz --no-abbrev\n '\n \n test_expect_success '--exclude-promisor-objects does not BUG-crash' '\n"},{"id":"402075","messageId":"20200726195424.626969-21-sandals@crustytoothpaste.net","threadId":"53925","inReplyTo":"20200726195424.626969-1-sandals@crustytoothpaste.net","subject":"[PATCH v4 20/39] t8011: make hash size independent","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-26T19:54:05Z","receivedAt":"2020-07-26T19:54:56Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Allow lines which start with either a 40- or 64-character hex object ID,\nto allow for both SHA-1 and SHA-256.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n t/t8011-blame-split-file.sh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/t/t8011-blame-split-file.sh b/t/t8011-blame-split-file.sh\nindex 831125047b..8a4626d496 100755\n--- a/t/t8011-blame-split-file.sh\n+++ b/t/t8011-blame-split-file.sh\n@@ -54,7 +54,7 @@ test_expect_success 'setup simulated porcelain' '\n \tcat >read-porcelain.pl <<-\\EOF\n \tmy $field = shift;\n \twhile (<>) {\n-\t\tif (/^[0-9a-f]{40} /) {\n+\t\tif (/^[0-9a-f]{40,64} /) {\n \t\t\tflush();\n \t\t\t$hash = $&;\n \t\t} elsif (/^$field (.*)/) {\n"},{"id":"402076","messageId":"20200726195424.626969-24-sandals@crustytoothpaste.net","threadId":"53925","inReplyTo":"20200726195424.626969-1-sandals@crustytoothpaste.net","subject":"[PATCH v4 23/39] t9301: make hash size independent","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-26T19:54:08Z","receivedAt":"2020-07-26T19:54:58Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Instead of using a hard-coded all-zeros object ID, use $ZERO_OID.\nCompute the length of the object IDs in use and use this instead of\nhard-coding the constant 40.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n t/t9301-fast-import-notes.sh | 14 +++++++-------\n 1 file changed, 7 insertions(+), 7 deletions(-)\n\ndiff --git a/t/t9301-fast-import-notes.sh b/t/t9301-fast-import-notes.sh\nindex ca223dca98..9d1aaac980 100755\n--- a/t/t9301-fast-import-notes.sh\n+++ b/t/t9301-fast-import-notes.sh\n@@ -71,7 +71,7 @@ EOF\n INPUT_END\n \n test_expect_success 'set up master branch' '\n-\n+\ttest_oid_init &&\n \tgit fast-import <input &&\n \tgit whatchanged master\n '\n@@ -470,12 +470,13 @@ test_expect_success 'add lots of commits and notes' '\n '\n \n test_expect_success 'verify that lots of notes trigger a fanout scheme' '\n+\thexsz=$(test_oid hexsz) &&\n \n \t# None of the entries in the top-level notes tree should be a full SHA1\n \tgit ls-tree --name-only refs/notes/many_notes |\n \twhile read path\n \tdo\n-\t\tif test $(expr length \"$path\") -ge 40\n+\t\tif test $(expr length \"$path\") -ge $hexsz\n \t\tthen\n \t\t\treturn 1\n \t\tfi\n@@ -518,7 +519,7 @@ test_expect_success 'verify that importing a notes tree respects the fanout sche\n \tgit ls-tree --name-only refs/notes/other_notes |\n \twhile read path\n \tdo\n-\t\tif test $(expr length \"$path\") -ge 40\n+\t\tif test $(expr length \"$path\") -ge $hexsz\n \t\tthen\n \t\t\treturn 1\n \t\tfi\n@@ -593,7 +594,7 @@ test_expect_success 'verify that changing notes respect existing fanout' '\n \tgit ls-tree --name-only refs/notes/many_notes |\n \twhile read path\n \tdo\n-\t\tif test $(expr length \"$path\") -ge 40\n+\t\tif test $(expr length \"$path\") -ge $hexsz\n \t\tthen\n \t\t\treturn 1\n \t\tfi\n@@ -616,7 +617,7 @@ i=$(($num_commits - $remaining_notes))\n for sha1 in $(git rev-list -n $i refs/heads/many_commits)\n do\n \tcat >>input <<INPUT_END\n-N 0000000000000000000000000000000000000000 $sha1\n+N $ZERO_OID $sha1\n INPUT_END\n done\n \n@@ -646,7 +647,6 @@ test_expect_success 'remove lots of notes' '\n '\n \n test_expect_success 'verify that removing notes trigger fanout consolidation' '\n-\n \t# All entries in the top-level notes tree should be a full SHA1\n \tgit ls-tree --name-only -r refs/notes/many_notes |\n \twhile read path\n@@ -656,7 +656,7 @@ test_expect_success 'verify that removing notes trigger fanout consolidation' '\n \t\ttest \"$path\" = \"deadbeef\" && continue\n \t\ttest \"$path\" = \"de/adbeef\" && continue\n \n-\t\tif test $(expr length \"$path\") -ne 40\n+\t\tif test $(expr length \"$path\") -ne $hexsz\n \t\tthen\n \t\t\treturn 1\n \t\tfi\n"},{"id":"402077","messageId":"20200726195424.626969-30-sandals@crustytoothpaste.net","threadId":"53925","inReplyTo":"20200726195424.626969-1-sandals@crustytoothpaste.net","subject":"[PATCH v4 29/39] http-fetch: set up git directory before parsing pack hashes","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-26T19:54:14Z","receivedAt":"2020-07-26T19:54:58Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"In dd4b732df7 (\"upload-pack: send part of packfile response as uri\",\n2020-06-10), the git http-fetch code learned how to take  ac --packfile\noption.  This option takes an argument, which is the name of a packfile\nhash, and parses it using parse_oid_hex.  It does so before calling\nsetup_git_directory.\n\nHowever, in a SHA-256 repository this fails to work, since we have not\nset the hash algorithm in use and parse_oid_hex fails as a consequence.\nTo ensure that we can parse packfile hashes of the right length, let's\nset up the git directory before we start parsing arguments.\n---\n http-fetch.c | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/http-fetch.c b/http-fetch.c\nindex 1df376e745..8db7eb669f 100644\n--- a/http-fetch.c\n+++ b/http-fetch.c\n@@ -86,6 +86,8 @@ int cmd_main(int argc, const char **argv)\n \tint packfile = 0;\n \tstruct object_id packfile_hash;\n \n+\tsetup_git_directory();\n+\n \twhile (arg < argc && argv[arg][0] == '-') {\n \t\tconst char *p;\n \n@@ -115,8 +117,6 @@ int cmd_main(int argc, const char **argv)\n \tif (argc != arg + 2 - (commits_on_stdin || packfile))\n \t\tusage(http_fetch_usage);\n \n-\tsetup_git_directory();\n-\n \tgit_config(git_default_config, NULL);\n \n \tif (packfile) {\n"},{"id":"402078","messageId":"20200726195424.626969-36-sandals@crustytoothpaste.net","threadId":"53925","inReplyTo":"20200726195424.626969-1-sandals@crustytoothpaste.net","subject":"[PATCH v4 35/39] t: allow testing different hash algorithms via environment","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-26T19:54:20Z","receivedAt":"2020-07-26T19:55:02Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"To allow developers to run the testsuite with a different algorithm than\nthe default, provide an environment variable, GIT_TEST_DEFAULT_HASH, to\nspecify the algorithm to use. Compute the fixed constants using\ntest_oid. Move the constant initialization down below the point where\ntest-lib-functions.sh is loaded so the functions are defined.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n t/test-lib-functions.sh | 4 +---\n t/test-lib.sh           | 3 +++\n 2 files changed, 4 insertions(+), 3 deletions(-)\n\ndiff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh\nindex 2608e80f11..2e01bb2c2b 100644\n--- a/t/test-lib-functions.sh\n+++ b/t/test-lib-functions.sh\n@@ -1417,9 +1417,7 @@ test_set_hash () {\n \n # Detect the hash algorithm in use.\n test_detect_hash () {\n-\t# Currently we only support SHA-1, but in the future this function will\n-\t# actually detect the algorithm in use.\n-\ttest_hash_algo='sha1'\n+\ttest_hash_algo=\"${GIT_TEST_DEFAULT_HASH:-sha1}\"\n }\n \n # Load common hash metadata and common placeholder object IDs for use with\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex 618a7c8d5b..307bb2207e 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -452,6 +452,9 @@ export GIT_AUTHOR_EMAIL GIT_AUTHOR_NAME\n export GIT_COMMITTER_EMAIL GIT_COMMITTER_NAME\n export EDITOR\n \n+GIT_DEFAULT_HASH=\"${GIT_TEST_DEFAULT_HASH:-sha1}\"\n+export GIT_DEFAULT_HASH\n+\n # Tests using GIT_TRACE typically don't want <timestamp> <file>:<line> output\n GIT_TRACE_BARE=1\n export GIT_TRACE_BARE\n"},{"id":"402080","messageId":"20200726195424.626969-39-sandals@crustytoothpaste.net","threadId":"53925","inReplyTo":"20200726195424.626969-1-sandals@crustytoothpaste.net","subject":"[PATCH v4 38/39] docs: add documentation for extensions.objectFormat","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-26T19:54:23Z","receivedAt":"2020-07-26T19:55:02Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Document the extensions.objectFormat config setting.  Warn users not to\nmodify it themselves.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n Documentation/config.txt            | 2 ++\n Documentation/config/extensions.txt | 8 ++++++++\n 2 files changed, 10 insertions(+)\n create mode 100644 Documentation/config/extensions.txt\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex ef0768b91a..3042d80978 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -348,6 +348,8 @@ include::config/diff.txt[]\n \n include::config/difftool.txt[]\n \n+include::config/extensions.txt[]\n+\n include::config/fastimport.txt[]\n \n include::config/feature.txt[]\ndiff --git a/Documentation/config/extensions.txt b/Documentation/config/extensions.txt\nnew file mode 100644\nindex 0000000000..e97a78bdd6\n--- /dev/null\n+++ b/Documentation/config/extensions.txt\n@@ -0,0 +1,8 @@\n+extensions.objectFormat::\n+\tSpecify the hash algorithm to use.  The acceptable values are `sha1` and\n+\t`sha256`.  If not specified, `sha1` is assumed.  It is an error to specify\n+\tthis key unless `core.repositoryformatversion` is 1.\n++\n+Note that this setting should only be set by linkgit:git-init[1] or\n+linkgit:git-clone[1].  Trying to change it after initialization will not\n+work and will produce hard-to-diagnose issues.\n"},{"id":"402079","messageId":"20200726195424.626969-38-sandals@crustytoothpaste.net","threadId":"53925","inReplyTo":"20200726195424.626969-1-sandals@crustytoothpaste.net","subject":"[PATCH v4 37/39] ci: run tests with SHA-256","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-26T19:54:22Z","receivedAt":"2020-07-26T19:55:04Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Now that we have Git supporting SHA-256, we'd like to make sure that we\ndon't regress that state.  Unfortunately, it's easy to do so, so to\nhelp, let's add code to run one of our CI jobs with SHA-256 as the\ndefault hash.  This will help us detect any problems that may occur.\n\nWe pick the linux-clang job because it's relatively fast and the\nlinux-gcc job already runs the testsuite twice.  We want our tests to\nrun as fast as possible, so we wouldn't want to add a third run to the\nlinux-gcc job.  To make sure we properly exercise the code, let's run\nthe tests in the default mode (SHA-1) first and then run a second time\nwith SHA-256.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n ci/run-build-and-tests.sh | 5 +++++\n 1 file changed, 5 insertions(+)\n\ndiff --git a/ci/run-build-and-tests.sh b/ci/run-build-and-tests.sh\nindex 17e25aade9..a1a6a28791 100755\n--- a/ci/run-build-and-tests.sh\n+++ b/ci/run-build-and-tests.sh\n@@ -24,6 +24,11 @@ linux-gcc)\n \texport GIT_TEST_ADD_I_USE_BUILTIN=1\n \tmake test\n \t;;\n+linux-clang)\n+\tmake test\n+\texport GIT_TEST_DEFAULT_HASH=sha256\n+\tmake test\n+\t;;\n linux-gcc-4.8)\n \t# Don't run the tests; we only care about whether Git can be\n \t# built with GCC 4.8, as it errors out on some undesired (C99)\n"},{"id":"402082","messageId":"20200726195424.626969-34-sandals@crustytoothpaste.net","threadId":"53925","inReplyTo":"20200726195424.626969-1-sandals@crustytoothpaste.net","subject":"[PATCH v4 33/39] Enable SHA-256 support by default","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-26T19:54:18Z","receivedAt":"2020-07-26T19:55:04Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Now that the we have a complete SHA-256 implementation in Git, let's\nenable it so people can use it.  Remove the ENABLE_SHA256 define\nconstant everywhere it's used.  Add tests for initializing a repository\nwith SHA-256.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n builtin/init-db.c |  5 -----\n config.mak.dev    |  2 --\n repository.c      |  4 ----\n t/t0001-init.sh   | 29 +++++++++++++++++++++++++++++\n 4 files changed, 29 insertions(+), 11 deletions(-)\n\ndiff --git a/builtin/init-db.c b/builtin/init-db.c\nindex cee64823cb..f70076d38e 100644\n--- a/builtin/init-db.c\n+++ b/builtin/init-db.c\n@@ -183,11 +183,6 @@ void initialize_repository_version(int hash_algo)\n \tchar repo_version_string[10];\n \tint repo_version = GIT_REPO_VERSION;\n \n-#ifndef ENABLE_SHA256\n-\tif (hash_algo != GIT_HASH_SHA1)\n-\t\tdie(_(\"The hash algorithm %s is not supported in this build.\"), hash_algos[hash_algo].name);\n-#endif\n-\n \tif (hash_algo != GIT_HASH_SHA1)\n \t\trepo_version = GIT_REPO_VERSION_READ;\n \ndiff --git a/config.mak.dev b/config.mak.dev\nindex cd4a82a9eb..89b218d11a 100644\n--- a/config.mak.dev\n+++ b/config.mak.dev\n@@ -16,8 +16,6 @@ DEVELOPER_CFLAGS += -Wstrict-prototypes\n DEVELOPER_CFLAGS += -Wunused\n DEVELOPER_CFLAGS += -Wvla\n \n-DEVELOPER_CFLAGS += -DENABLE_SHA256\n-\n ifndef COMPILER_FEATURES\n COMPILER_FEATURES := $(shell ./detect-compiler $(CC))\n endif\ndiff --git a/repository.c b/repository.c\nindex 6f7f6f002b..a4174ddb06 100644\n--- a/repository.c\n+++ b/repository.c\n@@ -89,10 +89,6 @@ void repo_set_gitdir(struct repository *repo,\n void repo_set_hash_algo(struct repository *repo, int hash_algo)\n {\n \trepo->hash_algo = &hash_algos[hash_algo];\n-#ifndef ENABLE_SHA256\n-\tif (hash_algo != GIT_HASH_SHA1)\n-\t\tdie(_(\"The hash algorithm %s is not supported in this build.\"), repo->hash_algo->name);\n-#endif\n }\n \n /*\ndiff --git a/t/t0001-init.sh b/t/t0001-init.sh\nindex 6d2467995e..10ed9d9235 100755\n--- a/t/t0001-init.sh\n+++ b/t/t0001-init.sh\n@@ -441,6 +441,35 @@ test_expect_success 're-init from a linked worktree' '\n \t)\n '\n \n+test_expect_success 'init honors GIT_DEFAULT_HASH' '\n+\tGIT_DEFAULT_HASH=sha1 git init sha1 &&\n+\tgit -C sha1 rev-parse --show-object-format >actual &&\n+\techo sha1 >expected &&\n+\ttest_cmp expected actual &&\n+\tGIT_DEFAULT_HASH=sha256 git init sha256 &&\n+\tgit -C sha256 rev-parse --show-object-format >actual &&\n+\techo sha256 >expected &&\n+\ttest_cmp expected actual\n+'\n+\n+test_expect_success 'init honors --object-format' '\n+\tgit init --object-format=sha256 explicit &&\n+\tgit -C explicit rev-parse --show-object-format >actual &&\n+\techo sha256 >expected &&\n+\ttest_cmp expected actual\n+'\n+\n+test_expect_success 'extensions.objectFormat is not allowed with repo version 0' '\n+\tgit init --object-format=sha256 explicit-v0 &&\n+\tgit -C explicit-v0 config core.repositoryformatversion 0 &&\n+\ttest_must_fail git -C explicit-v0 rev-parse --show-object-format\n+'\n+\n+test_expect_success 'init rejects attempts to initialize with different hash' '\n+\ttest_must_fail git -C sha1 init --object-format=sha256 &&\n+\ttest_must_fail git -C sha256 init --object-format=sha1\n+'\n+\n test_expect_success MINGW 'core.hidedotfiles = false' '\n \tgit config --global core.hidedotfiles false &&\n \trm -rf newdir &&\n"},{"id":"402081","messageId":"20200726195424.626969-33-sandals@crustytoothpaste.net","threadId":"53925","inReplyTo":"20200726195424.626969-1-sandals@crustytoothpaste.net","subject":"[PATCH v4 32/39] setup: add support for reading extensions.objectformat","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-26T19:54:17Z","receivedAt":"2020-07-26T19:55:05Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"The transition plan specifies extensions.objectFormat as the indication\nthat we're using a given hash in a certain repo.  Read this as one of\nthe extensions we support.  If the user has specified an invalid value,\nfail.\n\nEnsure that we reject the extension if the repository format version is\n0.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n setup.c | 16 +++++++++++++++-\n 1 file changed, 15 insertions(+), 1 deletion(-)\n\ndiff --git a/setup.c b/setup.c\nindex 3a81307602..94e68bb4f4 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -470,7 +470,16 @@ static int check_repo_format(const char *var, const char *value, void *vdata)\n \t\t\tdata->partial_clone = xstrdup(value);\n \t\t} else if (!strcmp(ext, \"worktreeconfig\"))\n \t\t\tdata->worktree_config = git_config_bool(var, value);\n-\t\telse\n+\t\telse if (!strcmp(ext, \"objectformat\")) {\n+\t\t\tint format;\n+\n+\t\t\tif (!value)\n+\t\t\t\treturn config_error_nonbool(var);\n+\t\t\tformat = hash_algo_by_name(value);\n+\t\t\tif (format == GIT_HASH_UNKNOWN)\n+\t\t\t\treturn error(\"invalid value for 'extensions.objectformat'\");\n+\t\t\tdata->hash_algo = format;\n+\t\t} else\n \t\t\tstring_list_append(&data->unknown_extensions, ext);\n \t}\n \n@@ -613,6 +622,11 @@ int verify_repository_format(const struct repository_format *format,\n \t\treturn -1;\n \t}\n \n+\tif (format->version <= 0 && format->hash_algo != GIT_HASH_SHA1) {\n+\t\tstrbuf_addstr(err, _(\"extensions.objectFormat is not valid in repo v0\"));\n+\t\treturn -1;\n+\t}\n+\n \treturn 0;\n }\n \n"},{"id":"402083","messageId":"20200726195424.626969-29-sandals@crustytoothpaste.net","threadId":"53925","inReplyTo":"20200726195424.626969-1-sandals@crustytoothpaste.net","subject":"[PATCH v4 28/39] t0410: mark test with SHA1 prerequisite","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-26T19:54:13Z","receivedAt":"2020-07-26T19:55:05Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"These tests try to check that we behave properly if we encounter a\nrepository with version 0 but an extension.  This is a laudable goal,\nbut the test cannot work with SHA-256, since SHA-256 repositories always\nhave an existing extension and are never version 0.\n\nAdd a SHA1 prerequisite to these tests.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n t/t0410-partial-clone.sh | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t0410-partial-clone.sh b/t/t0410-partial-clone.sh\nindex 6aa0f313bd..a5ebdf9ff3 100755\n--- a/t/t0410-partial-clone.sh\n+++ b/t/t0410-partial-clone.sh\n@@ -42,7 +42,7 @@ test_expect_success 'convert shallow clone to partial clone' '\n \ttest_cmp_config -C client 1 core.repositoryformatversion\n '\n \n-test_expect_success 'convert to partial clone with noop extension' '\n+test_expect_success SHA1 'convert to partial clone with noop extension' '\n \trm -fr server client &&\n \ttest_create_repo server &&\n \ttest_commit -C server my_commit 1 &&\n@@ -53,7 +53,7 @@ test_expect_success 'convert to partial clone with noop extension' '\n \tgit -C client fetch --unshallow --filter=\"blob:none\"\n '\n \n-test_expect_success 'converting to partial clone fails with unrecognized extension' '\n+test_expect_success SHA1 'converting to partial clone fails with unrecognized extension' '\n \trm -fr server client &&\n \ttest_create_repo server &&\n \ttest_commit -C server my_commit 1 &&\n"},{"id":"402084","messageId":"20200726195424.626969-35-sandals@crustytoothpaste.net","threadId":"53925","inReplyTo":"20200726195424.626969-1-sandals@crustytoothpaste.net","subject":"[PATCH v4 34/39] t: add test_oid option to select hash algorithm","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-26T19:54:19Z","receivedAt":"2020-07-26T19:55:07Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"In some tests, we have data files which are written with a particular\nhash algorithm. Instead of keeping two copies of the test files, we can\nkeep one, and translate the value on the fly.\n\nIn order to do so, we'll need to read both the source algorithm and the\ncurrent algorithm, so add an optional flag to the test_oid helper that\nlets us look up a value for a specified hash algorithm. This should\nnot cause any conflicts with existing tests, since key arguments to\ntest_oid are allowed to contains only shell identifier characters.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n t/t0000-basic.sh        | 11 +++++++++++\n t/test-lib-functions.sh | 12 +++++++++++-\n 2 files changed, 22 insertions(+), 1 deletion(-)\n\ndiff --git a/t/t0000-basic.sh b/t/t0000-basic.sh\nindex 2ff176cd5d..2599d026a2 100755\n--- a/t/t0000-basic.sh\n+++ b/t/t0000-basic.sh\n@@ -928,6 +928,17 @@ test_expect_success 'test_oid can look up data for SHA-256' '\n \ttest \"$hexsz\" -eq 64\n '\n \n+test_expect_success 'test_oid can look up data for a specified algorithm' '\n+\trawsz=\"$(test_oid --hash=sha1 rawsz)\" &&\n+\thexsz=\"$(test_oid --hash=sha1 hexsz)\" &&\n+\ttest \"$rawsz\" -eq 20 &&\n+\ttest \"$hexsz\" -eq 40 &&\n+\trawsz=\"$(test_oid --hash=sha256 rawsz)\" &&\n+\thexsz=\"$(test_oid --hash=sha256 hexsz)\" &&\n+\ttest \"$rawsz\" -eq 32 &&\n+\ttest \"$hexsz\" -eq 64\n+'\n+\n test_expect_success 'test_bool_env' '\n \t(\n \t\tsane_unset envvar &&\ndiff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh\nindex 3103be8a32..2608e80f11 100644\n--- a/t/test-lib-functions.sh\n+++ b/t/test-lib-functions.sh\n@@ -1468,7 +1468,17 @@ test_oid_cache () {\n # Look up a per-hash value based on a key ($1).  The value must have been loaded\n # by test_oid_init or test_oid_cache.\n test_oid () {\n-\tlocal var=\"test_oid_${test_hash_algo}_$1\" &&\n+\tlocal algo=\"${test_hash_algo}\" &&\n+\n+\tcase \"$1\" in\n+\t--hash=*)\n+\t\talgo=\"${1#--hash=}\" &&\n+\t\tshift;;\n+\t*)\n+\t\t;;\n+\tesac &&\n+\n+\tlocal var=\"test_oid_${algo}_$1\" &&\n \n \t# If the variable is unset, we must be missing an entry for this\n \t# key-hash pair, so exit with an error.\n"},{"id":"402086","messageId":"20200726195424.626969-37-sandals@crustytoothpaste.net","threadId":"53925","inReplyTo":"20200726195424.626969-1-sandals@crustytoothpaste.net","subject":"[PATCH v4 36/39] t: make SHA1 prerequisite depend on default hash","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-26T19:54:21Z","receivedAt":"2020-07-26T19:55:07Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Currently, the SHA1 prerequisite depends on the output of git\nhash-object.  However, in order for that to produce sane behavior, we\nmust be in a repository.  If we are not, the default will remain SHA-1,\nand we'll produce wrong results if we're using SHA-256 for the testsuite\nbut the test assertion starts when we're not in a repository.\n\nCheck the environment variable we use for this purpose, leaving it to\ndefault to SHA-1 if none is specified.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n t/test-lib.sh | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex 307bb2207e..ea2d308f62 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -1689,7 +1689,8 @@ test_lazy_prereq CURL '\n # which will not work with other hash algorithms and tests that work but don't\n # test anything meaningful (e.g. special values which cause short collisions).\n test_lazy_prereq SHA1 '\n-\ttest $(git hash-object /dev/null) = e69de29bb2d1d6434b8b29ae775ad8c2e48c5391\n+\ttest $(git hash-object /dev/null) = e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 &&\n+\t{ test -z \"$GIT_DEFAULT_HASH\" || test \"$GIT_DEFAULT_HASH\" = \"sha1\"; }\n '\n \n test_lazy_prereq REBASE_P '\n"},{"id":"402085","messageId":"20200726195424.626969-27-sandals@crustytoothpaste.net","threadId":"53925","inReplyTo":"20200726195424.626969-1-sandals@crustytoothpaste.net","subject":"[PATCH v4 26/39] t9700: make hash size independent","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-26T19:54:11Z","receivedAt":"2020-07-26T19:55:09Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"The Perl test script for t9700 was matching on exactly 40 hex\ncharacters.  With SHA-256, we'll have 64 hex-character object IDs.\nCreate a variable with a regex which matches exactly 40 or 64 hex\ncharacters and use that to match the output.  Note that both of the uses\nof this can be anchored, which makes the code simpler, so do that as\nwell.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n t/t9700/test.pl | 6 ++++--\n 1 file changed, 4 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t9700/test.pl b/t/t9700/test.pl\nindex 34cd01366f..071ff6d82a 100755\n--- a/t/t9700/test.pl\n+++ b/t/t9700/test.pl\n@@ -23,6 +23,8 @@ sub adjust_dirsep {\n \treturn $path;\n }\n \n+my $oid_re = qr/^[0-9a-fA-F]{40}(?:[0-9a-fA-F]{24})?$/;\n+\n BEGIN { use_ok('Git') }\n \n # set up\n@@ -93,7 +95,7 @@ sub adjust_dirsep {\n open TEMPFILE, \">$tmpfile\" or die \"Can't open $tmpfile: $!\";\n print TEMPFILE my $test_text = \"test blob, to be inserted\\n\";\n close TEMPFILE or die \"Failed writing to $tmpfile: $!\";\n-like(our $newhash = $r->hash_and_insert_object($tmpfile), qr/[0-9a-fA-F]{40}/,\n+like(our $newhash = $r->hash_and_insert_object($tmpfile), $oid_re,\n      \"hash_and_insert_object: returns hash\");\n open TEMPFILE, \"+>$tmpfile\" or die \"Can't open $tmpfile: $!\";\n is($r->cat_blob($newhash, \\*TEMPFILE), length $test_text, \"cat_blob: roundtrip size\");\n@@ -119,7 +121,7 @@ sub adjust_dirsep {\n \n # commands in sub directory\n my $last_commit = $r2->command_oneline(qw(rev-parse --verify HEAD));\n-like($last_commit, qr/^[0-9a-fA-F]{40}$/, 'rev-parse returned hash');\n+like($last_commit, $oid_re, 'rev-parse returned hash');\n my $dir_commit = $r2->command_oneline('log', '-n1', '--pretty=format:%H', '.');\n isnt($last_commit, $dir_commit, 'log . does not show last commit');\n \n"},{"id":"402087","messageId":"20200726195424.626969-25-sandals@crustytoothpaste.net","threadId":"53925","inReplyTo":"20200726195424.626969-1-sandals@crustytoothpaste.net","subject":"[PATCH v4 24/39] t9350: make hash size independent","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-26T19:54:09Z","receivedAt":"2020-07-26T19:55:10Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"This test checks for several commit object sizes to verify that objects\nare encoded as expected. However, the size of a commit object differs\nbetween SHA-1 and SHA-256, since each contains a hex representation of\nthe tree's object ID. Since these are root commits, compute the size of\neach commit by using a constant plus the size of a single hex object ID.\n\nIn addition, use $ZERO_OID instead of a hard-coded object ID.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n t/t9350-fast-export.sh | 15 ++++++++-------\n 1 file changed, 8 insertions(+), 7 deletions(-)\n\ndiff --git a/t/t9350-fast-export.sh b/t/t9350-fast-export.sh\nindex 690c90fb82..ba79db6a17 100755\n--- a/t/t9350-fast-export.sh\n+++ b/t/t9350-fast-export.sh\n@@ -7,6 +7,7 @@ test_description='git fast-export'\n . ./test-lib.sh\n \n test_expect_success 'setup' '\n+\ttest_oid_init &&\n \n \techo break it > file0 &&\n \tgit add file0 &&\n@@ -132,12 +133,12 @@ test_expect_success 'reencoding iso-8859-7' '\n \tsed \"s/wer/i18n/\" iso-8859-7.fi |\n \t\t(cd new &&\n \t\t git fast-import &&\n-\t\t # The commit object, if not re-encoded, would be 240 bytes.\n+\t\t # The commit object, if not re-encoded, would be 200 bytes plus hash.\n \t\t # Removing the \"encoding iso-8859-7\\n\" header drops 20 bytes.\n \t\t # Re-encoding the Pi character from \\xF0 (\\360) in iso-8859-7\n \t\t # to \\xCF\\x80 (\\317\\200) in UTF-8 adds a byte.  Check for\n \t\t # the expected size.\n-\t\t test 221 -eq \"$(git cat-file -s i18n)\" &&\n+\t\t test $(($(test_oid hexsz) + 181)) -eq \"$(git cat-file -s i18n)\" &&\n \t\t # ...and for the expected translation of bytes.\n \t\t git cat-file commit i18n >actual &&\n \t\t grep $(printf \"\\317\\200\") actual &&\n@@ -164,12 +165,12 @@ test_expect_success 'preserving iso-8859-7' '\n \tsed \"s/wer/i18n-no-recoding/\" iso-8859-7.fi |\n \t\t(cd new &&\n \t\t git fast-import &&\n-\t\t # The commit object, if not re-encoded, is 240 bytes.\n+\t\t # The commit object, if not re-encoded, is 200 bytes plus hash.\n \t\t # Removing the \"encoding iso-8859-7\\n\" header would drops 20\n \t\t # bytes.  Re-encoding the Pi character from \\xF0 (\\360) in\n \t\t # iso-8859-7 to \\xCF\\x80 (\\317\\200) in UTF-8 adds a byte.\n \t\t # Check for the expected size...\n-\t\t test 240 -eq \"$(git cat-file -s i18n-no-recoding)\" &&\n+\t\t test $(($(test_oid hexsz) + 200)) -eq \"$(git cat-file -s i18n-no-recoding)\" &&\n \t\t # ...as well as the expected byte.\n \t\t git cat-file commit i18n-no-recoding >actual &&\n \t\t grep $(printf \"\\360\") actual &&\n@@ -192,7 +193,7 @@ test_expect_success 'encoding preserved if reencoding fails' '\n \t\t grep ^encoding actual &&\n \t\t # Verify that the commit has the expected size; i.e.\n \t\t # that no bytes were re-encoded to a different encoding.\n-\t\t test 252 -eq \"$(git cat-file -s i18n-invalid)\" &&\n+\t\t test $(($(test_oid hexsz) + 212)) -eq \"$(git cat-file -s i18n-invalid)\" &&\n \t\t # ...and check for the original special bytes\n \t\t grep $(printf \"\\360\") actual &&\n \t\t grep $(printf \"\\377\") actual)\n@@ -694,7 +695,7 @@ test_expect_success 'delete ref because entire history excluded' '\n \tgit fast-export to-delete ^to-delete >actual &&\n \tcat >expected <<-EOF &&\n \treset refs/heads/to-delete\n-\tfrom 0000000000000000000000000000000000000000\n+\tfrom $ZERO_OID\n \n \tEOF\n \ttest_cmp expected actual\n@@ -704,7 +705,7 @@ test_expect_success 'delete refspec' '\n \tgit fast-export --refspec :refs/heads/to-delete >actual &&\n \tcat >expected <<-EOF &&\n \treset refs/heads/to-delete\n-\tfrom 0000000000000000000000000000000000000000\n+\tfrom $ZERO_OID\n \n \tEOF\n \ttest_cmp expected actual\n"},{"id":"402088","messageId":"20200726195424.626969-26-sandals@crustytoothpaste.net","threadId":"53925","inReplyTo":"20200726195424.626969-1-sandals@crustytoothpaste.net","subject":"[PATCH v4 25/39] t9500: ensure that algorithm info is preserved in config","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-26T19:54:10Z","receivedAt":"2020-07-26T19:55:11Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"When we use a hash algorithm other than SHA-1, it's important to\npreserve the hash-related values in the config file, but this test\noverwrites the config file with a new one. Ensure we copy these values\nproperly from the old config to the new one so that the repository can\nbe read if it's using SHA-256.\n\nNote that if there is no extensions.objectFormat value set, git config\nwill return unsuccessfully if we try to read it; since this is not an\nerror for us, use test_might_fail.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n t/t9500-gitweb-standalone-no-errors.sh | 22 ++++++++++++++++------\n 1 file changed, 16 insertions(+), 6 deletions(-)\n\ndiff --git a/t/t9500-gitweb-standalone-no-errors.sh b/t/t9500-gitweb-standalone-no-errors.sh\nindex 267ddc997d..b484e3e250 100755\n--- a/t/t9500-gitweb-standalone-no-errors.sh\n+++ b/t/t9500-gitweb-standalone-no-errors.sh\n@@ -621,12 +621,22 @@ test_expect_success \\\n \t git config gitweb.snapshot \"zip,tgz, tbz2\" &&\n \t gitweb_run \"p=.git;a=tree\"'\n \n-cat >.git/config <<\\EOF\n-# testing noval and alternate separator\n-[gitweb]\n-\tblame\n-\tsnapshot = zip tgz\n-EOF\n+test_expect_success 'setup' '\n+\tversion=$(git config core.repositoryformatversion) &&\n+\talgo=$(test_might_fail git config extensions.objectformat) &&\n+\tcat >.git/config <<-\\EOF &&\n+\t# testing noval and alternate separator\n+\t[gitweb]\n+\t\tblame\n+\t\tsnapshot = zip tgz\n+\tEOF\n+\tgit config core.repositoryformatversion \"$version\" &&\n+\tif test -n \"$algo\"\n+\tthen\n+\t\tgit config extensions.objectformat \"$algo\"\n+\tfi\n+'\n+\n test_expect_success \\\n \t'config override: tree view, features enabled in repo config (2)' \\\n \t'gitweb_run \"p=.git;a=tree\"'\n"},{"id":"402090","messageId":"20200726195424.626969-18-sandals@crustytoothpaste.net","threadId":"53925","inReplyTo":"20200726195424.626969-1-sandals@crustytoothpaste.net","subject":"[PATCH v4 17/39] t7508: use $ZERO_OID instead of hard-coded constant","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-26T19:54:02Z","receivedAt":"2020-07-26T19:55:14Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Use the ZERO_OID variable to abbreviate the all-zeros object ID for\nmaintainability and to avoid depending on a specific size for the hash.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n t/t7508-status.sh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/t/t7508-status.sh b/t/t7508-status.sh\nindex 8e969f3e36..e81759319f 100755\n--- a/t/t7508-status.sh\n+++ b/t/t7508-status.sh\n@@ -837,7 +837,7 @@ EOF\n '\n \n cat >expect <<EOF\n-:100644 100644 $EMPTY_BLOB 0000000000000000000000000000000000000000 M\tdir1/modified\n+:100644 100644 $EMPTY_BLOB $ZERO_OID M\tdir1/modified\n EOF\n test_expect_success 'status refreshes the index' '\n \ttouch dir2/added &&\n"},{"id":"402089","messageId":"20200726195424.626969-7-sandals@crustytoothpaste.net","threadId":"53925","inReplyTo":"20200726195424.626969-1-sandals@crustytoothpaste.net","subject":"[PATCH v4 06/39] t6101: make hash size independent","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-26T19:53:51Z","receivedAt":"2020-07-26T19:55:16Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Use $OID_REGEX instead of a hard-coded regular expression.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n t/t6101-rev-parse-parents.sh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/t/t6101-rev-parse-parents.sh b/t/t6101-rev-parse-parents.sh\nindex 7683e4a114..7531262a5e 100755\n--- a/t/t6101-rev-parse-parents.sh\n+++ b/t/t6101-rev-parse-parents.sh\n@@ -34,7 +34,7 @@ test_expect_success 'setup' '\n '\n \n test_expect_success 'start is valid' '\n-\tgit rev-parse start | grep \"^[0-9a-f]\\{40\\}$\"\n+\tgit rev-parse start | grep \"^$OID_REGEX$\"\n '\n \n test_expect_success 'start^0' '\n"},{"id":"402091","messageId":"20200726195424.626969-9-sandals@crustytoothpaste.net","threadId":"53925","inReplyTo":"20200726195424.626969-1-sandals@crustytoothpaste.net","subject":"[PATCH v4 08/39] t6500: specify test values for SHA-256","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-26T19:53:53Z","receivedAt":"2020-07-26T19:55:18Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"In this test, we want to produce several blobs whose first two hex\ncharacters are \"17\", since we look at this object directory as a proxy\nfor how many loose objects there are before we need to GC.  Use\ntest_oid_cache to specify strings that will hash to the right values\nwhen turned into blobs.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n t/t6500-gc.sh | 27 ++++++++++++++++++++++-----\n 1 file changed, 22 insertions(+), 5 deletions(-)\n\ndiff --git a/t/t6500-gc.sh b/t/t6500-gc.sh\nindex 0a69a67117..4a3b8f48ac 100755\n--- a/t/t6500-gc.sh\n+++ b/t/t6500-gc.sh\n@@ -10,7 +10,24 @@ test_expect_success 'setup' '\n \t# do not let the amount of physical memory affects gc\n \t# behavior, make sure we always pack everything to one pack by\n \t# default\n-\tgit config gc.bigPackThreshold 2g\n+\tgit config gc.bigPackThreshold 2g &&\n+\n+\t# These are simply values which, when hashed as a blob with a newline,\n+\t# produce a hash where the first byte is 0x17 in their respective\n+\t# algorithms.\n+\ttest_oid_cache <<-EOF\n+\tobj1 sha1:263\n+\tobj1 sha256:34\n+\n+\tobj2 sha1:410\n+\tobj2 sha256:174\n+\n+\tobj3 sha1:523\n+\tobj3 sha256:313\n+\n+\tobj4 sha1:790\n+\tobj4 sha256:481\n+\tEOF\n '\n \n test_expect_success 'gc empty repository' '\n@@ -85,13 +102,13 @@ test_expect_success 'auto gc with too many loose objects does not attempt to cre\n \t# We need to create two object whose sha1s start with 17\n \t# since this is what git gc counts.  As it happens, these\n \t# two blobs will do so.\n-\ttest_commit 263 &&\n-\ttest_commit 410 &&\n+\ttest_commit \"$(test_oid obj1)\" &&\n+\ttest_commit \"$(test_oid obj2)\" &&\n \t# Our first gc will create a pack; our second will create a second pack\n \tgit gc --auto &&\n \tls .git/objects/pack | sort >existing_packs &&\n-\ttest_commit 523 &&\n-\ttest_commit 790 &&\n+\ttest_commit \"$(test_oid obj3)\" &&\n+\ttest_commit \"$(test_oid obj4)\" &&\n \n \tgit gc --auto 2>err &&\n \ttest_i18ngrep ! \"^warning:\" err &&\n"},{"id":"402092","messageId":"20200726195424.626969-4-sandals@crustytoothpaste.net","threadId":"53925","inReplyTo":"20200726195424.626969-1-sandals@crustytoothpaste.net","subject":"[PATCH v4 03/39] t3305: make hash agnostic","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-26T19:53:48Z","receivedAt":"2020-07-26T19:55:19Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"When computing the fanout length, let's use test_oid to look up the\nhexadecimal size of the hash in question instead of hard-coding a value.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n t/t3305-notes-fanout.sh | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git a/t/t3305-notes-fanout.sh b/t/t3305-notes-fanout.sh\nindex 3b4753e1b4..d5a94b7174 100755\n--- a/t/t3305-notes-fanout.sh\n+++ b/t/t3305-notes-fanout.sh\n@@ -7,7 +7,7 @@ test_description='Test that adding/removing many notes triggers automatic fanout\n path_has_fanout() {\n \tpath=$1 &&\n \tfanout=$2 &&\n-\tafter_last_slash=$((40 - $fanout * 2)) &&\n+\tafter_last_slash=$(($(test_oid hexsz) - $fanout * 2)) &&\n \techo $path | grep -q \"^\\([0-9a-f]\\{2\\}/\\)\\{$fanout\\}[0-9a-f]\\{$after_last_slash\\}$\"\n }\n \n@@ -31,6 +31,7 @@ all_notes_have_fanout() {\n }\n \n test_expect_success 'tweak test environment' '\n+\ttest_oid_init &&\n \tgit checkout -b nondeterminism &&\n \ttest_commit A &&\n \tgit checkout --orphan with_notes;\n"},{"id":"402093","messageId":"20200726195424.626969-17-sandals@crustytoothpaste.net","threadId":"53925","inReplyTo":"20200726195424.626969-1-sandals@crustytoothpaste.net","subject":"[PATCH v4 16/39] t7506: avoid checking for SHA-1-specific constants","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-26T19:54:01Z","receivedAt":"2020-07-26T19:55:22Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Adjust the test to sanitize the diffs and strip out object IDs from\nthem, as it does for other object IDs, since we are not interested in\nthe particular values used.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n t/t7506-status-submodule.sh | 12 ++++++++----\n 1 file changed, 8 insertions(+), 4 deletions(-)\n\ndiff --git a/t/t7506-status-submodule.sh b/t/t7506-status-submodule.sh\nindex 08629a6e70..3fcb44767f 100755\n--- a/t/t7506-status-submodule.sh\n+++ b/t/t7506-status-submodule.sh\n@@ -22,6 +22,10 @@ sanitize_output () {\n \tmv output2 output\n }\n \n+sanitize_diff () {\n+\tsed -e \"/^index [0-9a-f,]*\\.\\.[0-9a-f]*/d\" \"$1\"\n+}\n+\n \n test_expect_success 'setup' '\n \ttest_create_repo_with_commit sub &&\n@@ -269,7 +273,6 @@ short_sha1_merge_sub1=$(cd sub1 && git rev-parse --short HEAD)\n short_sha1_merge_sub2=$(cd sub2 && git rev-parse --short HEAD)\n cat >diff_expect <<\\EOF\n diff --cc .gitmodules\n-index badaa4c,44f999a..0000000\n --- a/.gitmodules\n +++ b/.gitmodules\n @@@ -1,3 -1,3 +1,9 @@@\n@@ -286,7 +289,6 @@ EOF\n \n cat >diff_submodule_expect <<\\EOF\n diff --cc .gitmodules\n-index badaa4c,44f999a..0000000\n --- a/.gitmodules\n +++ b/.gitmodules\n @@@ -1,3 -1,3 +1,9 @@@\n@@ -306,7 +308,8 @@ test_expect_success 'diff with merge conflict in .gitmodules' '\n \t\tcd super &&\n \t\tgit diff >../diff_actual 2>&1\n \t) &&\n-\ttest_cmp diff_expect diff_actual\n+\tsanitize_diff diff_actual >diff_sanitized &&\n+\ttest_cmp diff_expect diff_sanitized\n '\n \n test_expect_success 'diff --submodule with merge conflict in .gitmodules' '\n@@ -314,7 +317,8 @@ test_expect_success 'diff --submodule with merge conflict in .gitmodules' '\n \t\tcd super &&\n \t\tgit diff --submodule >../diff_submodule_actual 2>&1\n \t) &&\n-\ttest_cmp diff_submodule_expect diff_submodule_actual\n+\tsanitize_diff diff_submodule_actual >diff_sanitized &&\n+\ttest_cmp diff_submodule_expect diff_sanitized\n '\n \n # We'll setup different cases for further testing:\n"},{"id":"402094","messageId":"20200726195424.626969-10-sandals@crustytoothpaste.net","threadId":"53925","inReplyTo":"20200726195424.626969-1-sandals@crustytoothpaste.net","subject":"[PATCH v4 09/39] t6501: avoid hard-coded objects","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-26T19:53:54Z","receivedAt":"2020-07-26T19:55:23Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"This test contains hard-coded invalid object IDs.  Make it hash size\nindependent by generating invalid object IDs using the translation\ntables.  Add a setup target to ensure the output of test_oid_init is\nchecked properly.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n t/t6501-freshen-objects.sh | 18 +++++++++++-------\n 1 file changed, 11 insertions(+), 7 deletions(-)\n\ndiff --git a/t/t6501-freshen-objects.sh b/t/t6501-freshen-objects.sh\nindex f30b4849b6..7416ed5ffe 100755\n--- a/t/t6501-freshen-objects.sh\n+++ b/t/t6501-freshen-objects.sh\n@@ -45,6 +45,10 @@ maybe_repack () {\n \tfi\n }\n \n+test_expect_success 'setup' '\n+\ttest_oid_init\n+'\n+\n for repack in '' true; do\n \ttitle=${repack:+repack}\n \ttitle=${title:-loose}\n@@ -128,9 +132,9 @@ for repack in '' true; do\n done\n \n test_expect_success 'do not complain about existing broken links (commit)' '\n-\tcat >broken-commit <<-\\EOF &&\n-\ttree 0000000000000000000000000000000000000001\n-\tparent 0000000000000000000000000000000000000002\n+\tcat >broken-commit <<-EOF &&\n+\ttree $(test_oid 001)\n+\tparent $(test_oid 002)\n \tauthor whatever <whatever@example.com> 1234 -0000\n \tcommitter whatever <whatever@example.com> 1234 -0000\n \n@@ -143,8 +147,8 @@ test_expect_success 'do not complain about existing broken links (commit)' '\n '\n \n test_expect_success 'do not complain about existing broken links (tree)' '\n-\tcat >broken-tree <<-\\EOF &&\n-\t100644 blob 0000000000000000000000000000000000000003\tfoo\n+\tcat >broken-tree <<-EOF &&\n+\t100644 blob $(test_oid 003)\tfoo\n \tEOF\n \ttree=$(git mktree --missing <broken-tree) &&\n \tgit gc -q 2>stderr &&\n@@ -153,8 +157,8 @@ test_expect_success 'do not complain about existing broken links (tree)' '\n '\n \n test_expect_success 'do not complain about existing broken links (tag)' '\n-\tcat >broken-tag <<-\\EOF &&\n-\tobject 0000000000000000000000000000000000000004\n+\tcat >broken-tag <<-EOF &&\n+\tobject $(test_oid 004)\n \ttype commit\n \ttag broken\n \ttagger whatever <whatever@example.com> 1234 -0000\n"},{"id":"402096","messageId":"20200726195424.626969-12-sandals@crustytoothpaste.net","threadId":"53925","inReplyTo":"20200726195424.626969-1-sandals@crustytoothpaste.net","subject":"[PATCH v4 11/39] t7063: make hash size independent","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-26T19:53:56Z","receivedAt":"2020-07-26T19:55:23Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Use test_oid instead of hard-coding a fixed size all-zeros object ID.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n t/t7063-status-untracked-cache.sh | 151 ++++++++++++++++--------------\n 1 file changed, 81 insertions(+), 70 deletions(-)\n\ndiff --git a/t/t7063-status-untracked-cache.sh b/t/t7063-status-untracked-cache.sh\nindex 428cff9cf3..c713c0dc3f 100755\n--- a/t/t7063-status-untracked-cache.sh\n+++ b/t/t7063-status-untracked-cache.sh\n@@ -75,14 +75,24 @@ test_expect_success 'setup' '\n \ttouch one two three done/one dtwo/two dthree/three &&\n \tgit add one two done/one &&\n \t: >.git/info/exclude &&\n-\tgit update-index --untracked-cache\n+\tgit update-index --untracked-cache &&\n+\ttest_oid_cache <<-EOF\n+\troot sha1:e6fcc8f2ee31bae321d66afd183fcb7237afae6e\n+\troot sha256:b90c672088c015b9c83876e919da311bad4cd39639fb139f988af6a11493b974\n+\n+\texclude sha1:13263c0978fb9fad16b2d580fb800b6d811c3ff0\n+\texclude sha256:fe4aaa1bbbbce4cb8f73426748a14c5ad6026b26f90505a0bf2494b165a5b76c\n+\n+\tdone sha1:1946f0437f90c5005533cbe1736a6451ca301714\n+\tdone sha256:7f079501d79f665b3acc50f5e0e9e94509084d5032ac20113a37dd5029b757cc\n+\tEOF\n '\n \n test_expect_success 'untracked cache is empty' '\n \ttest-tool dump-untracked-cache >../actual &&\n \tcat >../expect-empty <<EOF &&\n-info/exclude 0000000000000000000000000000000000000000\n-core.excludesfile 0000000000000000000000000000000000000000\n+info/exclude $ZERO_OID\n+core.excludesfile $ZERO_OID\n exclude_per_dir .gitignore\n flags 00000006\n EOF\n@@ -100,17 +110,17 @@ EOF\n \n cat >../dump.expect <<EOF &&\n info/exclude $EMPTY_BLOB\n-core.excludesfile 0000000000000000000000000000000000000000\n+core.excludesfile $ZERO_OID\n exclude_per_dir .gitignore\n flags 00000006\n-/ 0000000000000000000000000000000000000000 recurse valid\n+/ $ZERO_OID recurse valid\n dthree/\n dtwo/\n three\n-/done/ 0000000000000000000000000000000000000000 recurse valid\n-/dthree/ 0000000000000000000000000000000000000000 recurse check_only valid\n+/done/ $ZERO_OID recurse valid\n+/dthree/ $ZERO_OID recurse check_only valid\n three\n-/dtwo/ 0000000000000000000000000000000000000000 recurse check_only valid\n+/dtwo/ $ZERO_OID recurse check_only valid\n two\n EOF\n \n@@ -190,18 +200,18 @@ test_expect_success 'verify untracked cache dump' '\n \ttest-tool dump-untracked-cache >../actual &&\n \tcat >../expect <<EOF &&\n info/exclude $EMPTY_BLOB\n-core.excludesfile 0000000000000000000000000000000000000000\n+core.excludesfile $ZERO_OID\n exclude_per_dir .gitignore\n flags 00000006\n-/ 0000000000000000000000000000000000000000 recurse valid\n+/ $ZERO_OID recurse valid\n dthree/\n dtwo/\n four\n three\n-/done/ 0000000000000000000000000000000000000000 recurse valid\n-/dthree/ 0000000000000000000000000000000000000000 recurse check_only valid\n+/done/ $ZERO_OID recurse valid\n+/dthree/ $ZERO_OID recurse check_only valid\n three\n-/dtwo/ 0000000000000000000000000000000000000000 recurse check_only valid\n+/dtwo/ $ZERO_OID recurse check_only valid\n two\n EOF\n \ttest_cmp ../expect ../actual\n@@ -239,18 +249,18 @@ test_expect_success 'verify untracked cache dump' '\n \ttest-tool dump-untracked-cache >../actual &&\n \tcat >../expect <<EOF &&\n info/exclude $EMPTY_BLOB\n-core.excludesfile 0000000000000000000000000000000000000000\n+core.excludesfile $ZERO_OID\n exclude_per_dir .gitignore\n flags 00000006\n-/ e6fcc8f2ee31bae321d66afd183fcb7237afae6e recurse valid\n+/ $(test_oid root) recurse valid\n .gitignore\n dthree/\n dtwo/\n three\n-/done/ 0000000000000000000000000000000000000000 recurse valid\n-/dthree/ 0000000000000000000000000000000000000000 recurse check_only valid\n+/done/ $ZERO_OID recurse valid\n+/dthree/ $ZERO_OID recurse check_only valid\n three\n-/dtwo/ 0000000000000000000000000000000000000000 recurse check_only valid\n+/dtwo/ $ZERO_OID recurse check_only valid\n two\n EOF\n \ttest_cmp ../expect ../actual\n@@ -284,16 +294,16 @@ EOF\n test_expect_success 'verify untracked cache dump' '\n \ttest-tool dump-untracked-cache >../actual &&\n \tcat >../expect <<EOF &&\n-info/exclude 13263c0978fb9fad16b2d580fb800b6d811c3ff0\n-core.excludesfile 0000000000000000000000000000000000000000\n+info/exclude $(test_oid exclude)\n+core.excludesfile $ZERO_OID\n exclude_per_dir .gitignore\n flags 00000006\n-/ e6fcc8f2ee31bae321d66afd183fcb7237afae6e recurse valid\n+/ $(test_oid root) recurse valid\n .gitignore\n dtwo/\n-/done/ 0000000000000000000000000000000000000000 recurse valid\n-/dthree/ 0000000000000000000000000000000000000000 recurse check_only valid\n-/dtwo/ 0000000000000000000000000000000000000000 recurse check_only valid\n+/done/ $ZERO_OID recurse valid\n+/dthree/ $ZERO_OID recurse check_only valid\n+/dtwo/ $ZERO_OID recurse check_only valid\n two\n EOF\n \ttest_cmp ../expect ../actual\n@@ -303,14 +313,14 @@ test_expect_success 'move two from tracked to untracked' '\n \tgit rm --cached two &&\n \ttest-tool dump-untracked-cache >../actual &&\n \tcat >../expect <<EOF &&\n-info/exclude 13263c0978fb9fad16b2d580fb800b6d811c3ff0\n-core.excludesfile 0000000000000000000000000000000000000000\n+info/exclude $(test_oid exclude)\n+core.excludesfile $ZERO_OID\n exclude_per_dir .gitignore\n flags 00000006\n-/ e6fcc8f2ee31bae321d66afd183fcb7237afae6e recurse\n-/done/ 0000000000000000000000000000000000000000 recurse valid\n-/dthree/ 0000000000000000000000000000000000000000 recurse check_only valid\n-/dtwo/ 0000000000000000000000000000000000000000 recurse check_only valid\n+/ $(test_oid root) recurse\n+/done/ $ZERO_OID recurse valid\n+/dthree/ $ZERO_OID recurse check_only valid\n+/dtwo/ $ZERO_OID recurse check_only valid\n two\n EOF\n \ttest_cmp ../expect ../actual\n@@ -342,17 +352,17 @@ EOF\n test_expect_success 'verify untracked cache dump' '\n \ttest-tool dump-untracked-cache >../actual &&\n \tcat >../expect <<EOF &&\n-info/exclude 13263c0978fb9fad16b2d580fb800b6d811c3ff0\n-core.excludesfile 0000000000000000000000000000000000000000\n+info/exclude $(test_oid exclude)\n+core.excludesfile $ZERO_OID\n exclude_per_dir .gitignore\n flags 00000006\n-/ e6fcc8f2ee31bae321d66afd183fcb7237afae6e recurse valid\n+/ $(test_oid root) recurse valid\n .gitignore\n dtwo/\n two\n-/done/ 0000000000000000000000000000000000000000 recurse valid\n-/dthree/ 0000000000000000000000000000000000000000 recurse check_only valid\n-/dtwo/ 0000000000000000000000000000000000000000 recurse check_only valid\n+/done/ $ZERO_OID recurse valid\n+/dthree/ $ZERO_OID recurse check_only valid\n+/dtwo/ $ZERO_OID recurse check_only valid\n two\n EOF\n \ttest_cmp ../expect ../actual\n@@ -362,14 +372,14 @@ test_expect_success 'move two from untracked to tracked' '\n \tgit add two &&\n \ttest-tool dump-untracked-cache >../actual &&\n \tcat >../expect <<EOF &&\n-info/exclude 13263c0978fb9fad16b2d580fb800b6d811c3ff0\n-core.excludesfile 0000000000000000000000000000000000000000\n+info/exclude $(test_oid exclude)\n+core.excludesfile $ZERO_OID\n exclude_per_dir .gitignore\n flags 00000006\n-/ e6fcc8f2ee31bae321d66afd183fcb7237afae6e recurse\n-/done/ 0000000000000000000000000000000000000000 recurse valid\n-/dthree/ 0000000000000000000000000000000000000000 recurse check_only valid\n-/dtwo/ 0000000000000000000000000000000000000000 recurse check_only valid\n+/ $(test_oid root) recurse\n+/done/ $ZERO_OID recurse valid\n+/dthree/ $ZERO_OID recurse check_only valid\n+/dtwo/ $ZERO_OID recurse check_only valid\n two\n EOF\n \ttest_cmp ../expect ../actual\n@@ -401,16 +411,16 @@ EOF\n test_expect_success 'verify untracked cache dump' '\n \ttest-tool dump-untracked-cache >../actual &&\n \tcat >../expect <<EOF &&\n-info/exclude 13263c0978fb9fad16b2d580fb800b6d811c3ff0\n-core.excludesfile 0000000000000000000000000000000000000000\n+info/exclude $(test_oid exclude)\n+core.excludesfile $ZERO_OID\n exclude_per_dir .gitignore\n flags 00000006\n-/ e6fcc8f2ee31bae321d66afd183fcb7237afae6e recurse valid\n+/ $(test_oid root) recurse valid\n .gitignore\n dtwo/\n-/done/ 0000000000000000000000000000000000000000 recurse valid\n-/dthree/ 0000000000000000000000000000000000000000 recurse check_only valid\n-/dtwo/ 0000000000000000000000000000000000000000 recurse check_only valid\n+/done/ $ZERO_OID recurse valid\n+/dthree/ $ZERO_OID recurse check_only valid\n+/dtwo/ $ZERO_OID recurse check_only valid\n two\n EOF\n \ttest_cmp ../expect ../actual\n@@ -447,16 +457,16 @@ EOF\n test_expect_success 'untracked cache correct after commit' '\n \ttest-tool dump-untracked-cache >../actual &&\n \tcat >../expect <<EOF &&\n-info/exclude 13263c0978fb9fad16b2d580fb800b6d811c3ff0\n-core.excludesfile 0000000000000000000000000000000000000000\n+info/exclude $(test_oid exclude)\n+core.excludesfile $ZERO_OID\n exclude_per_dir .gitignore\n flags 00000006\n-/ e6fcc8f2ee31bae321d66afd183fcb7237afae6e recurse valid\n+/ $(test_oid root) recurse valid\n .gitignore\n dtwo/\n-/done/ 0000000000000000000000000000000000000000 recurse valid\n-/dthree/ 0000000000000000000000000000000000000000 recurse check_only valid\n-/dtwo/ 0000000000000000000000000000000000000000 recurse check_only valid\n+/done/ $ZERO_OID recurse valid\n+/dthree/ $ZERO_OID recurse check_only valid\n+/dtwo/ $ZERO_OID recurse check_only valid\n two\n EOF\n \ttest_cmp ../expect ../actual\n@@ -508,17 +518,17 @@ EOF\n test_expect_success 'untracked cache correct after status' '\n \ttest-tool dump-untracked-cache >../actual &&\n \tcat >../expect <<EOF &&\n-info/exclude 13263c0978fb9fad16b2d580fb800b6d811c3ff0\n-core.excludesfile 0000000000000000000000000000000000000000\n+info/exclude $(test_oid exclude)\n+core.excludesfile $ZERO_OID\n exclude_per_dir .gitignore\n flags 00000006\n-/ e6fcc8f2ee31bae321d66afd183fcb7237afae6e recurse valid\n+/ $(test_oid root) recurse valid\n .gitignore\n dtwo/\n-/done/ 1946f0437f90c5005533cbe1736a6451ca301714 recurse valid\n+/done/ $(test_oid done) recurse valid\n five\n-/dthree/ 0000000000000000000000000000000000000000 recurse check_only valid\n-/dtwo/ 0000000000000000000000000000000000000000 recurse check_only valid\n+/dthree/ $ZERO_OID recurse check_only valid\n+/dtwo/ $ZERO_OID recurse check_only valid\n two\n EOF\n \ttest_cmp ../expect ../actual\n@@ -580,22 +590,22 @@ EOF\n test_expect_success 'verify untracked cache dump (sparse/subdirs)' '\n \ttest-tool dump-untracked-cache >../actual &&\n \tcat >../expect-from-test-dump <<EOF &&\n-info/exclude 13263c0978fb9fad16b2d580fb800b6d811c3ff0\n-core.excludesfile 0000000000000000000000000000000000000000\n+info/exclude $(test_oid exclude)\n+core.excludesfile $ZERO_OID\n exclude_per_dir .gitignore\n flags 00000006\n-/ e6fcc8f2ee31bae321d66afd183fcb7237afae6e recurse valid\n+/ $(test_oid root) recurse valid\n .gitignore\n dtwo/\n-/done/ 1946f0437f90c5005533cbe1736a6451ca301714 recurse valid\n+/done/ $(test_oid done) recurse valid\n five\n sub/\n-/done/sub/ 0000000000000000000000000000000000000000 recurse check_only valid\n+/done/sub/ $ZERO_OID recurse check_only valid\n sub/\n-/done/sub/sub/ 0000000000000000000000000000000000000000 recurse check_only valid\n+/done/sub/sub/ $ZERO_OID recurse check_only valid\n file\n-/dthree/ 0000000000000000000000000000000000000000 recurse check_only valid\n-/dtwo/ 0000000000000000000000000000000000000000 recurse check_only valid\n+/dthree/ $ZERO_OID recurse check_only valid\n+/dtwo/ $ZERO_OID recurse check_only valid\n two\n EOF\n \ttest_cmp ../expect-from-test-dump ../actual\n@@ -695,6 +705,7 @@ test_expect_success 'using --untracked-cache does not fail when core.untrackedCa\n '\n \n test_expect_success 'setting core.untrackedCache to keep' '\n+\ttouch ../expect-from-test-dump &&\n \tgit config core.untrackedCache keep &&\n \tgit update-index --untracked-cache &&\n \ttest-tool dump-untracked-cache >../actual &&\n@@ -806,8 +817,8 @@ test_expect_success '\"status\" after file replacement should be clean with UC=tru\n \ttest-tool dump-untracked-cache >../actual &&\n \tgrep -F \"recurse valid\" ../actual >../actual.grep &&\n \tcat >../expect.grep <<EOF &&\n-/ 0000000000000000000000000000000000000000 recurse valid\n-/two/ 0000000000000000000000000000000000000000 recurse valid\n+/ $ZERO_OID recurse valid\n+/two/ $ZERO_OID recurse valid\n EOF\n \tstatus_is_clean &&\n \ttest_cmp ../expect.grep ../actual.grep\n"},{"id":"402095","messageId":"20200726195424.626969-11-sandals@crustytoothpaste.net","threadId":"53925","inReplyTo":"20200726195424.626969-1-sandals@crustytoothpaste.net","subject":"[PATCH v4 10/39] t7003: compute appropriate length constant","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-26T19:53:55Z","receivedAt":"2020-07-26T19:55:24Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Instead of using a specific invalid hard-coded object ID, look one\nup from the translation table.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n t/t7003-filter-branch.sh | 4 +++-\n 1 file changed, 3 insertions(+), 1 deletion(-)\n\ndiff --git a/t/t7003-filter-branch.sh b/t/t7003-filter-branch.sh\nindex e23de7d0b5..beeb2b855a 100755\n--- a/t/t7003-filter-branch.sh\n+++ b/t/t7003-filter-branch.sh\n@@ -5,6 +5,7 @@ test_description='git filter-branch'\n . \"$TEST_DIRECTORY/lib-gpg.sh\"\n \n test_expect_success 'setup' '\n+\ttest_oid_init &&\n \ttest_commit A &&\n \tGIT_COMMITTER_DATE=\"@0 +0000\" GIT_AUTHOR_DATE=\"@0 +0000\" &&\n \ttest_commit --notick B &&\n@@ -463,10 +464,11 @@ test_expect_success 'rewrite submodule with another content' '\n '\n \n test_expect_success 'replace submodule revision' '\n+\tinvalid=$(test_oid numeric) &&\n \tgit reset --hard original &&\n \tgit filter-branch -f --tree-filter \\\n \t    \"if git ls-files --error-unmatch -- submod > /dev/null 2>&1\n-\t     then git update-index --cacheinfo 160000 0123456789012345678901234567890123456789 submod\n+\t     then git update-index --cacheinfo 160000 $invalid submod\n \t     fi\" HEAD &&\n \ttest $orig_head != $(git show-ref --hash --head HEAD)\n '\n"},{"id":"402097","messageId":"20200726195424.626969-23-sandals@crustytoothpaste.net","threadId":"53925","inReplyTo":"20200726195424.626969-1-sandals@crustytoothpaste.net","subject":"[PATCH v4 22/39] t9300: use $ZERO_OID instead of hard-coded object ID","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-26T19:54:07Z","receivedAt":"2020-07-26T19:55:25Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n t/t9300-fast-import.sh | 16 ++++++++--------\n 1 file changed, 8 insertions(+), 8 deletions(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex 69d6fa4127..f4b3f5eaf9 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -92,7 +92,7 @@ test_expect_success 'A: create pack from stdin' '\n \tEOF\n \n \treset refs/tags/to-be-deleted\n-\tfrom 0000000000000000000000000000000000000000\n+\tfrom $ZERO_OID\n \n \ttag nested\n \tmark :6\n@@ -102,7 +102,7 @@ test_expect_success 'A: create pack from stdin' '\n \tEOF\n \n \treset refs/tags/nested\n-\tfrom 0000000000000000000000000000000000000000\n+\tfrom $ZERO_OID\n \n \ttag nested\n \tmark :7\n@@ -285,7 +285,7 @@ test_expect_success 'A: verify pack' '\n \n test_expect_success 'A: verify diff' '\n \tcat >expect <<-EOF &&\n-\t:000000 100755 0000000000000000000000000000000000000000 $(git rev-parse --verify master:file2) A\tcopy-of-file2\n+\t:000000 100755 $ZERO_OID $(git rev-parse --verify master:file2) A\tcopy-of-file2\n \tEOF\n \tgit diff-tree -M -r master verify--import-marks >actual &&\n \tcompare_diff_raw expect actual &&\n@@ -364,7 +364,7 @@ test_expect_success 'B: fail on invalid blob sha1' '\n \tCOMMIT\n \n \tfrom refs/heads/master\n-\tM 755 0000000000000000000000000000000000000001 zero1\n+\tM 755 $(echo $ZERO_OID | sed -e \"s/0$/1/\") zero1\n \n \tINPUT_END\n \n@@ -619,8 +619,8 @@ test_expect_success 'D: validate new files added' '\n \tf5id=$(echo \"$file5_data\" | git hash-object --stdin) &&\n \tf6id=$(echo \"$file6_data\" | git hash-object --stdin) &&\n \tcat >expect <<-EOF &&\n-\t:000000 100755 0000000000000000000000000000000000000000 $f6id A\tnewdir/exec.sh\n-\t:000000 100644 0000000000000000000000000000000000000000 $f5id A\tnewdir/interesting\n+\t:000000 100755 $ZERO_OID $f6id A\tnewdir/exec.sh\n+\t:000000 100644 $ZERO_OID $f5id A\tnewdir/interesting\n \tEOF\n \tgit diff-tree -M -r branch^ branch >actual &&\n \tcompare_diff_raw expect actual\n@@ -2732,7 +2732,7 @@ test_expect_success 'R: corrupt lines do not mess marks file' '\n \trm -f io.marks &&\n \tblob=$(echo hi | git hash-object --stdin) &&\n \tcat >expect <<-EOF &&\n-\t:3 0000000000000000000000000000000000000000\n+\t:3 $ZERO_OID\n \t:1 $blob\n \t:2 $blob\n \tEOF\n@@ -3083,7 +3083,7 @@ test_expect_success 'T: delete branch' '\n \tgit branch to-delete &&\n \tgit fast-import <<-EOF &&\n \treset refs/heads/to-delete\n-\tfrom 0000000000000000000000000000000000000000\n+\tfrom $ZERO_OID\n \tEOF\n \ttest_must_fail git rev-parse --verify refs/heads/to-delete\n '\n"},{"id":"402098","messageId":"20200726195424.626969-15-sandals@crustytoothpaste.net","threadId":"53925","inReplyTo":"20200726195424.626969-1-sandals@crustytoothpaste.net","subject":"[PATCH v4 14/39] t7400: make hash size independent","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-26T19:53:59Z","receivedAt":"2020-07-26T19:55:26Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Instead of using cut with hard-coded hash sizes, use cut with fields, or\nwhere that's not possible, sed with $OID_REGEX, so that the tests are\nindependent of hash size.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n t/t7400-submodule-basic.sh | 26 +++++++++++++-------------\n 1 file changed, 13 insertions(+), 13 deletions(-)\n\ndiff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh\nindex 956e17abb3..fec7e0299d 100755\n--- a/t/t7400-submodule-basic.sh\n+++ b/t/t7400-submodule-basic.sh\n@@ -1231,7 +1231,7 @@ test_expect_success 'submodule helper list is not confused by common prefixes' '\n \tgit submodule add /dir1/b dir1/b &&\n \tgit submodule add /dir2/b dir2/b &&\n \tgit commit -m \"first submodule commit\" &&\n-\tgit submodule--helper list dir1/b |cut -c51- >actual &&\n+\tgit submodule--helper list dir1/b | cut -f 2 >actual &&\n \techo \"dir1/b\" >expect &&\n \ttest_cmp expect actual\n '\n@@ -1260,7 +1260,7 @@ test_expect_success 'submodule update --init with a specification' '\n \tpwd=$(pwd) &&\n \tgit clone file://\"$pwd\"/multisuper multisuper_clone &&\n \tgit -C multisuper_clone submodule update --init . \":(exclude)sub0\" &&\n-\tgit -C multisuper_clone submodule status |cut -c 1,43- >actual &&\n+\tgit -C multisuper_clone submodule status | sed \"s/$OID_REGEX //\" >actual &&\n \ttest_cmp expect actual\n '\n \n@@ -1271,7 +1271,7 @@ test_expect_success 'submodule update --init with submodule.active set' '\n \tgit -C multisuper_clone config submodule.active \".\" &&\n \tgit -C multisuper_clone config --add submodule.active \":(exclude)sub0\" &&\n \tgit -C multisuper_clone submodule update --init &&\n-\tgit -C multisuper_clone submodule status |cut -c 1,43- >actual &&\n+\tgit -C multisuper_clone submodule status | sed \"s/$OID_REGEX //\" >actual &&\n \ttest_cmp expect actual\n '\n \n@@ -1290,7 +1290,7 @@ test_expect_success 'submodule update and setting submodule.<name>.active' '\n \t-sub3\n \tEOF\n \tgit -C multisuper_clone submodule update &&\n-\tgit -C multisuper_clone submodule status |cut -c 1,43- >actual &&\n+\tgit -C multisuper_clone submodule status | sed \"s/$OID_REGEX //\" >actual &&\n \ttest_cmp expect actual\n '\n \n@@ -1307,12 +1307,12 @@ test_expect_success 'clone active submodule without submodule url set' '\n \t\tgit submodule update &&\n \t\tgit submodule status >actual_raw &&\n \n-\t\tcut -c 1,43- actual_raw >actual &&\n+\t\tcut -d\" \" -f3- actual_raw >actual &&\n \t\tcat >expect <<-\\EOF &&\n-\t\t sub0 (test2)\n-\t\t sub1 (test2)\n-\t\t sub2 (test2)\n-\t\t sub3 (test2)\n+\t\tsub0 (test2)\n+\t\tsub1 (test2)\n+\t\tsub2 (test2)\n+\t\tsub3 (test2)\n \t\tEOF\n \t\ttest_cmp expect actual\n \t)\n@@ -1328,7 +1328,7 @@ test_expect_success 'clone --recurse-submodules with a pathspec works' '\n \tEOF\n \n \tgit clone --recurse-submodules=\"sub0\" multisuper multisuper_clone &&\n-\tgit -C multisuper_clone submodule status |cut -c1,43- >actual &&\n+\tgit -C multisuper_clone submodule status | sed \"s/$OID_REGEX //\" >actual &&\n \ttest_cmp expected actual\n '\n \n@@ -1345,7 +1345,7 @@ test_expect_success 'clone with multiple --recurse-submodules options' '\n \t\t  --recurse-submodules=\":(exclude)sub0\" \\\n \t\t  --recurse-submodules=\":(exclude)sub2\" \\\n \t\t  multisuper multisuper_clone &&\n-\tgit -C multisuper_clone submodule status |cut -c1,43- >actual &&\n+\tgit -C multisuper_clone submodule status | sed \"s/$OID_REGEX //\" >actual &&\n \ttest_cmp expect actual\n '\n \n@@ -1373,7 +1373,7 @@ test_expect_success 'clone and subsequent updates correctly auto-initialize subm\n \t\t  --recurse-submodules=\":(exclude)sub4\" \\\n \t\t  multisuper multisuper_clone &&\n \n-\tgit -C multisuper_clone submodule status |cut -c1,43- >actual &&\n+\tgit -C multisuper_clone submodule status | sed \"s/$OID_REGEX //\" >actual &&\n \ttest_cmp expect actual &&\n \n \tgit -C multisuper submodule add ../sub1 sub4 &&\n@@ -1382,7 +1382,7 @@ test_expect_success 'clone and subsequent updates correctly auto-initialize subm\n \t# obtain the new superproject\n \tgit -C multisuper_clone pull &&\n \tgit -C multisuper_clone submodule update --init &&\n-\tgit -C multisuper_clone submodule status |cut -c1,43- >actual &&\n+\tgit -C multisuper_clone submodule status | sed \"s/$OID_REGEX //\" >actual &&\n \ttest_cmp expect2 actual\n '\n \n"},{"id":"402099","messageId":"20200726195424.626969-22-sandals@crustytoothpaste.net","threadId":"53925","inReplyTo":"20200726195424.626969-1-sandals@crustytoothpaste.net","subject":"[PATCH v4 21/39] t9300: abstract away SHA-1-specific constants","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-26T19:54:06Z","receivedAt":"2020-07-26T19:55:27Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Adjust the test so that it computes variables for object IDs instead of\nusing hard-coded hashes.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n t/t9300-fast-import.sh | 107 ++++++++++++++++++++++-------------------\n 1 file changed, 58 insertions(+), 49 deletions(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex e151df81c0..69d6fa4127 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -285,7 +285,7 @@ test_expect_success 'A: verify pack' '\n \n test_expect_success 'A: verify diff' '\n \tcat >expect <<-EOF &&\n-\t:000000 100755 0000000000000000000000000000000000000000 7123f7f44e39be127c5eb701e5968176ee9d78b1 A\tcopy-of-file2\n+\t:000000 100755 0000000000000000000000000000000000000000 $(git rev-parse --verify master:file2) A\tcopy-of-file2\n \tEOF\n \tgit diff-tree -M -r master verify--import-marks >actual &&\n \tcompare_diff_raw expect actual &&\n@@ -528,6 +528,7 @@ test_expect_success 'B: fail on invalid committer (5)' '\n test_expect_success 'C: incremental import create pack from stdin' '\n \tnewf=$(echo hi newf | git hash-object -w --stdin) &&\n \toldf=$(git rev-parse --verify master:file2) &&\n+\tthrf=$(git rev-parse --verify master:file3) &&\n \ttest_tick &&\n \tcat >input <<-INPUT_END &&\n \tcommit refs/heads/branch\n@@ -570,10 +571,11 @@ test_expect_success 'C: verify commit' '\n '\n \n test_expect_success 'C: validate rename result' '\n+\tzero=$ZERO_OID &&\n \tcat >expect <<-EOF &&\n-\t:000000 100755 0000000000000000000000000000000000000000 f1fb5da718392694d0076d677d6d0e364c79b0bc A\tfile2/newf\n-\t:100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 R100\tfile2\tfile2/oldf\n-\t:100644 000000 0d92e9f3374ae2947c23aa477cbc68ce598135f1 0000000000000000000000000000000000000000 D\tfile3\n+\t:000000 100755 $zero $newf A\tfile2/newf\n+\t:100644 100644 $oldf $oldf R100\tfile2\tfile2/oldf\n+\t:100644 000000 $thrf $zero D\tfile3\n \tEOF\n \tgit diff-tree -M -r master branch >actual &&\n \tcompare_diff_raw expect actual\n@@ -614,9 +616,11 @@ test_expect_success 'D: verify pack' '\n '\n \n test_expect_success 'D: validate new files added' '\n+\tf5id=$(echo \"$file5_data\" | git hash-object --stdin) &&\n+\tf6id=$(echo \"$file6_data\" | git hash-object --stdin) &&\n \tcat >expect <<-EOF &&\n-\t:000000 100755 0000000000000000000000000000000000000000 e74b7d465e52746be2b4bae983670711e6e66657 A\tnewdir/exec.sh\n-\t:000000 100644 0000000000000000000000000000000000000000 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 A\tnewdir/interesting\n+\t:000000 100755 0000000000000000000000000000000000000000 $f6id A\tnewdir/exec.sh\n+\t:000000 100644 0000000000000000000000000000000000000000 $f5id A\tnewdir/interesting\n \tEOF\n \tgit diff-tree -M -r branch^ branch >actual &&\n \tcompare_diff_raw expect actual\n@@ -779,12 +783,13 @@ test_expect_success 'H: verify pack' '\n '\n \n test_expect_success 'H: validate old files removed, new files added' '\n+\tf4id=$(git rev-parse HEAD:file4) &&\n \tcat >expect <<-EOF &&\n-\t:100755 000000 f1fb5da718392694d0076d677d6d0e364c79b0bc 0000000000000000000000000000000000000000 D\tfile2/newf\n-\t:100644 000000 7123f7f44e39be127c5eb701e5968176ee9d78b1 0000000000000000000000000000000000000000 D\tfile2/oldf\n-\t:100755 000000 85df50785d62d3b05ab03d9cbf7e4a0b49449730 0000000000000000000000000000000000000000 D\tfile4\n-\t:100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 R100\tnewdir/interesting\th/e/l/lo\n-\t:100755 000000 e74b7d465e52746be2b4bae983670711e6e66657 0000000000000000000000000000000000000000 D\tnewdir/exec.sh\n+\t:100755 000000 $newf $zero D\tfile2/newf\n+\t:100644 000000 $oldf $zero D\tfile2/oldf\n+\t:100755 000000 $f4id $zero D\tfile4\n+\t:100644 100644 $f5id $f5id R100\tnewdir/interesting\th/e/l/lo\n+\t:100755 000000 $f6id $zero D\tnewdir/exec.sh\n \tEOF\n \tgit diff-tree -M -r H^ H >actual &&\n \tcompare_diff_raw expect actual\n@@ -935,14 +940,15 @@ test_expect_success 'L: verify internal tree sorting' '\n \tINPUT_END\n \n \tcat >expect <<-EXPECT_END &&\n-\t:100644 100644 4268632... 55d3a52... M\tb.\n-\t:040000 040000 0ae5cac... 443c768... M\tb\n-\t:100644 100644 4268632... 55d3a52... M\tba\n+\t:100644 100644 M\tb.\n+\t:040000 040000 M\tb\n+\t:100644 100644 M\tba\n \tEXPECT_END\n \n \tgit fast-import <input &&\n \tGIT_PRINT_SHA1_ELLIPSIS=\"yes\" git diff-tree --abbrev --raw L^ L >output &&\n-\ttest_cmp expect output\n+\tcut -d\" \" -f1,2,5 output >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success 'L: nested tree copy does not corrupt deltas' '\n@@ -1004,7 +1010,7 @@ test_expect_success 'M: rename file in same subdirectory' '\n \tINPUT_END\n \n \tcat >expect <<-EOF &&\n-\t:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100\tfile2/newf\tfile2/n.e.w.f\n+\t:100755 100755 $newf $newf R100\tfile2/newf\tfile2/n.e.w.f\n \tEOF\n \tgit fast-import <input &&\n \tgit diff-tree -M -r M1^ M1 >actual &&\n@@ -1025,7 +1031,7 @@ test_expect_success 'M: rename file to new subdirectory' '\n \tINPUT_END\n \n \tcat >expect <<-EOF &&\n-\t:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100\tfile2/newf\ti/am/new/to/you\n+\t:100755 100755 $newf $newf R100\tfile2/newf\ti/am/new/to/you\n \tEOF\n \tgit fast-import <input &&\n \tgit diff-tree -M -r M2^ M2 >actual &&\n@@ -1046,7 +1052,7 @@ test_expect_success 'M: rename subdirectory to new subdirectory' '\n \tINPUT_END\n \n \tcat >expect <<-EOF &&\n-\t:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100\ti/am/new/to/you\tother/sub/am/new/to/you\n+\t:100755 100755 $newf $newf R100\ti/am/new/to/you\tother/sub/am/new/to/you\n \tEOF\n \tgit fast-import <input &&\n \tgit diff-tree -M -r M3^ M3 >actual &&\n@@ -1067,11 +1073,11 @@ test_expect_success 'M: rename root to subdirectory' '\n \tINPUT_END\n \n \tcat >expect <<-EOF &&\n-\t:100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 R100\tfile2/oldf\tsub/file2/oldf\n-\t:100755 100755 85df50785d62d3b05ab03d9cbf7e4a0b49449730 85df50785d62d3b05ab03d9cbf7e4a0b49449730 R100\tfile4\tsub/file4\n-\t:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100\ti/am/new/to/you\tsub/i/am/new/to/you\n-\t:100755 100755 e74b7d465e52746be2b4bae983670711e6e66657 e74b7d465e52746be2b4bae983670711e6e66657 R100\tnewdir/exec.sh\tsub/newdir/exec.sh\n-\t:100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 R100\tnewdir/interesting\tsub/newdir/interesting\n+\t:100644 100644 $oldf $oldf R100\tfile2/oldf\tsub/file2/oldf\n+\t:100755 100755 $f4id $f4id R100\tfile4\tsub/file4\n+\t:100755 100755 $newf $newf R100\ti/am/new/to/you\tsub/i/am/new/to/you\n+\t:100755 100755 $f6id $f6id R100\tnewdir/exec.sh\tsub/newdir/exec.sh\n+\t:100644 100644 $f5id $f5id R100\tnewdir/interesting\tsub/newdir/interesting\n \tEOF\n \tgit fast-import <input &&\n \tgit diff-tree -M -r M4^ M4 >actual &&\n@@ -1097,7 +1103,7 @@ test_expect_success 'N: copy file in same subdirectory' '\n \tINPUT_END\n \n \tcat >expect <<-EOF &&\n-\t:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100\tfile2/newf\tfile2/n.e.w.f\n+\t:100755 100755 $newf $newf C100\tfile2/newf\tfile2/n.e.w.f\n \tEOF\n \tgit fast-import <input &&\n \tgit diff-tree -C --find-copies-harder -r N1^ N1 >actual &&\n@@ -1129,9 +1135,9 @@ test_expect_success 'N: copy then modify subdirectory' '\n \tINPUT_END\n \n \tcat >expect <<-EOF &&\n-\t:100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 C100\tnewdir/interesting\tfile3/file5\n-\t:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100\tfile2/newf\tfile3/newf\n-\t:100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100\tfile2/oldf\tfile3/oldf\n+\t:100644 100644 $f5id $f5id C100\tnewdir/interesting\tfile3/file5\n+\t:100755 100755 $newf $newf C100\tfile2/newf\tfile3/newf\n+\t:100644 100644 $oldf $oldf C100\tfile2/oldf\tfile3/oldf\n \tEOF\n \tgit fast-import <input &&\n \tgit diff-tree -C --find-copies-harder -r N2^^ N2 >actual &&\n@@ -1162,9 +1168,9 @@ test_expect_success 'N: copy dirty subdirectory' '\n '\n \n test_expect_success 'N: copy directory by id' '\n-\tcat >expect <<-\\EOF &&\n-\t:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100\tfile2/newf\tfile3/newf\n-\t:100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100\tfile2/oldf\tfile3/oldf\n+\tcat >expect <<-EOF &&\n+\t:100755 100755 $newf $newf C100\tfile2/newf\tfile3/newf\n+\t:100644 100644 $oldf $oldf C100\tfile2/oldf\tfile3/oldf\n \tEOF\n \tsubdir=$(git rev-parse refs/heads/branch^0:file2) &&\n \tcat >input <<-INPUT_END &&\n@@ -1183,9 +1189,9 @@ test_expect_success 'N: copy directory by id' '\n '\n \n test_expect_success PIPE 'N: read and copy directory' '\n-\tcat >expect <<-\\EOF &&\n-\t:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100\tfile2/newf\tfile3/newf\n-\t:100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100\tfile2/oldf\tfile3/oldf\n+\tcat >expect <<-EOF &&\n+\t:100755 100755 $newf $newf C100\tfile2/newf\tfile3/newf\n+\t:100644 100644 $oldf $oldf C100\tfile2/oldf\tfile3/oldf\n \tEOF\n \tgit update-ref -d refs/heads/N4 &&\n \trm -f backflow &&\n@@ -1254,9 +1260,9 @@ test_expect_success PIPE 'N: empty directory reads as missing' '\n '\n \n test_expect_success 'N: copy root directory by tree hash' '\n-\tcat >expect <<-\\EOF &&\n-\t:100755 000000 f1fb5da718392694d0076d677d6d0e364c79b0bc 0000000000000000000000000000000000000000 D\tfile3/newf\n-\t:100644 000000 7123f7f44e39be127c5eb701e5968176ee9d78b1 0000000000000000000000000000000000000000 D\tfile3/oldf\n+\tcat >expect <<-EOF &&\n+\t:100755 000000 $newf $zero D\tfile3/newf\n+\t:100644 000000 $oldf $zero D\tfile3/oldf\n \tEOF\n \troot=$(git rev-parse refs/heads/branch^0^{tree}) &&\n \tcat >input <<-INPUT_END &&\n@@ -1275,12 +1281,12 @@ test_expect_success 'N: copy root directory by tree hash' '\n '\n \n test_expect_success 'N: copy root by path' '\n-\tcat >expect <<-\\EOF &&\n-\t:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100\tfile2/newf\toldroot/file2/newf\n-\t:100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100\tfile2/oldf\toldroot/file2/oldf\n-\t:100755 100755 85df50785d62d3b05ab03d9cbf7e4a0b49449730 85df50785d62d3b05ab03d9cbf7e4a0b49449730 C100\tfile4\toldroot/file4\n-\t:100755 100755 e74b7d465e52746be2b4bae983670711e6e66657 e74b7d465e52746be2b4bae983670711e6e66657 C100\tnewdir/exec.sh\toldroot/newdir/exec.sh\n-\t:100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 C100\tnewdir/interesting\toldroot/newdir/interesting\n+\tcat >expect <<-EOF &&\n+\t:100755 100755 $newf $newf C100\tfile2/newf\toldroot/file2/newf\n+\t:100644 100644 $oldf $oldf C100\tfile2/oldf\toldroot/file2/oldf\n+\t:100755 100755 $f4id $f4id C100\tfile4\toldroot/file4\n+\t:100755 100755 $f6id $f6id C100\tnewdir/exec.sh\toldroot/newdir/exec.sh\n+\t:100644 100644 $f5id $f5id C100\tnewdir/interesting\toldroot/newdir/interesting\n \tEOF\n \tcat >input <<-INPUT_END &&\n \tcommit refs/heads/N-copy-root-path\n@@ -1340,10 +1346,10 @@ test_expect_success 'N: delete directory by copying' '\n '\n \n test_expect_success 'N: modify copied tree' '\n-\tcat >expect <<-\\EOF &&\n-\t:100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 C100\tnewdir/interesting\tfile3/file5\n-\t:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100\tfile2/newf\tfile3/newf\n-\t:100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100\tfile2/oldf\tfile3/oldf\n+\tcat >expect <<-EOF &&\n+\t:100644 100644 $f5id $f5id C100\tnewdir/interesting\tfile3/file5\n+\t:100755 100755 $newf $newf C100\tfile2/newf\tfile3/newf\n+\t:100644 100644 $oldf $oldf C100\tfile2/oldf\tfile3/oldf\n \tEOF\n \tsubdir=$(git rev-parse refs/heads/branch^0:file2) &&\n \tcat >input <<-INPUT_END &&\n@@ -3117,6 +3123,9 @@ test_expect_success 'U: initialize for U tests' '\n \n \tINPUT_END\n \n+\tf7id=$(echo \"blob 1\" | git hash-object --stdin) &&\n+\tf8id=$(echo \"sleep well\" | git hash-object --stdin) &&\n+\tf9id=$(echo \"au revoir\" | git hash-object --stdin) &&\n \tgit fast-import <input\n '\n \n@@ -3137,7 +3146,7 @@ test_expect_success 'U: filedelete file succeeds' '\n \n test_expect_success 'U: validate file delete result' '\n \tcat >expect <<-EOF &&\n-\t:100644 000000 2907ebb4bf85d91bf0716bb3bd8a68ef48d6da76 0000000000000000000000000000000000000000 D\tgood/night.txt\n+\t:100644 000000 $f8id $ZERO_OID D\tgood/night.txt\n \tEOF\n \n \tgit diff-tree -M -r U^1 U >actual &&\n@@ -3162,7 +3171,7 @@ test_expect_success 'U: filedelete directory succeeds' '\n \n test_expect_success 'U: validate directory delete result' '\n \tcat >expect <<-EOF &&\n-\t:100644 000000 69cb75792f55123d8389c156b0b41c2ff00ed507 0000000000000000000000000000000000000000 D\tgood/bye.txt\n+\t:100644 000000 $f9id $ZERO_OID D\tgood/bye.txt\n \tEOF\n \n \tgit diff-tree -M -r U^1 U >actual &&\n@@ -3187,7 +3196,7 @@ test_expect_success 'U: filedelete root succeeds' '\n \n test_expect_success 'U: validate root delete result' '\n \tcat >expect <<-EOF &&\n-\t:100644 000000 c18147dc648481eeb65dc5e66628429a64843327 0000000000000000000000000000000000000000 D\thello.c\n+\t:100644 000000 $f7id $ZERO_OID D\thello.c\n \tEOF\n \n \tgit diff-tree -M -r U^1 U >actual &&\n"},{"id":"402100","messageId":"20200726195424.626969-28-sandals@crustytoothpaste.net","threadId":"53925","inReplyTo":"20200726195424.626969-1-sandals@crustytoothpaste.net","subject":"[PATCH v4 27/39] t5308: make test work with SHA-256","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-26T19:54:12Z","receivedAt":"2020-07-26T19:55:28Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"This test needs multiple object IDs that have the same first byte.\nUpdate the pack test code to generate a suitable packed value for\nSHA-256.  Update the test to use this value when using SHA-256.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n t/lib-pack.sh                     |  8 ++++++++\n t/t5308-pack-detect-duplicates.sh | 20 ++++++++++++--------\n 2 files changed, 20 insertions(+), 8 deletions(-)\n\ndiff --git a/t/lib-pack.sh b/t/lib-pack.sh\nindex f3463170b3..0c799d53c6 100644\n--- a/t/lib-pack.sh\n+++ b/t/lib-pack.sh\n@@ -93,6 +93,14 @@ pack_obj () {\n \t\t\t;;\n \t\tesac\n \t\t;;\n+\t# blob containing \"\\3\\326\"\n+\t471819e8c52bf11513f100b2810a8aa0622d5cd3d1c913758a071dd4b3bad8fe)\n+\t\tcase \"$2\" in\n+\t\t'')\n+\t\t\tprintf '\\062\\170\\234\\143\\276\\006\\000\\000\\336\\000\\332'\n+\t\t\treturn\n+\t\t\t;;\n+\t\tesac\n \tesac\n \n \t# If it's not a delta, we can convince pack-objects to generate a pack\ndiff --git a/t/t5308-pack-detect-duplicates.sh b/t/t5308-pack-detect-duplicates.sh\nindex 6845c1f3c3..693b2411c8 100755\n--- a/t/t5308-pack-detect-duplicates.sh\n+++ b/t/t5308-pack-detect-duplicates.sh\n@@ -4,23 +4,27 @@ test_description='handling of duplicate objects in incoming packfiles'\n . ./test-lib.sh\n . \"$TEST_DIRECTORY\"/lib-pack.sh\n \n-if ! test_have_prereq SHA1\n-then\n-       skip_all='not using SHA-1 for objects'\n-       test_done\n-fi\n+test_expect_success 'setup' '\n+\ttest_oid_cache <<-EOF\n+\tlo_oid sha1:e68fe8129b546b101aee9510c5328e7f21ca1d18\n+\tlo_oid sha256:471819e8c52bf11513f100b2810a8aa0622d5cd3d1c913758a071dd4b3bad8fe\n+\n+\tmissing_oid sha1:e69d000000000000000000000000000000000000\n+\tmissing_oid sha256:4720000000000000000000000000000000000000000000000000000000000000\n+\tEOF\n+'\n \n # The sha1s we have in our pack. It's important that these have the same\n # starting byte, so that they end up in the same fanout section of the index.\n # That lets us make sure we are exercising the binary search with both sets.\n-LO_SHA1=e68fe8129b546b101aee9510c5328e7f21ca1d18\n-HI_SHA1=e69de29bb2d1d6434b8b29ae775ad8c2e48c5391\n+LO_SHA1=$(test_oid lo_oid)\n+HI_SHA1=$EMPTY_BLOB\n \n # And here's a \"missing sha1\" which will produce failed lookups. It must also\n # be in the same fanout section, and should be between the two (so that during\n # our binary search, we are sure to end up looking at one or the other of the\n # duplicate runs).\n-MISSING_SHA1='e69d000000000000000000000000000000000000'\n+MISSING_SHA1=$(test_oid missing_oid)\n \n # git will never intentionally create packfiles with\n # duplicate objects, so we have to construct them by hand.\n"},{"id":"402101","messageId":"20200726195424.626969-31-sandals@crustytoothpaste.net","threadId":"53925","inReplyTo":"20200726195424.626969-1-sandals@crustytoothpaste.net","subject":"[PATCH v4 30/39] builtin/verify-pack: implement an --object-format option","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-26T19:54:15Z","receivedAt":"2020-07-26T19:55:29Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"A recently added test in t5702 started using git verify-pack outside of\na repository.  While this poses no problems with SHA-1, with SHA-256 we\nimplicitly rely on the setup of the repository to initialize our hash\nalgorithm settings.\n\nSince we're not in a repository here, we need to provide git verify-pack\nhelp to set things up properly.  git index-pack already knows an\n--object-format option, so let's accept one as well and pass it down to\nour git index-pack invocation.  Since we're now dynamically adjusting\nthe elements in argv, let's switch to using struct argv_array to manage\nthem.  Finally, let's make t5702 pass the proper argument on down to its\ngit verify-pack caller.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n builtin/verify-pack.c  | 29 ++++++++++++++++++++---------\n t/t5702-protocol-v2.sh |  2 +-\n 2 files changed, 21 insertions(+), 10 deletions(-)\n\ndiff --git a/builtin/verify-pack.c b/builtin/verify-pack.c\nindex c2a1a5c504..033e05d1a7 100644\n--- a/builtin/verify-pack.c\n+++ b/builtin/verify-pack.c\n@@ -7,21 +7,28 @@\n #define VERIFY_PACK_VERBOSE 01\n #define VERIFY_PACK_STAT_ONLY 02\n \n-static int verify_one_pack(const char *path, unsigned int flags)\n+static int verify_one_pack(const char *path, unsigned int flags, const char *hash_algo)\n {\n \tstruct child_process index_pack = CHILD_PROCESS_INIT;\n-\tconst char *argv[] = {\"index-pack\", NULL, NULL, NULL };\n-\tstruct strbuf arg = STRBUF_INIT;\n+\tstruct argv_array argv = ARGV_ARRAY_INIT;\n+\tstruct strbuf arg = STRBUF_INIT, hash_arg = STRBUF_INIT;\n \tint verbose = flags & VERIFY_PACK_VERBOSE;\n \tint stat_only = flags & VERIFY_PACK_STAT_ONLY;\n \tint err;\n \n+\targv_array_push(&argv, \"index-pack\");\n+\n \tif (stat_only)\n-\t\targv[1] = \"--verify-stat-only\";\n+\t\targv_array_push(&argv, \"--verify-stat-only\");\n \telse if (verbose)\n-\t\targv[1] = \"--verify-stat\";\n+\t\targv_array_push(&argv, \"--verify-stat\");\n \telse\n-\t\targv[1] = \"--verify\";\n+\t\targv_array_push(&argv, \"--verify\");\n+\n+\tif (hash_algo) {\n+\t\tstrbuf_addf(&hash_arg, \"--object-format=%s\", hash_algo);\n+\t\targv_array_push(&argv, hash_arg.buf);\n+\t}\n \n \t/*\n \t * In addition to \"foo.pack\" we accept \"foo.idx\" and \"foo\";\n@@ -31,9 +38,9 @@ static int verify_one_pack(const char *path, unsigned int flags)\n \tif (strbuf_strip_suffix(&arg, \".idx\") ||\n \t    !ends_with(arg.buf, \".pack\"))\n \t\tstrbuf_addstr(&arg, \".pack\");\n-\targv[2] = arg.buf;\n+\targv_array_push(&argv, arg.buf);\n \n-\tindex_pack.argv = argv;\n+\tindex_pack.argv = argv.argv;\n \tindex_pack.git_cmd = 1;\n \n \terr = run_command(&index_pack);\n@@ -47,6 +54,7 @@ static int verify_one_pack(const char *path, unsigned int flags)\n \t\t}\n \t}\n \tstrbuf_release(&arg);\n+\targv_array_clear(&argv);\n \n \treturn err;\n }\n@@ -60,12 +68,15 @@ int cmd_verify_pack(int argc, const char **argv, const char *prefix)\n {\n \tint err = 0;\n \tunsigned int flags = 0;\n+\tconst char *object_format = NULL;\n \tint i;\n \tconst struct option verify_pack_options[] = {\n \t\tOPT_BIT('v', \"verbose\", &flags, N_(\"verbose\"),\n \t\t\tVERIFY_PACK_VERBOSE),\n \t\tOPT_BIT('s', \"stat-only\", &flags, N_(\"show statistics only\"),\n \t\t\tVERIFY_PACK_STAT_ONLY),\n+\t\tOPT_STRING(0, \"object-format\", &object_format, N_(\"hash\"),\n+\t\t\t   N_(\"specify the hash algorithm to use\")),\n \t\tOPT_END()\n \t};\n \n@@ -75,7 +86,7 @@ int cmd_verify_pack(int argc, const char **argv, const char *prefix)\n \tif (argc < 1)\n \t\tusage_with_options(verify_pack_usage, verify_pack_options);\n \tfor (i = 0; i < argc; i++) {\n-\t\tif (verify_one_pack(argv[i], flags))\n+\t\tif (verify_one_pack(argv[i], flags, object_format))\n \t\t\terr = 1;\n \t}\n \ndiff --git a/t/t5702-protocol-v2.sh b/t/t5702-protocol-v2.sh\nindex 1b54c35b01..7fc22171e7 100755\n--- a/t/t5702-protocol-v2.sh\n+++ b/t/t5702-protocol-v2.sh\n@@ -829,7 +829,7 @@ test_expect_success 'part of packfile response provided as URI' '\n \t# Ensure that my-blob and other-blob are in separate packfiles.\n \tfor idx in http_child/.git/objects/pack/*.idx\n \tdo\n-\t\tgit verify-pack --verbose $idx >out &&\n+\t\tgit verify-pack --object-format=$(test_oid algo) --verbose $idx >out &&\n \t\t{\n \t\t\tgrep \"^[0-9a-f]\\{16,\\} \" out || :\n \t\t} >out.objectlist &&\n"},{"id":"402102","messageId":"20200726195424.626969-32-sandals@crustytoothpaste.net","threadId":"53925","inReplyTo":"20200726195424.626969-1-sandals@crustytoothpaste.net","subject":"[PATCH v4 31/39] bundle: add new version for use with SHA-256","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-26T19:54:16Z","receivedAt":"2020-07-26T19:55:30Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Currently we detect the hash algorithm in use by the length of the\nobject ID.  This is inelegant and prevents us from using a different\nhash algorithm that is also 256 bits in length.\n\nSince we cannot extend the v2 format in a backward-compatible way, let's\nadd a v3 format, which is identical, except for the addition of\ncapabilities, which are prefixed by an at sign.  We add \"object-format\"\nas the only capability and reject unknown capabilities, since we do not\nhave a network connection and therefore cannot negotiate with the other\nside.\n\nFor compatibility, default to the v2 format for SHA-1 and require v3\nfor SHA-256.\n\nIn t5510, always use format v3 so we can be sure we produce consistent\nresults across hash algorithms.  Since head -n N lists the top N lines\ninstead of the Nth line, let's run our output through sed to normalize\nit and compare it against a fixed value, which will make sure we get\nexactly what we're expecting.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n Documentation/git-bundle.txt              |  9 ++-\n Documentation/technical/bundle-format.txt | 30 +++++++-\n builtin/bundle.c                          |  5 +-\n bundle.c                                  | 85 +++++++++++++++++------\n bundle.h                                  |  4 +-\n t/t5510-fetch.sh                          | 15 ++--\n t/t5607-clone-bundle.sh                   | 31 +++++++++\n 7 files changed, 148 insertions(+), 31 deletions(-)\n\ndiff --git a/Documentation/git-bundle.txt b/Documentation/git-bundle.txt\nindex d34b0964be..53804cad4b 100644\n--- a/Documentation/git-bundle.txt\n+++ b/Documentation/git-bundle.txt\n@@ -9,7 +9,8 @@ git-bundle - Move objects and refs by archive\n SYNOPSIS\n --------\n [verse]\n-'git bundle' create [-q | --quiet | --progress | --all-progress] [--all-progress-implied] <file> <git-rev-list-args>\n+'git bundle' create [-q | --quiet | --progress | --all-progress] [--all-progress-implied]\n+\t\t    [--version=<version>] <file> <git-rev-list-args>\n 'git bundle' verify [-q | --quiet] <file>\n 'git bundle' list-heads <file> [<refname>...]\n 'git bundle' unbundle <file> [<refname>...]\n@@ -102,6 +103,12 @@ unbundle <file>::\n \tis activated.  Unlike --all-progress this flag doesn't actually\n \tforce any progress display by itself.\n \n+--version=<version>::\n+\tSpecify the bundle version.  Version 2 is the older format and can only be\n+\tused with SHA-1 repositories; the newer version 3 contains capabilities that\n+\tpermit extensions. The default is the oldest supported format, based on the\n+\thash algorithm in use.\n+\n -q::\n --quiet::\n \tThis flag makes the command not to report its progress\ndiff --git a/Documentation/technical/bundle-format.txt b/Documentation/technical/bundle-format.txt\nindex 0e828151a5..bac558d049 100644\n--- a/Documentation/technical/bundle-format.txt\n+++ b/Documentation/technical/bundle-format.txt\n@@ -7,6 +7,8 @@ The Git bundle format is a format that represents both refs and Git objects.\n We will use ABNF notation to define the Git bundle format. See\n protocol-common.txt for the details.\n \n+A v2 bundle looks like this:\n+\n ----\n bundle    = signature *prerequisite *reference LF pack\n signature = \"# v2 git bundle\" LF\n@@ -18,9 +20,28 @@ reference    = obj-id SP refname LF\n pack         = ... ; packfile\n ----\n \n+A v3 bundle looks like this:\n+\n+----\n+bundle    = signature *capability *prerequisite *reference LF pack\n+signature = \"# v3 git bundle\" LF\n+\n+capability   = \"@\" key [\"=\" value] LF\n+prerequisite = \"-\" obj-id SP comment LF\n+comment      = *CHAR\n+reference    = obj-id SP refname LF\n+key          = 1*(ALPHA / DIGIT / \"-\")\n+value        = *(%01-09 / %0b-FF)\n+\n+pack         = ... ; packfile\n+----\n+\n == Semantics\n \n-A Git bundle consists of three parts.\n+A Git bundle consists of several parts.\n+\n+* \"Capabilities\", which are only in the v3 format, indicate functionality that\n+\tthe bundle requires to be read properly.\n \n * \"Prerequisites\" lists the objects that are NOT included in the bundle and the\n   reader of the bundle MUST already have, in order to use the data in the\n@@ -46,3 +67,10 @@ put any string here. The reader of the bundle MUST ignore the comment.\n Note that the prerequisites does not represent a shallow-clone boundary. The\n semantics of the prerequisites and the shallow-clone boundaries are different,\n and the Git bundle v2 format cannot represent a shallow clone repository.\n+\n+== Capabilities\n+\n+Because there is no opportunity for negotiation, unknown capabilities cause 'git\n+bundle' to abort.  The only known capability is `object-format`, which specifies\n+the hash algorithm in use, and can take the same values as the\n+`extensions.objectFormat` configuration value.\ndiff --git a/builtin/bundle.c b/builtin/bundle.c\nindex f049d27a14..e1a85e7dcc 100644\n--- a/builtin/bundle.c\n+++ b/builtin/bundle.c\n@@ -60,6 +60,7 @@ static int cmd_bundle_create(int argc, const char **argv, const char *prefix) {\n \tint all_progress_implied = 0;\n \tint progress = isatty(STDERR_FILENO);\n \tstruct argv_array pack_opts;\n+\tint version = -1;\n \n \tstruct option options[] = {\n \t\tOPT_SET_INT('q', \"quiet\", &progress,\n@@ -71,6 +72,8 @@ static int cmd_bundle_create(int argc, const char **argv, const char *prefix) {\n \t\tOPT_BOOL(0, \"all-progress-implied\",\n \t\t\t &all_progress_implied,\n \t\t\t N_(\"similar to --all-progress when progress meter is shown\")),\n+\t\tOPT_INTEGER(0, \"version\", &version,\n+\t\t\t    N_(\"specify bundle format version\")),\n \t\tOPT_END()\n \t};\n \tconst char* bundle_file;\n@@ -91,7 +94,7 @@ static int cmd_bundle_create(int argc, const char **argv, const char *prefix) {\n \n \tif (!startup_info->have_repository)\n \t\tdie(_(\"Need a repository to create a bundle.\"));\n-\treturn !!create_bundle(the_repository, bundle_file, argc, argv, &pack_opts);\n+\treturn !!create_bundle(the_repository, bundle_file, argc, argv, &pack_opts, version);\n }\n \n static int cmd_bundle_verify(int argc, const char **argv, const char *prefix) {\ndiff --git a/bundle.c b/bundle.c\nindex 2a0d744d3f..5c1cc8f4a8 100644\n--- a/bundle.c\n+++ b/bundle.c\n@@ -12,7 +12,16 @@\n #include \"refs.h\"\n #include \"argv-array.h\"\n \n-static const char bundle_signature[] = \"# v2 git bundle\\n\";\n+\n+static const char v2_bundle_signature[] = \"# v2 git bundle\\n\";\n+static const char v3_bundle_signature[] = \"# v3 git bundle\\n\";\n+static struct {\n+\tint version;\n+\tconst char *signature;\n+} bundle_sigs[] = {\n+\t{ 2, v2_bundle_signature },\n+\t{ 3, v3_bundle_signature },\n+};\n \n static void add_to_ref_list(const struct object_id *oid, const char *name,\n \t\tstruct ref_list *list)\n@@ -23,15 +32,30 @@ static void add_to_ref_list(const struct object_id *oid, const char *name,\n \tlist->nr++;\n }\n \n-static const struct git_hash_algo *detect_hash_algo(struct strbuf *buf)\n+static int parse_capability(struct bundle_header *header, const char *capability)\n {\n-\tsize_t len = strcspn(buf->buf, \" \\n\");\n-\tint algo;\n+\tconst char *arg;\n+\tif (skip_prefix(capability, \"object-format=\", &arg)) {\n+\t\tint algo = hash_algo_by_name(arg);\n+\t\tif (algo == GIT_HASH_UNKNOWN)\n+\t\t\treturn error(_(\"unable to detect hash algorithm\"));\n+\t\theader->hash_algo = &hash_algos[algo];\n+\t\treturn 0;\n+\t}\n+\treturn error(_(\"unknown capability '%s'\"), capability);\n+}\n \n-\talgo = hash_algo_by_length(len / 2);\n-\tif (algo == GIT_HASH_UNKNOWN)\n-\t\treturn NULL;\n-\treturn &hash_algos[algo];\n+static int parse_bundle_signature(struct bundle_header *header, const char *line)\n+{\n+\tint i;\n+\n+\tfor (i = 0; i < ARRAY_SIZE(bundle_sigs); i++) {\n+\t\tif (!strcmp(line, bundle_sigs[i].signature)) {\n+\t\t\theader->version = bundle_sigs[i].version;\n+\t\t\treturn 0;\n+\t\t}\n+\t}\n+\treturn -1;\n }\n \n static int parse_bundle_header(int fd, struct bundle_header *header,\n@@ -42,14 +66,16 @@ static int parse_bundle_header(int fd, struct bundle_header *header,\n \n \t/* The bundle header begins with the signature */\n \tif (strbuf_getwholeline_fd(&buf, fd, '\\n') ||\n-\t    strcmp(buf.buf, bundle_signature)) {\n+\t    parse_bundle_signature(header, buf.buf)) {\n \t\tif (report_path)\n-\t\t\terror(_(\"'%s' does not look like a v2 bundle file\"),\n+\t\t\terror(_(\"'%s' does not look like a v2 or v3 bundle file\"),\n \t\t\t      report_path);\n \t\tstatus = -1;\n \t\tgoto abort;\n \t}\n \n+\theader->hash_algo = the_hash_algo;\n+\n \t/* The bundle header ends with an empty line */\n \twhile (!strbuf_getwholeline_fd(&buf, fd, '\\n') &&\n \t       buf.len && buf.buf[0] != '\\n') {\n@@ -57,21 +83,21 @@ static int parse_bundle_header(int fd, struct bundle_header *header,\n \t\tint is_prereq = 0;\n \t\tconst char *p;\n \n+\t\tif (header->version == 3 && *buf.buf == '@') {\n+\t\t\tbuf.buf[--buf.len] = '\\0';\n+\t\t\tif (parse_capability(header, buf.buf + 1)) {\n+\t\t\t\tstatus = -1;\n+\t\t\t\tbreak;\n+\t\t\t}\n+\t\t\tcontinue;\n+\t\t}\n+\n \t\tif (*buf.buf == '-') {\n \t\t\tis_prereq = 1;\n \t\t\tstrbuf_remove(&buf, 0, 1);\n \t\t}\n \t\tstrbuf_rtrim(&buf);\n \n-\t\tif (!header->hash_algo) {\n-\t\t\theader->hash_algo = detect_hash_algo(&buf);\n-\t\t\tif (!header->hash_algo) {\n-\t\t\t\terror(_(\"unknown hash algorithm length\"));\n-\t\t\t\tstatus = -1;\n-\t\t\t\tbreak;\n-\t\t\t}\n-\t\t}\n-\n \t\t/*\n \t\t * Tip lines have object name, SP, and refname.\n \t\t * Prerequisites have object name that is optionally\n@@ -449,13 +475,14 @@ static int write_bundle_refs(int bundle_fd, struct rev_info *revs)\n }\n \n int create_bundle(struct repository *r, const char *path,\n-\t\t  int argc, const char **argv, struct argv_array *pack_options)\n+\t\t  int argc, const char **argv, struct argv_array *pack_options, int version)\n {\n \tstruct lock_file lock = LOCK_INIT;\n \tint bundle_fd = -1;\n \tint bundle_to_stdout;\n \tint ref_count = 0;\n \tstruct rev_info revs;\n+\tint default_version = the_hash_algo == &hash_algos[GIT_HASH_SHA1] ? 2 : 3;\n \n \tbundle_to_stdout = !strcmp(path, \"-\");\n \tif (bundle_to_stdout)\n@@ -464,8 +491,22 @@ int create_bundle(struct repository *r, const char *path,\n \t\tbundle_fd = hold_lock_file_for_update(&lock, path,\n \t\t\t\t\t\t      LOCK_DIE_ON_ERROR);\n \n-\t/* write signature */\n-\twrite_or_die(bundle_fd, bundle_signature, strlen(bundle_signature));\n+\tif (version == -1)\n+\t\tversion = default_version;\n+\n+\tif (version < 2 || version > 3) {\n+\t\tdie(_(\"unsupported bundle version %d\"), version);\n+\t} else if (version < default_version) {\n+\t\tdie(_(\"cannot write bundle version %d with algorithm %s\"), version, the_hash_algo->name);\n+\t} else if (version == 2) {\n+\t\twrite_or_die(bundle_fd, v2_bundle_signature, strlen(v2_bundle_signature));\n+\t} else {\n+\t\tconst char *capability = \"@object-format=\";\n+\t\twrite_or_die(bundle_fd, v3_bundle_signature, strlen(v3_bundle_signature));\n+\t\twrite_or_die(bundle_fd, capability, strlen(capability));\n+\t\twrite_or_die(bundle_fd, the_hash_algo->name, strlen(the_hash_algo->name));\n+\t\twrite_or_die(bundle_fd, \"\\n\", 1);\n+\t}\n \n \t/* init revs to list objects for pack-objects later */\n \tsave_commit_buffer = 0;\ndiff --git a/bundle.h b/bundle.h\nindex 2dc9442024..70c84cab08 100644\n--- a/bundle.h\n+++ b/bundle.h\n@@ -13,6 +13,7 @@ struct ref_list {\n };\n \n struct bundle_header {\n+\tunsigned version;\n \tstruct ref_list prerequisites;\n \tstruct ref_list references;\n \tconst struct git_hash_algo *hash_algo;\n@@ -21,7 +22,8 @@ struct bundle_header {\n int is_bundle(const char *path, int quiet);\n int read_bundle_header(const char *path, struct bundle_header *header);\n int create_bundle(struct repository *r, const char *path,\n-\t\t  int argc, const char **argv, struct argv_array *pack_options);\n+\t\t  int argc, const char **argv, struct argv_array *pack_options,\n+\t\t  int version);\n int verify_bundle(struct repository *r, struct bundle_header *header, int verbose);\n #define BUNDLE_VERBOSE 1\n int unbundle(struct repository *r, struct bundle_header *header,\ndiff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh\nindex a66dbe0bde..a4988784af 100755\n--- a/t/t5510-fetch.sh\n+++ b/t/t5510-fetch.sh\n@@ -281,15 +281,20 @@ test_expect_success 'create bundle 1' '\n \tcd \"$D\" &&\n \techo >file updated again by origin &&\n \tgit commit -a -m \"tip\" &&\n-\tgit bundle create bundle1 master^..master\n+\tgit bundle create --version=3 bundle1 master^..master\n '\n \n test_expect_success 'header of bundle looks right' '\n \thead -n 4 \"$D\"/bundle1 &&\n-\thead -n 1 \"$D\"/bundle1 | grep \"^#\" &&\n-\thead -n 2 \"$D\"/bundle1 | grep \"^-$OID_REGEX \" &&\n-\thead -n 3 \"$D\"/bundle1 | grep \"^$OID_REGEX \" &&\n-\thead -n 4 \"$D\"/bundle1 | grep \"^$\"\n+\tcat >expect <<-EOF &&\n+\t# v3 git bundle\n+\t@object-format=$(test_oid algo)\n+\t-OID message\n+\tOID message\n+\n+\tEOF\n+\tsed -e \"s/$OID_REGEX .*/OID message/g\" -e \"5q\" \"$D\"/bundle1 >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success 'create bundle 2' '\ndiff --git a/t/t5607-clone-bundle.sh b/t/t5607-clone-bundle.sh\nindex 6d5a977fcb..26985f4b44 100755\n--- a/t/t5607-clone-bundle.sh\n+++ b/t/t5607-clone-bundle.sh\n@@ -4,6 +4,10 @@ test_description='some bundle related tests'\n . ./test-lib.sh\n \n test_expect_success 'setup' '\n+\ttest_oid_cache <<-EOF &&\n+\tversion sha1:2\n+\tversion sha256:3\n+\tEOF\n \ttest_commit initial &&\n \ttest_tick &&\n \tgit tag -m tag tag &&\n@@ -94,4 +98,31 @@ test_expect_success 'fetch SHA-1 from bundle' '\n \tgit fetch --no-tags foo/tip.bundle \"$(cat hash)\"\n '\n \n+test_expect_success 'git bundle uses expected default format' '\n+\tgit bundle create bundle HEAD^.. &&\n+\thead -n1 bundle | grep \"^# v$(test_oid version) git bundle$\"\n+'\n+\n+test_expect_success 'git bundle v3 has expected contents' '\n+\tgit branch side HEAD &&\n+\tgit bundle create --version=3 bundle HEAD^..side &&\n+\thead -n2 bundle >actual &&\n+\tcat >expect <<-EOF &&\n+\t# v3 git bundle\n+\t@object-format=$(test_oid algo)\n+\tEOF\n+\ttest_cmp expect actual &&\n+\tgit bundle verify bundle\n+'\n+\n+test_expect_success 'git bundle v3 rejects unknown capabilities' '\n+\tcat >new <<-EOF &&\n+\t# v3 git bundle\n+\t@object-format=$(test_oid algo)\n+\t@unknown=silly\n+\tEOF\n+\ttest_must_fail git bundle verify new 2>output &&\n+\ttest_i18ngrep \"unknown capability .unknown=silly.\" output\n+'\n+\n test_done\n"},{"id":"402103","messageId":"20200726195424.626969-40-sandals@crustytoothpaste.net","threadId":"53925","inReplyTo":"20200726195424.626969-1-sandals@crustytoothpaste.net","subject":"[PATCH v4 39/39] t: remove test_oid_init in tests","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-26T19:54:24Z","receivedAt":"2020-07-26T19:55:33Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Now that we call test_oid_init in the setup for all test scripts,\nthere's no point in calling it individually.  Remove all of the places\nwhere we've done so to help keep tests tidy.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n t/lib-pack.sh                          | 3 ---\n t/lib-submodule-update.sh              | 1 -\n t/t0000-basic.sh                       | 4 ----\n t/t1006-cat-file.sh                    | 2 --\n t/t1050-large.sh                       | 1 -\n t/t1410-reflog.sh                      | 1 -\n t/t1450-fsck.sh                        | 1 -\n t/t1500-rev-parse.sh                   | 1 -\n t/t3305-notes-fanout.sh                | 1 -\n t/t3308-notes-merge.sh                 | 1 -\n t/t3404-rebase-interactive.sh          | 1 -\n t/t3600-rm.sh                          | 1 -\n t/t3800-mktag.sh                       | 1 -\n t/t4002-diff-basic.sh                  | 2 --\n t/t4027-diff-submodule.sh              | 1 -\n t/t4134-apply-submodule.sh             | 1 -\n t/t4200-rerere.sh                      | 1 -\n t/t4211-line-log.sh                    | 1 -\n t/t5300-pack-object.sh                 | 3 +--\n t/t5302-pack-index.sh                  | 1 -\n t/t5313-pack-bounds-checks.sh          | 1 -\n t/t5318-commit-graph.sh                | 3 +--\n t/t5319-multi-pack-index.sh            | 1 -\n t/t5324-split-commit-graph.sh          | 1 -\n t/t5504-fetch-receive-strict.sh        | 1 -\n t/t5530-upload-pack-error.sh           | 1 -\n t/t5562-http-backend-content-length.sh | 1 -\n t/t5702-protocol-v2.sh                 | 1 -\n t/t5703-upload-pack-ref-in-want.sh     | 1 -\n t/t6006-rev-list-format.sh             | 1 -\n t/t6301-for-each-ref-errors.sh         | 1 -\n t/t6501-freshen-objects.sh             | 4 ----\n t/t7003-filter-branch.sh               | 1 -\n t/t8002-blame.sh                       | 4 ----\n t/t8003-blame-corner-cases.sh          | 2 --\n t/t9301-fast-import-notes.sh           | 1 -\n t/t9350-fast-export.sh                 | 2 --\n 37 files changed, 2 insertions(+), 54 deletions(-)\n\ndiff --git a/t/lib-pack.sh b/t/lib-pack.sh\nindex 0c799d53c6..bb8938ccbe 100644\n--- a/t/lib-pack.sh\n+++ b/t/lib-pack.sh\n@@ -35,8 +35,6 @@ pack_header () {\n # have hardcoded some well-known objects. See the case statements below for the\n # complete list.\n pack_obj () {\n-\ttest_oid_init\n-\n \tcase \"$1\" in\n \t# empty blob\n \t$EMPTY_BLOB)\n@@ -121,7 +119,6 @@ pack_obj () {\n \n # Compute and append pack trailer to \"$1\"\n pack_trailer () {\n-\ttest_oid_init &&\n \ttest-tool $(test_oid algo) -b <\"$1\" >trailer.tmp &&\n \tcat trailer.tmp >>\"$1\" &&\n \trm -f trailer.tmp\ndiff --git a/t/lib-submodule-update.sh b/t/lib-submodule-update.sh\nindex 07c822c8ff..87a759149f 100644\n--- a/t/lib-submodule-update.sh\n+++ b/t/lib-submodule-update.sh\n@@ -196,7 +196,6 @@ test_git_directory_exists () {\n # the submodule repo if it doesn't exist and configures the most problematic\n # settings for diff.ignoreSubmodules.\n prolog () {\n-\ttest_oid_init &&\n \t(test -d submodule_update_repo || create_lib_submodule_repo) &&\n \ttest_config_global diff.ignoreSubmodules all &&\n \ttest_config diff.ignoreSubmodules all\ndiff --git a/t/t0000-basic.sh b/t/t0000-basic.sh\nindex 2599d026a2..362feb43e6 100755\n--- a/t/t0000-basic.sh\n+++ b/t/t0000-basic.sh\n@@ -891,10 +891,6 @@ test_expect_success 'test_atexit is run' \"\n \ttest_path_is_missing also-clean-atexit\n \"\n \n-test_expect_success 'test_oid setup' '\n-\ttest_oid_init\n-'\n-\n test_expect_success 'test_oid provides sane info by default' '\n \ttest_oid zero >actual &&\n \tgrep \"^00*\\$\" actual &&\ndiff --git a/t/t1006-cat-file.sh b/t/t1006-cat-file.sh\nindex 43c4be1e5e..2f501d2dc9 100755\n--- a/t/t1006-cat-file.sh\n+++ b/t/t1006-cat-file.sh\n@@ -140,8 +140,6 @@ test_expect_success '--batch-check without %(rest) considers whole line' '\n \ttest_cmp expect actual\n '\n \n-test_oid_init\n-\n tree_sha1=$(git write-tree)\n tree_size=$(($(test_oid rawsz) + 13))\n tree_pretty_content=\"100644 blob $hello_sha1\thello\"\ndiff --git a/t/t1050-large.sh b/t/t1050-large.sh\nindex 6a56d1ca24..61e89a8071 100755\n--- a/t/t1050-large.sh\n+++ b/t/t1050-large.sh\n@@ -12,7 +12,6 @@ file_size () {\n }\n \n test_expect_success setup '\n-\ttest_oid_init &&\n \t# clone does not allow us to pass core.bigfilethreshold to\n \t# new repos, so set core.bigfilethreshold globally\n \tgit config --global core.bigfilethreshold 200k &&\ndiff --git a/t/t1410-reflog.sh b/t/t1410-reflog.sh\nindex 76d9b744a6..730a43d9dd 100755\n--- a/t/t1410-reflog.sh\n+++ b/t/t1410-reflog.sh\n@@ -54,7 +54,6 @@ check_dont_have () {\n }\n \n test_expect_success setup '\n-\ttest_oid_init &&\n \tmkdir -p A/B &&\n \techo rat >C &&\n \techo ox >A/D &&\ndiff --git a/t/t1450-fsck.sh b/t/t1450-fsck.sh\nindex 344a2aad82..e81f1cbf0e 100755\n--- a/t/t1450-fsck.sh\n+++ b/t/t1450-fsck.sh\n@@ -9,7 +9,6 @@ test_description='git fsck random collection of tests\n . ./test-lib.sh\n \n test_expect_success setup '\n-\ttest_oid_init &&\n \tgit config gc.auto 0 &&\n \tgit config i18n.commitencoding ISO-8859-1 &&\n \ttest_commit A fileA one &&\ndiff --git a/t/t1500-rev-parse.sh b/t/t1500-rev-parse.sh\nindex 603019b541..408b97d5af 100755\n--- a/t/t1500-rev-parse.sh\n+++ b/t/t1500-rev-parse.sh\n@@ -59,7 +59,6 @@ test_rev_parse () {\n ROOT=$(pwd)\n \n test_expect_success 'setup' '\n-\ttest_oid_init &&\n \tmkdir -p sub/dir work &&\n \tcp -R .git repo.git\n '\ndiff --git a/t/t3305-notes-fanout.sh b/t/t3305-notes-fanout.sh\nindex d5a94b7174..94c1b02251 100755\n--- a/t/t3305-notes-fanout.sh\n+++ b/t/t3305-notes-fanout.sh\n@@ -31,7 +31,6 @@ all_notes_have_fanout() {\n }\n \n test_expect_success 'tweak test environment' '\n-\ttest_oid_init &&\n \tgit checkout -b nondeterminism &&\n \ttest_commit A &&\n \tgit checkout --orphan with_notes;\ndiff --git a/t/t3308-notes-merge.sh b/t/t3308-notes-merge.sh\nindex 790e292966..d69c84c640 100755\n--- a/t/t3308-notes-merge.sh\n+++ b/t/t3308-notes-merge.sh\n@@ -22,7 +22,6 @@ test_expect_success setup '\n \t# Copy notes to remote-notes\n \tgit fetch . refs/notes/*:refs/remote-notes/origin/* &&\n \n-\ttest_oid_init &&\n \ttest_oid_cache <<-EOF\n \thash4a sha1:5e93d24084d32e1cb61f7070505b9d2530cca987\n \thash3a sha1:8366731eeee53787d2bdf8fc1eff7d94757e8da0\ndiff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh\nindex 2fb2c581cb..9744e88760 100755\n--- a/t/t3404-rebase-interactive.sh\n+++ b/t/t3404-rebase-interactive.sh\n@@ -30,7 +30,6 @@ Initial setup:\n . \"$TEST_DIRECTORY\"/lib-rebase.sh\n \n test_expect_success 'setup' '\n-\ttest_oid_init &&\n \ttest_commit A file1 &&\n \ttest_commit B file1 &&\n \ttest_commit C file2 &&\ndiff --git a/t/t3600-rm.sh b/t/t3600-rm.sh\nindex f2c0168941..efec8d13b6 100755\n--- a/t/t3600-rm.sh\n+++ b/t/t3600-rm.sh\n@@ -241,7 +241,6 @@ test_expect_success 'refresh index before checking if it is up-to-date' '\n '\n \n test_expect_success 'choking \"git rm\" should not let it die with cruft' '\n-\ttest_oid_init &&\n \tgit reset -q --hard &&\n \ttest_when_finished \"rm -f .git/index.lock && git reset -q --hard\" &&\n \ti=0 &&\ndiff --git a/t/t3800-mktag.sh b/t/t3800-mktag.sh\nindex 64dcc5ec28..d696aa4e52 100755\n--- a/t/t3800-mktag.sh\n+++ b/t/t3800-mktag.sh\n@@ -23,7 +23,6 @@ check_verify_failure () {\n # first create a commit, so we have a valid object/type\n # for the tag.\n test_expect_success 'setup' '\n-\ttest_oid_init &&\n \techo Hello >A &&\n \tgit update-index --add A &&\n \tgit commit -m \"Initial commit\" &&\ndiff --git a/t/t4002-diff-basic.sh b/t/t4002-diff-basic.sh\nindex cbcdd10464..6a9f010197 100755\n--- a/t/t4002-diff-basic.sh\n+++ b/t/t4002-diff-basic.sh\n@@ -10,8 +10,6 @@ test_description='Test diff raw-output.\n \n . \"$TEST_DIRECTORY\"/lib-read-tree-m-3way.sh\n \n-test_oid_init\n-\n test_oid_cache <<\\EOF\n aa_1 sha1:ccba72ad3888a3520b39efcf780b9ee64167535d\n aa_1 sha256:9febfbf18197819b2735c45291f138525d2476d59470f98239647544586ba403\ndiff --git a/t/t4027-diff-submodule.sh b/t/t4027-diff-submodule.sh\nindex e29deaf4a5..d7145ccca4 100755\n--- a/t/t4027-diff-submodule.sh\n+++ b/t/t4027-diff-submodule.sh\n@@ -6,7 +6,6 @@ test_description='difference in submodules'\n . \"$TEST_DIRECTORY\"/diff-lib.sh\n \n test_expect_success setup '\n-\ttest_oid_init &&\n \ttest_tick &&\n \ttest_create_repo sub &&\n \t(\ndiff --git a/t/t4134-apply-submodule.sh b/t/t4134-apply-submodule.sh\nindex 99ed4cc546..d1c16ba33c 100755\n--- a/t/t4134-apply-submodule.sh\n+++ b/t/t4134-apply-submodule.sh\n@@ -8,7 +8,6 @@ test_description='git apply submodule tests'\n . ./test-lib.sh\n \n test_expect_success setup '\n-\ttest_oid_init &&\n \tcat > create-sm.patch <<EOF &&\n diff --git a/dir/sm b/dir/sm\n new file mode 160000\ndiff --git a/t/t4200-rerere.sh b/t/t4200-rerere.sh\nindex 831d424c47..d94d25e4f0 100755\n--- a/t/t4200-rerere.sh\n+++ b/t/t4200-rerere.sh\n@@ -25,7 +25,6 @@ test_description='git rerere\n . ./test-lib.sh\n \n test_expect_success 'setup' '\n-\ttest_oid_init &&\n \tcat >a1 <<-\\EOF &&\n \tSome title\n \t==========\ndiff --git a/t/t4211-line-log.sh b/t/t4211-line-log.sh\nindex e186c83250..2d1d7b5d19 100755\n--- a/t/t4211-line-log.sh\n+++ b/t/t4211-line-log.sh\n@@ -4,7 +4,6 @@ test_description='test log -L'\n . ./test-lib.sh\n \n test_expect_success 'setup (import history)' '\n-\ttest_oid_init &&\n \tgit fast-import < \"$TEST_DIRECTORY\"/t4211/history.export &&\n \tgit reset --hard\n '\ndiff --git a/t/t5300-pack-object.sh b/t/t5300-pack-object.sh\nindex 746cdb626e..cf9f91c941 100755\n--- a/t/t5300-pack-object.sh\n+++ b/t/t5300-pack-object.sh\n@@ -12,8 +12,7 @@ TRASH=$(pwd)\n \n test_expect_success \\\n     'setup' \\\n-    'test_oid_init &&\n-     rm -f .git/index* &&\n+    'rm -f .git/index* &&\n      perl -e \"print \\\"a\\\" x 4096;\" > a &&\n      perl -e \"print \\\"b\\\" x 4096;\" > b &&\n      perl -e \"print \\\"c\\\" x 4096;\" > c &&\ndiff --git a/t/t5302-pack-index.sh b/t/t5302-pack-index.sh\nindex 8981c9b90e..119494bd64 100755\n--- a/t/t5302-pack-index.sh\n+++ b/t/t5302-pack-index.sh\n@@ -7,7 +7,6 @@ test_description='pack index with 64-bit offsets and object CRC'\n . ./test-lib.sh\n \n test_expect_success 'setup' '\n-\ttest_oid_init &&\n \trawsz=$(test_oid rawsz) &&\n \trm -rf .git &&\n \tgit init &&\ndiff --git a/t/t5313-pack-bounds-checks.sh b/t/t5313-pack-bounds-checks.sh\nindex 2a4557efc2..535313e4dc 100755\n--- a/t/t5313-pack-bounds-checks.sh\n+++ b/t/t5313-pack-bounds-checks.sh\n@@ -45,7 +45,6 @@ extended_table () {\n }\n \n test_expect_success 'setup' '\n-\ttest_oid_init &&\n \ttest_oid_cache <<-EOF\n \toid000 sha1:1485\n \toid000 sha256:4222\ndiff --git a/t/t5318-commit-graph.sh b/t/t5318-commit-graph.sh\nindex 26f332d6a3..67f2663c7c 100755\n--- a/t/t5318-commit-graph.sh\n+++ b/t/t5318-commit-graph.sh\n@@ -10,8 +10,7 @@ test_expect_success 'setup full repo' '\n \tcd \"$TRASH_DIRECTORY/full\" &&\n \tgit init &&\n \tgit config core.commitGraph true &&\n-\tobjdir=\".git/objects\" &&\n-\ttest_oid_init\n+\tobjdir=\".git/objects\"\n '\n \n test_expect_success POSIXPERM 'tweak umask for modebit tests' '\ndiff --git a/t/t5319-multi-pack-index.sh b/t/t5319-multi-pack-index.sh\nindex 7214cab36c..7dfff0f8f4 100755\n--- a/t/t5319-multi-pack-index.sh\n+++ b/t/t5319-multi-pack-index.sh\n@@ -29,7 +29,6 @@ midx_read_expect () {\n }\n \n test_expect_success 'setup' '\n-\ttest_oid_init &&\n \ttest_oid_cache <<-EOF\n \tidxoff sha1:2999\n \tidxoff sha256:3739\ndiff --git a/t/t5324-split-commit-graph.sh b/t/t5324-split-commit-graph.sh\nindex 269d0964a3..3a63639fbc 100755\n--- a/t/t5324-split-commit-graph.sh\n+++ b/t/t5324-split-commit-graph.sh\n@@ -12,7 +12,6 @@ test_expect_success 'setup repo' '\n \tgit config gc.writeCommitGraph false &&\n \tinfodir=\".git/objects/info\" &&\n \tgraphdir=\"$infodir/commit-graphs\" &&\n-\ttest_oid_init &&\n \ttest_oid_cache <<-EOM\n \tshallow sha1:1760\n \tshallow sha256:2064\ndiff --git a/t/t5504-fetch-receive-strict.sh b/t/t5504-fetch-receive-strict.sh\nindex a32efe2b6c..1a16ac4c0d 100755\n--- a/t/t5504-fetch-receive-strict.sh\n+++ b/t/t5504-fetch-receive-strict.sh\n@@ -4,7 +4,6 @@ test_description='fetch/receive strict mode'\n . ./test-lib.sh\n \n test_expect_success 'setup and inject \"corrupt or missing\" object' '\n-\ttest_oid_init &&\n \techo hello >greetings &&\n \tgit add greetings &&\n \tgit commit -m greetings &&\ndiff --git a/t/t5530-upload-pack-error.sh b/t/t5530-upload-pack-error.sh\nindex 4ce9a9f704..205a2631e7 100755\n--- a/t/t5530-upload-pack-error.sh\n+++ b/t/t5530-upload-pack-error.sh\n@@ -14,7 +14,6 @@ corrupt_repo () {\n }\n \n test_expect_success 'setup and corrupt repository' '\n-\ttest_oid_init &&\n \techo file >file &&\n \tgit add file &&\n \tgit rev-parse :file &&\ndiff --git a/t/t5562-http-backend-content-length.sh b/t/t5562-http-backend-content-length.sh\nindex c6ec625497..e5d3d15ba8 100755\n--- a/t/t5562-http-backend-content-length.sh\n+++ b/t/t5562-http-backend-content-length.sh\n@@ -46,7 +46,6 @@ ssize_b100dots() {\n }\n \n test_expect_success 'setup' '\n-\ttest_oid_init &&\n \tHTTP_CONTENT_ENCODING=\"identity\" &&\n \texport HTTP_CONTENT_ENCODING &&\n \tgit config http.receivepack true &&\ndiff --git a/t/t5702-protocol-v2.sh b/t/t5702-protocol-v2.sh\nindex 7fc22171e7..5a60fbe3ed 100755\n--- a/t/t5702-protocol-v2.sh\n+++ b/t/t5702-protocol-v2.sh\n@@ -13,7 +13,6 @@ start_git_daemon --export-all --enable=receive-pack\n daemon_parent=$GIT_DAEMON_DOCUMENT_ROOT_PATH/parent\n \n test_expect_success 'create repo to be served by git-daemon' '\n-\ttest_oid_init &&\n \tgit init \"$daemon_parent\" &&\n \ttest_commit -C \"$daemon_parent\" one\n '\ndiff --git a/t/t5703-upload-pack-ref-in-want.sh b/t/t5703-upload-pack-ref-in-want.sh\nindex 748282f058..d9ecf0f4a9 100755\n--- a/t/t5703-upload-pack-ref-in-want.sh\n+++ b/t/t5703-upload-pack-ref-in-want.sh\n@@ -43,7 +43,6 @@ write_command () {\n #             \\ | /\n #               a\n test_expect_success 'setup repository' '\n-\ttest_oid_init &&\n \ttest_commit a &&\n \tgit checkout -b o/foo &&\n \ttest_commit b &&\ndiff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh\nindex 7e82e43a63..bc95da8a5f 100755\n--- a/t/t6006-rev-list-format.sh\n+++ b/t/t6006-rev-list-format.sh\n@@ -32,7 +32,6 @@ changed_iso88591=$(echo \"$changed\" | iconv -f utf-8 -t $test_encoding)\n truncate_count=20\n \n test_expect_success 'setup' '\n-\ttest_oid_init &&\n \t: >foo &&\n \tgit add foo &&\n \tgit config i18n.commitEncoding $test_encoding &&\ndiff --git a/t/t6301-for-each-ref-errors.sh b/t/t6301-for-each-ref-errors.sh\nindex d545a725a5..809854fc0c 100755\n--- a/t/t6301-for-each-ref-errors.sh\n+++ b/t/t6301-for-each-ref-errors.sh\n@@ -7,7 +7,6 @@ test_description='for-each-ref errors for broken refs'\n ZEROS=$ZERO_OID\n \n test_expect_success setup '\n-\ttest_oid_init &&\n \tMISSING=$(test_oid deadbeef) &&\n \tgit commit --allow-empty -m \"Initial\" &&\n \tgit tag testtag &&\ndiff --git a/t/t6501-freshen-objects.sh b/t/t6501-freshen-objects.sh\nindex 7416ed5ffe..8a3bb4105b 100755\n--- a/t/t6501-freshen-objects.sh\n+++ b/t/t6501-freshen-objects.sh\n@@ -45,10 +45,6 @@ maybe_repack () {\n \tfi\n }\n \n-test_expect_success 'setup' '\n-\ttest_oid_init\n-'\n-\n for repack in '' true; do\n \ttitle=${repack:+repack}\n \ttitle=${title:-loose}\ndiff --git a/t/t7003-filter-branch.sh b/t/t7003-filter-branch.sh\nindex beeb2b855a..36477cb1f4 100755\n--- a/t/t7003-filter-branch.sh\n+++ b/t/t7003-filter-branch.sh\n@@ -5,7 +5,6 @@ test_description='git filter-branch'\n . \"$TEST_DIRECTORY/lib-gpg.sh\"\n \n test_expect_success 'setup' '\n-\ttest_oid_init &&\n \ttest_commit A &&\n \tGIT_COMMITTER_DATE=\"@0 +0000\" GIT_AUTHOR_DATE=\"@0 +0000\" &&\n \ttest_commit --notick B &&\ndiff --git a/t/t8002-blame.sh b/t/t8002-blame.sh\nindex 557c886559..aed4a923a3 100755\n--- a/t/t8002-blame.sh\n+++ b/t/t8002-blame.sh\n@@ -6,10 +6,6 @@ test_description='git blame'\n PROG='git blame -c'\n . \"$TEST_DIRECTORY\"/annotate-tests.sh\n \n-test_expect_success 'setup' '\n-\ttest_oid_init\n-'\n-\n test_expect_success 'blame untracked file in empty repo' '\n \t>untracked &&\n \ttest_must_fail git blame untracked\ndiff --git a/t/t8003-blame-corner-cases.sh b/t/t8003-blame-corner-cases.sh\nindex ebe79aa4ea..b871dd4f86 100755\n--- a/t/t8003-blame-corner-cases.sh\n+++ b/t/t8003-blame-corner-cases.sh\n@@ -6,8 +6,6 @@ test_description='git blame corner cases'\n pick_fc='s/^[0-9a-f^]* *\\([^ ]*\\) *(\\([^ ]*\\) .*/\\1-\\2/'\n \n test_expect_success setup '\n-\ttest_oid_init &&\n-\n \techo A A A A A >one &&\n \techo B B B B B >two &&\n \techo C C C C C >tres &&\ndiff --git a/t/t9301-fast-import-notes.sh b/t/t9301-fast-import-notes.sh\nindex 9d1aaac980..ff3338abc0 100755\n--- a/t/t9301-fast-import-notes.sh\n+++ b/t/t9301-fast-import-notes.sh\n@@ -71,7 +71,6 @@ EOF\n INPUT_END\n \n test_expect_success 'set up master branch' '\n-\ttest_oid_init &&\n \tgit fast-import <input &&\n \tgit whatchanged master\n '\ndiff --git a/t/t9350-fast-export.sh b/t/t9350-fast-export.sh\nindex ba79db6a17..210b9bc4b6 100755\n--- a/t/t9350-fast-export.sh\n+++ b/t/t9350-fast-export.sh\n@@ -7,8 +7,6 @@ test_description='git fast-export'\n . ./test-lib.sh\n \n test_expect_success 'setup' '\n-\ttest_oid_init &&\n-\n \techo break it > file0 &&\n \tgit add file0 &&\n \ttest_tick &&\n"},{"id":"402105","messageId":"CAPig+cRUj2RGz1=+3EDr5G_Mq2sXPnztCr-iPDGH+WycQ2iwjA@mail.gmail.com","threadId":"53925","inReplyTo":"20200726195424.626969-31-sandals@crustytoothpaste.net","subject":"Re: [PATCH v4 30/39] builtin/verify-pack: implement an --object-format option","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2020-07-26T21:29:46Z","receivedAt":"2020-07-26T21:30:01Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Sun, Jul 26, 2020 at 3:56 PM brian m. carlson\n<sandals@crustytoothpaste.net> wrote:\n> A recently added test in t5702 started using git verify-pack outside of\n> a repository.  While this poses no problems with SHA-1, with SHA-256 we\n> implicitly rely on the setup of the repository to initialize our hash\n> algorithm settings.\n>\n> Since we're not in a repository here, we need to provide git verify-pack\n> help to set things up properly.  git index-pack already knows an\n> --object-format option, so let's accept one as well and pass it down to\n> our git index-pack invocation.  Since we're now dynamically adjusting\n> the elements in argv, let's switch to using struct argv_array to manage\n> them.  Finally, let's make t5702 pass the proper argument on down to its\n> git verify-pack caller.\n\nA few comments below... use your own judgment as to whether they are\nworth a re-roll.\n\n> Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n> ---\n> diff --git a/builtin/verify-pack.c b/builtin/verify-pack.c\n> @@ -7,21 +7,28 @@\n> +static int verify_one_pack(const char *path, unsigned int flags, const char *hash_algo)\n>  {\n> +       struct argv_array argv = ARGV_ARRAY_INIT;\n> +       struct strbuf arg = STRBUF_INIT, hash_arg = STRBUF_INIT;\n>\n> +       if (hash_algo) {\n> +               strbuf_addf(&hash_arg, \"--object-format=%s\", hash_algo);\n> +               argv_array_push(&argv, hash_arg.buf);\n> +       }\n\nRather than bothering with a separate strbuf, this would be easier:\n\n    argv_array_pushf(&argv, \"--object-format=%s\", hash_algo);\n\nDoing so would also fix a secondary problem that 'hash_arg' is being leaked.\n\n> @@ -31,9 +38,9 @@ static int verify_one_pack(const char *path, unsigned int flags)\n> -       index_pack.argv = argv;\n> +       index_pack.argv = argv.argv;\n\n'struct child_process' already has an 'args' member which is a 'struct\nargv_array' of which you can take advantage instead of creating your\nown local 'argv' in this function. run_command() automatically clears\nthe built-in 'argv_array', which frees you the effort of having to do\nso manually.\n\n>         err = run_command(&index_pack);\n> @@ -47,6 +54,7 @@ static int verify_one_pack(const char *path, unsigned int flags)\n>         strbuf_release(&arg);\n> +       argv_array_clear(&argv);\n\nThis is where 'hash_arg' is being linked. This is also where you could\neliminate the call to argv_array_clear() if you take advantage of the\n'argv_array' already provided by 'child_process'.\n"},{"id":"402107","messageId":"CAPig+cR+e9XGNCgtDMHUsaAgbKDi=-bztwtd64fVZj7S05ppKQ@mail.gmail.com","threadId":"53925","inReplyTo":"20200726195424.626969-32-sandals@crustytoothpaste.net","subject":"Re: [PATCH v4 31/39] bundle: add new version for use with SHA-256","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2020-07-26T22:18:23Z","receivedAt":"2020-07-26T22:18:38Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Sun, Jul 26, 2020 at 3:56 PM brian m. carlson\n<sandals@crustytoothpaste.net> wrote:\n> [...]\n> Since we cannot extend the v2 format in a backward-compatible way, let's\n> add a v3 format, which is identical, except for the addition of\n> capabilities, which are prefixed by an at sign.  We add \"object-format\"\n> as the only capability and reject unknown capabilities, since we do not\n> have a network connection and therefore cannot negotiate with the other\n> side.\n> [...]\n> Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n> ---\n> diff --git a/bundle.c b/bundle.c\n> @@ -23,15 +32,30 @@ static void add_to_ref_list(const struct object_id *oid, const char *name,\n> +static int parse_capability(struct bundle_header *header, const char *capability)\n>  {\n> +       const char *arg;\n> +       if (skip_prefix(capability, \"object-format=\", &arg)) {\n> +               int algo = hash_algo_by_name(arg);\n> +               if (algo == GIT_HASH_UNKNOWN)\n> +                       return error(_(\"unable to detect hash algorithm\"));\n\nThis error message would be more helpful if it provided more context,\nsuch as the name it tried looking up. For instance:\n\n    return error(_(\"unrecognized bundle header hash algorithm: \"\n        \"@object-format=%s\"), arg);\n\nor something.\n\n> @@ -57,21 +83,21 @@ static int parse_bundle_header(int fd, struct bundle_header *header,\n> +               if (header->version == 3 && *buf.buf == '@') {\n> +                       buf.buf[--buf.len] = '\\0';\n\nThe reader has to think through this unconditional NUL-termination\nmore carefully than would be the case if...\n\n> +                       if (parse_capability(header, buf.buf + 1)) {\n> +                               status = -1;\n> +                               break;\n> +                       }\n> +                       continue;\n> +               }\n> +\n>                 if (*buf.buf == '-') {\n>                         is_prereq = 1;\n>                         strbuf_remove(&buf, 0, 1);\n>                 }\n>                 strbuf_rtrim(&buf);\n\n... you just moved this strbuf_rtrim() call above the capability check\nconditional.\n\n> @@ -449,13 +475,14 @@ static int write_bundle_refs(int bundle_fd, struct rev_info *revs)\n> +       int default_version = the_hash_algo == &hash_algos[GIT_HASH_SHA1] ? 2 : 3;\n> @@ -464,8 +491,22 @@ int create_bundle(struct repository *r, const char *path,\n> +       if (version == -1)\n> +               version = default_version;\n> +\n> +       if (version < 2 || version > 3) {\n> +               die(_(\"unsupported bundle version %d\"), version);\n> +       } else if (version < default_version) {\n> +               die(_(\"cannot write bundle version %d with algorithm %s\"), version, the_hash_algo->name);\n\nThis conditional will become fragile when bundle version v4 is\nintroduced and the git-bundle invocation somehow triggers v4 to be\nassigned to 'default_version', in which case:\n\n    git bundle --version=3 ...\n\nwill complain:\n\n    cannot write bundle version 3 with algorithm sha256\n\nwhich is clearly wrong and misleading.\n\n> diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh\n> @@ -281,15 +281,20 @@ test_expect_success 'create bundle 1' '\n>  test_expect_success 'header of bundle looks right' '\n>         head -n 4 \"$D\"/bundle1 &&\n> -       head -n 1 \"$D\"/bundle1 | grep \"^#\" &&\n> -       head -n 2 \"$D\"/bundle1 | grep \"^-$OID_REGEX \" &&\n> -       head -n 3 \"$D\"/bundle1 | grep \"^$OID_REGEX \" &&\n> -       head -n 4 \"$D\"/bundle1 | grep \"^$\"\n\nDo you still need the \"head -n 4 ... &&\" check at the very top of this\nlist? Is that providing something that we don't get from the new code\nwhich uses test_cmp with 'expect' and 'actual' files?\n\n> +       cat >expect <<-EOF &&\n> +       # v3 git bundle\n> +       @object-format=$(test_oid algo)\n> +       -OID message\n> +       OID message\n> +\n> +       EOF\n> +       sed -e \"s/$OID_REGEX .*/OID message/g\" -e \"5q\" \"$D\"/bundle1 >actual &&\n\nIn my earlier review when I suggested using an \"expect\" file and\nconverting the object ID to some literal string such as \"OID\", the\nexample I gave did indeed also use literal \"message\", though my use of\n\"message\" was meant as a placeholder that you would fill in with the\nreal values, like this:\n\n    -OID updated by origin\n    OID refs/heads/master\n\nI probably should have been clearer about \"message\" being a\nplaceholder (since I was too lazy to look up the actual values). I\nsuppose the generic \"message\" you use here is no worse than the\noriginal code with its 'grep' invocations which didn't care about the\nmessage either. It makes me a bit uncomfortable for the test to\nunnecessarily be loose like this when it doesn't have to be, but it's\nnot necessarily worth a re-roll.\n"},{"id":"402108","messageId":"CAPig+cS0Ap_47w+cqVipe8yD902YRO+AYStrn7mHOJQCnXuLcw@mail.gmail.com","threadId":"53925","inReplyTo":"20200726195424.626969-5-sandals@crustytoothpaste.net","subject":"Re: [PATCH v4 04/39] t3404: prepare 'short SHA-1 collision' tests for SHA-256","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2020-07-26T22:31:38Z","receivedAt":"2020-07-26T22:31:52Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Sun, Jul 26, 2020 at 3:55 PM brian m. carlson\n<sandals@crustytoothpaste.net> wrote:\n> The idea of the magic value \"ac4f2ee\" in this test is to make the\n> reworded commit `collide2` have the same shortened ID as the commit\n> `collide3`.\n>\n> To port the same idea to the SHA-256 version of Git, we therefore need\n> another magic value that causes the same collision, but this time with\n> the SHA-256 version of the commit IDs.\n>\n> In this patch, we add code guarded by `GIT_TEST_FIND_COLLIDER` to do\n> exactly that. Essentially, a large number of integers is appended to the\n> commit message \"collide2\" to find such a collision. To make it easier to\n> find such a collision, we reduce the number of digits to 4.\n>\n> The `t/oid-info/oid` file now lists the values found in that way, and\n> the test cases are modified to use those values.\n\nThis seems to be saying that t/oid-info/oid has been updated to\ncontain the colliding OID's generated for this test, however, those\nOID's are actually specified inline in the test itself (which is the\nappropriate place for them since they are specific to this test). So,\nthis paragraph/sentence probably ought to be dropped.\n\n> As the tests are no longer dependent on SHA-1, we also rename their\n> titles to talk about \"commit IDs\" instead of \"SHA-1s\".\n>\n> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n> Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n> ---\n> diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh\n> @@ -1262,23 +1263,54 @@ test_expect_success SHA1 'short SHA-1 setup' '\n> +test_expect_success 'short commit ID collide' '\n> +       test_oid_cache <<-EOF &&\n> +       # collision-related constants\n> +       t3404_collision sha1:6bcd\n> +       t3404_collision sha256:0161\n> +       t3404_collider  sha1:ac4f2ee\n> +       t3404_collider  sha256:16697\n> +       EOF\n"},{"id":"402109","messageId":"CAPig+cRU_6pMiPxW6sJd5E9_EuwXEroavL4uXScsuS-v4T__iQ@mail.gmail.com","threadId":"53925","inReplyTo":"20200726195424.626969-12-sandals@crustytoothpaste.net","subject":"Re: [PATCH v4 11/39] t7063: make hash size independent","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2020-07-26T22:40:11Z","receivedAt":"2020-07-26T22:40:24Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Sun, Jul 26, 2020 at 3:55 PM brian m. carlson\n<sandals@crustytoothpaste.net> wrote:\n> Use test_oid instead of hard-coding a fixed size all-zeros object ID.\n\nThis patch is doing more than replacing all-zero OID's. Perhaps say instead:\n\n    Use test_oid instead of hard-coding SHA-1-specific OID's.\n\nor something.\n\n> Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n> ---\n> diff --git a/t/t7063-status-untracked-cache.sh b/t/t7063-status-untracked-cache.sh\n> @@ -695,6 +705,7 @@ test_expect_success 'using --untracked-cache does not fail when core.untrackedCa\n>  test_expect_success 'setting core.untrackedCache to keep' '\n> +       touch ../expect-from-test-dump &&\n\nThis change seems unrelated to all other changes in this patch.\n"},{"id":"402111","messageId":"CAPig+cT27QQgQcq87DErR07h-p_w2q-EqDPNhGJC54=hutMPhg@mail.gmail.com","threadId":"53925","inReplyTo":"20200726195424.626969-19-sandals@crustytoothpaste.net","subject":"Re: [PATCH v4 18/39] t8002: make hash size independent","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2020-07-26T22:49:58Z","receivedAt":"2020-07-26T22:50:12Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Sun, Jul 26, 2020 at 3:55 PM brian m. carlson\n<sandals@crustytoothpaste.net> wrote:\n> Compute the length of an object ID instead of of hard-coding 40-based\n\ns/of of /of/\n\n> values.\n>\n> Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n> ---\n> diff --git a/t/t8002-blame.sh b/t/t8002-blame.sh\n> @@ -6,6 +6,10 @@ test_description='git blame'\n> +test_expect_success 'setup' '\n> +       test_oid_init\n> +'\n> +\n> @@ -105,17 +109,18 @@ test_expect_success 'blame --abbrev=<n> works' '\n>  test_expect_success 'blame -l aligns regular and boundary commits' '\n> +       hexsz=$(test_oid hexsz) &&\n> +       check_abbrev $hexsz         -l HEAD &&\n> +       check_abbrev $((hexsz - 1)) -l ^HEAD\n>  '\n> +test_expect_success 'blame --abbrev with full length behaves like -l' '\n> +       check_abbrev $hexsz         --abbrev=$hexsz HEAD &&\n> +       check_abbrev $((hexsz - 1)) --abbrev=$hexsz ^HEAD\n>  '\n\nRather than assigning 'hexsz' in the first test which needs the value\nand then re-using the value in subsequent tests, how about assigning\n'hexsz' in the new \"setup\" test? This will make it easier to run\nindividual tests while skipping others.\n"},{"id":"402110","messageId":"CAPig+cQcK9t6fo7xZc03VCpdSfVmP+5NKjZgvshkLP74B6-ysQ@mail.gmail.com","threadId":"53925","inReplyTo":"20200726195424.626969-13-sandals@crustytoothpaste.net","subject":"Re: [PATCH v4 12/39] t7201: abstract away SHA-1-specific constants","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2020-07-26T22:54:10Z","receivedAt":"2020-07-26T22:54:25Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Sun, Jul 26, 2020 at 3:55 PM brian m. carlson\n<sandals@crustytoothpaste.net> wrote:\n> Adjust the test so that it computes variables for object IDs instead of\n> using hard-coded hashes.\n>\n> Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n> ---\n> diff --git a/t/t7201-co.sh b/t/t7201-co.sh\n> @@ -230,9 +230,10 @@ test_expect_success 'switch to another branch while carrying a deletion' '\n>  test_expect_success 'checkout to detach HEAD (with advice declined)' '\n>         git config advice.detachedHead false &&\n> +       rev=$(git rev-parse --short renamer^) &&\n>         git checkout -f renamer && git clean -f &&\n>         git checkout renamer^ 2>messages &&\n> -       test_i18ngrep \"HEAD is now at 7329388\" messages &&\n> +       test_i18ngrep \"HEAD is now at $rev\" messages &&\n\nThis test computes (and uses) the value 'rev'...\n\n> @@ -250,7 +251,7 @@ test_expect_success 'checkout to detach HEAD' '\n>         GIT_TEST_GETTEXT_POISON=false git checkout renamer^ 2>messages &&\n> -       grep \"HEAD is now at 7329388\" messages &&\n> +       grep \"HEAD is now at $rev\" messages &&\n\n... and then this separate test re-uses that value, which\nunnecessarily couples these tests tightly. How about instead just\nre-computing the value of 'rev' in the second test, which will make it\neasier to run individual tests while skipping others.\n"},{"id":"402112","messageId":"20200726225629.GC6540@camp.crustytoothpaste.net","threadId":"53925","inReplyTo":"CAPig+cRUj2RGz1=+3EDr5G_Mq2sXPnztCr-iPDGH+WycQ2iwjA@mail.gmail.com","subject":"Re: [PATCH v4 30/39] builtin/verify-pack: implement an --object-format option","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-26T22:56:29Z","receivedAt":"2020-07-26T22:56:37Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On 2020-07-26 at 21:29:46, Eric Sunshine wrote:\n> On Sun, Jul 26, 2020 at 3:56 PM brian m. carlson\n> A few comments below... use your own judgment as to whether they are\n> worth a re-roll.\n\nI'll do a re-roll, since I think there's enough issues that one would be\nworthwhile.\n\n> > Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n> > ---\n> > diff --git a/builtin/verify-pack.c b/builtin/verify-pack.c\n> > @@ -7,21 +7,28 @@\n> > +static int verify_one_pack(const char *path, unsigned int flags, const char *hash_algo)\n> >  {\n> > +       struct argv_array argv = ARGV_ARRAY_INIT;\n> > +       struct strbuf arg = STRBUF_INIT, hash_arg = STRBUF_INIT;\n> >\n> > +       if (hash_algo) {\n> > +               strbuf_addf(&hash_arg, \"--object-format=%s\", hash_algo);\n> > +               argv_array_push(&argv, hash_arg.buf);\n> > +       }\n> \n> Rather than bothering with a separate strbuf, this would be easier:\n> \n>     argv_array_pushf(&argv, \"--object-format=%s\", hash_algo);\n> \n> Doing so would also fix a secondary problem that 'hash_arg' is being leaked.\n\nThis is a great idea.\n\n> > @@ -31,9 +38,9 @@ static int verify_one_pack(const char *path, unsigned int flags)\n> > -       index_pack.argv = argv;\n> > +       index_pack.argv = argv.argv;\n> \n> 'struct child_process' already has an 'args' member which is a 'struct\n> argv_array' of which you can take advantage instead of creating your\n> own local 'argv' in this function. run_command() automatically clears\n> the built-in 'argv_array', which frees you the effort of having to do\n> so manually.\n\nGreat, I'll switch to that.\n-- \nbrian m. carlson: Houston, Texas, US\n"},{"id":"402113","messageId":"20200726225910.GD6540@camp.crustytoothpaste.net","threadId":"53925","inReplyTo":"CAPig+cR+e9XGNCgtDMHUsaAgbKDi=-bztwtd64fVZj7S05ppKQ@mail.gmail.com","subject":"Re: [PATCH v4 31/39] bundle: add new version for use with SHA-256","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-26T22:59:10Z","receivedAt":"2020-07-26T22:59:47Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On 2020-07-26 at 22:18:23, Eric Sunshine wrote:\n> This error message would be more helpful if it provided more context,\n> such as the name it tried looking up. For instance:\n> \n>     return error(_(\"unrecognized bundle header hash algorithm: \"\n>         \"@object-format=%s\"), arg);\n> \n> or something.\n\nI've improved it somewhat.\n\n> The reader has to think through this unconditional NUL-termination\n> more carefully than would be the case if...\n> ... you just moved this strbuf_rtrim() call above the capability check\n> conditional.\n\nThat is indeed much easier.\n\n> \n> This conditional will become fragile when bundle version v4 is\n> introduced and the git-bundle invocation somehow triggers v4 to be\n> assigned to 'default_version', in which case:\n> \n>     git bundle --version=3 ...\n> \n> will complain:\n> \n>     cannot write bundle version 3 with algorithm sha256\n> \n> which is clearly wrong and misleading.\n\nI've changed this variable to min_version.  There is one place we use it\nas the default, but I think it's easy to change that if we want it to be\nsomething different in the future, and all the rest of the uses are of a\nminimum version.\n\n> Do you still need the \"head -n 4 ... &&\" check at the very top of this\n> list? Is that providing something that we don't get from the new code\n> which uses test_cmp with 'expect' and 'actual' files?\n\nRemoved.\n\n> In my earlier review when I suggested using an \"expect\" file and\n> converting the object ID to some literal string such as \"OID\", the\n> example I gave did indeed also use literal \"message\", though my use of\n> \"message\" was meant as a placeholder that you would fill in with the\n> real values, like this:\n> \n>     -OID updated by origin\n>     OID refs/heads/master\n> \n> I probably should have been clearer about \"message\" being a\n> placeholder (since I was too lazy to look up the actual values). I\n> suppose the generic \"message\" you use here is no worse than the\n> original code with its 'grep' invocations which didn't care about the\n> message either. It makes me a bit uncomfortable for the test to\n> unnecessarily be loose like this when it doesn't have to be, but it's\n> not necessarily worth a re-roll.\n\nFixed.\n-- \nbrian m. carlson: Houston, Texas, US\n"},{"id":"402114","messageId":"CAPig+cTwj7PXk3Uejf=UznfFSNTCbGWLtKE2PesbvMZ-c+VDgQ@mail.gmail.com","threadId":"53925","inReplyTo":"20200726195424.626969-21-sandals@crustytoothpaste.net","subject":"Re: [PATCH v4 20/39] t8011: make hash size independent","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2020-07-26T23:00:06Z","receivedAt":"2020-07-26T23:00:20Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Sun, Jul 26, 2020 at 3:55 PM brian m. carlson\n<sandals@crustytoothpaste.net> wrote:\n> Allow lines which start with either a 40- or 64-character hex object ID,\n> to allow for both SHA-1 and SHA-256.\n>\n> Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n> ---\n> diff --git a/t/t8011-blame-split-file.sh b/t/t8011-blame-split-file.sh\n> @@ -54,7 +54,7 @@ test_expect_success 'setup simulated porcelain' '\n>         while (<>) {\n> -               if (/^[0-9a-f]{40} /) {\n> +               if (/^[0-9a-f]{40,64} /) {\n\nAlthough this helps the current cases of SHA-1 and SHA-256, it doesn't\nnecessarily help people experimenting with other hash algorithms. I\nwonder if it makes sense to loosen it a bit to simply look for\nsomething that is likely to be an OID. Perhaps like this:\n\n    if (/^[0-9a-f]{40,} /) {\n"},{"id":"402115","messageId":"CAPig+cRfvEa72_L5UFwSngWE7TNd9jWYEE2e_8bDOYQe3sSMfw@mail.gmail.com","threadId":"53925","inReplyTo":"20200726195424.626969-22-sandals@crustytoothpaste.net","subject":"Re: [PATCH v4 21/39] t9300: abstract away SHA-1-specific constants","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2020-07-26T23:14:44Z","receivedAt":"2020-07-26T23:14:58Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Sun, Jul 26, 2020 at 3:55 PM brian m. carlson\n<sandals@crustytoothpaste.net> wrote:\n> Adjust the test so that it computes variables for object IDs instead of\n> using hard-coded hashes.\n>\n> Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n> ---\n> diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\n> @@ -285,7 +285,7 @@ test_expect_success 'A: verify pack' '\n>  test_expect_success 'A: verify diff' '\n>         cat >expect <<-EOF &&\n> -       :000000 100755 0000000000000000000000000000000000000000 7123f7f44e39be127c5eb701e5968176ee9d78b1 A      copy-of-file2\n> +       :000000 100755 0000000000000000000000000000000000000000 $(git rev-parse --verify master:file2) A        copy-of-file2\n>         EOF\n\nThe other changes in this patch all use a variable to hold the\ncomputed OID rather than computing it inline inside the here-doc as is\ndone here. By assigning it to a variable, a failure of git-rev-parse\nwill be caught, whereas it won't necessarily be caught failing inside\nthe here-doc if it happens to produce the correct output before\ncrashing. Not necessarily worth a re-roll on its own, but maybe worth\ndoing if you are re-rolling (and would save Denton the effort of\ntackling it instead).\n\n> @@ -935,14 +940,15 @@ test_expect_success 'L: verify internal tree sorting' '\n> -       test_cmp expect output\n> +       cut -d\" \" -f1,2,5 output >actual &&\n> +       test_cmp expect actual\n\nThis change is different from all the other changes in this patch. If\nyou're re-rolling anyhow, perhaps generalize the commit message a bit\nto account for it.\n"},{"id":"402116","messageId":"CAPig+cR4G5czLgAo=H-+HXOye+qCLmtUcE9-DKoh=+yptMitPw@mail.gmail.com","threadId":"53925","inReplyTo":"20200726195424.626969-30-sandals@crustytoothpaste.net","subject":"Re: [PATCH v4 29/39] http-fetch: set up git directory before parsing pack hashes","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2020-07-26T23:28:28Z","receivedAt":"2020-07-26T23:28:42Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Sun, Jul 26, 2020 at 3:56 PM brian m. carlson\n<sandals@crustytoothpaste.net> wrote:\n> In dd4b732df7 (\"upload-pack: send part of packfile response as uri\",\n> 2020-06-10), the git http-fetch code learned how to take  ac --packfile\n\ns/take\\s+ac/take a/\n\n> option.  This option takes an argument, which is the name of a packfile\n> hash, and parses it using parse_oid_hex.  It does so before calling\n> setup_git_directory.\n>\n> However, in a SHA-256 repository this fails to work, since we have not\n> set the hash algorithm in use and parse_oid_hex fails as a consequence.\n> To ensure that we can parse packfile hashes of the right length, let's\n> set up the git directory before we start parsing arguments.\n> ---\n\nMissing sign-off.\n\n> diff --git a/http-fetch.c b/http-fetch.c\n> @@ -86,6 +86,8 @@ int cmd_main(int argc, const char **argv)\n> +       setup_git_directory();\n> +\n>         while (arg < argc && argv[arg][0] == '-') {\n>                 const char *p;\n> @@ -115,8 +117,6 @@ int cmd_main(int argc, const char **argv)\n>         if (argc != arg + 2 - (commits_on_stdin || packfile))\n>                 usage(http_fetch_usage);\n>\n> -       setup_git_directory();\n\nThis change has the unfortunate side-effect that \"git http-fetch -h\"\nwill no longer work if setup_git_directory() fails, which could easily\nbe the case if the user is trying to get help for the command from\nsome arbitrary location in the filesystem.\n\nIt might be better to setup_git_directory() on-demand when it's needed\nby --packfile= rather than doing it unconditionally before the\nargument-parsing loop.\n"},{"id":"402117","messageId":"CAPig+cTSxGC8ipo_NAByuiSzsV2kJAa_R1W34g2PP0+ZacH6Dw@mail.gmail.com","threadId":"53925","inReplyTo":"CAPig+cR4G5czLgAo=H-+HXOye+qCLmtUcE9-DKoh=+yptMitPw@mail.gmail.com","subject":"Re: [PATCH v4 29/39] http-fetch: set up git directory before parsing pack hashes","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2020-07-26T23:30:22Z","receivedAt":"2020-07-26T23:30:35Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Sun, Jul 26, 2020 at 7:28 PM Eric Sunshine <sunshine@sunshineco.com> wrote:\n> This change has the unfortunate side-effect that \"git http-fetch -h\"\n> will no longer work if setup_git_directory() fails, which could easily\n> be the case if the user is trying to get help for the command from\n> some arbitrary location in the filesystem.\n>\n> It might be better to setup_git_directory() on-demand when it's needed\n> by --packfile= rather than doing it unconditionally before the\n> argument-parsing loop.\n\nBetter yet, use setup_git_directory_gently() before entering the\nargument-parsing loop.\n"},{"id":"402118","messageId":"CAPig+cSaqwwtOitm3_3kF+q9TaputNAnz78qBb-7PfrZcqUDVg@mail.gmail.com","threadId":"53925","inReplyTo":"20200726195424.626969-33-sandals@crustytoothpaste.net","subject":"Re: [PATCH v4 32/39] setup: add support for reading extensions.objectformat","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2020-07-26T23:34:23Z","receivedAt":"2020-07-26T23:34:37Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Sun, Jul 26, 2020 at 3:56 PM brian m. carlson\n<sandals@crustytoothpaste.net> wrote:\n> The transition plan specifies extensions.objectFormat as the indication\n> that we're using a given hash in a certain repo.  Read this as one of\n> the extensions we support.  If the user has specified an invalid value,\n> fail.\n>\n> Ensure that we reject the extension if the repository format version is\n> 0.\n>\n> Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n> ---\n> diff --git a/setup.c b/setup.c\n> @@ -470,7 +470,16 @@ static int check_repo_format(const char *var, const char *value, void *vdata)\n> +               else if (!strcmp(ext, \"objectformat\")) {\n> +                       int format;\n> +\n> +                       if (!value)\n> +                               return config_error_nonbool(var);\n> +                       format = hash_algo_by_name(value);\n> +                       if (format == GIT_HASH_UNKNOWN)\n> +                               return error(\"invalid value for 'extensions.objectformat'\");\n\nNot necessarily worth a re-roll, but this error message could be more\nhelpful by providing additional context:\n\n    return error(\"invalid value for extensions.objectFormat: %s\", value);\n\nNotice I also capitalized \"Format\" since this is a user-facing message.\n\nAlso, should this message be localizable _(...)?\n"},{"id":"402119","messageId":"20200726234135.GE6540@camp.crustytoothpaste.net","threadId":"53925","inReplyTo":"CAPig+cSaqwwtOitm3_3kF+q9TaputNAnz78qBb-7PfrZcqUDVg@mail.gmail.com","subject":"Re: [PATCH v4 32/39] setup: add support for reading extensions.objectformat","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-26T23:41:35Z","receivedAt":"2020-07-26T23:41:42Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On 2020-07-26 at 23:34:23, Eric Sunshine wrote:\n> Not necessarily worth a re-roll, but this error message could be more\n> helpful by providing additional context:\n> \n>     return error(\"invalid value for extensions.objectFormat: %s\", value);\n> \n> Notice I also capitalized \"Format\" since this is a user-facing message.\n> \n> Also, should this message be localizable _(...)?\n\nThis message is actually going away and Junio's merge into seen removes\nit entirely in favor of Peff's solution.  So I'm going to leave it as it\nis to improve conflict resolution since it won't live much longer than\nthis specific series, and may not even live that long depending on the\nrelease and when Peff's series gets merged in.\n-- \nbrian m. carlson: Houston, Texas, US\n"},{"id":"402120","messageId":"CAPig+cSbpb_eySzumaCYRzHhLOJQa_950QDEBzRNjhS5w+HZMw@mail.gmail.com","threadId":"53925","inReplyTo":"20200726195424.626969-34-sandals@crustytoothpaste.net","subject":"Re: [PATCH v4 33/39] Enable SHA-256 support by default","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2020-07-26T23:41:52Z","receivedAt":"2020-07-26T23:42:06Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Sun, Jul 26, 2020 at 3:56 PM brian m. carlson\n<sandals@crustytoothpaste.net> wrote:\n> Now that the we have a complete SHA-256 implementation in Git, let's\n\nReader trips over \"Now that the we\".\n\n> enable it so people can use it.  Remove the ENABLE_SHA256 define\n> constant everywhere it's used.  Add tests for initializing a repository\n> with SHA-256.\n>\n> Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n> ---\n> diff --git a/t/t0001-init.sh b/t/t0001-init.sh\n> @@ -441,6 +441,35 @@ test_expect_success 're-init from a linked worktree' '\n> +test_expect_success 'init honors GIT_DEFAULT_HASH' '\n> +       GIT_DEFAULT_HASH=sha1 git init sha1 &&\n> +       git -C sha1 rev-parse --show-object-format >actual &&\n> +       echo sha1 >expected &&\n> +       test_cmp expected actual &&\n> +       GIT_DEFAULT_HASH=sha256 git init sha256 &&\n> +       git -C sha256 rev-parse --show-object-format >actual &&\n> +       echo sha256 >expected &&\n> +       test_cmp expected actual\n> +'\n\nBy testing GIT_DEFAULT_HASH with two different values, this test does\na reasonable job of convincing readers that GIT_DEFAULT_HASH is indeed\nrespected.\n\n> +test_expect_success 'init honors --object-format' '\n> +       git init --object-format=sha256 explicit &&\n> +       git -C explicit rev-parse --show-object-format >actual &&\n> +       echo sha256 >expected &&\n> +       test_cmp expected actual\n> +'\n\nHowever, by testing only --object-format=sha256, neither the reader\nnor the test can be sure that the reported object format came from\n--object-format= or from the default value used by git-init.\n"},{"id":"402121","messageId":"CAPig+cSLQW=fMEY0o6WByeLxrnEkp751CObWOOsM1YuuiwUvoQ@mail.gmail.com","threadId":"53925","inReplyTo":"20200726195424.626969-37-sandals@crustytoothpaste.net","subject":"Re: [PATCH v4 36/39] t: make SHA1 prerequisite depend on default hash","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2020-07-26T23:52:00Z","receivedAt":"2020-07-26T23:53:14Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Sun, Jul 26, 2020 at 3:56 PM brian m. carlson\n<sandals@crustytoothpaste.net> wrote:\n> Currently, the SHA1 prerequisite depends on the output of git\n> hash-object.  However, in order for that to produce sane behavior, we\n> must be in a repository.  If we are not, the default will remain SHA-1,\n> and we'll produce wrong results if we're using SHA-256 for the testsuite\n> but the test assertion starts when we're not in a repository.\n>\n> Check the environment variable we use for this purpose, leaving it to\n> default to SHA-1 if none is specified.\n>\n> Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n> ---\n> diff --git a/t/test-lib.sh b/t/test-lib.sh\n> @@ -1689,7 +1689,8 @@ test_lazy_prereq CURL '\n>  test_lazy_prereq SHA1 '\n> +       test $(git hash-object /dev/null) = e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 &&\n> +       { test -z \"$GIT_DEFAULT_HASH\" || test \"$GIT_DEFAULT_HASH\" = \"sha1\"; }\n>  '\n\nDo we even need to run git-hash-object if GIT_DEFAULT_HASH is defined?\nThat is, why not something like this instead?\n\n    case \"$GIT_DEFAULT_HASH\" in\n    sha1) true ;;\n    \"\") test $(git hash-object /dev/null) =\n            e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 ;;\n    *) false ;;\n    esac\n"},{"id":"402122","messageId":"CAPig+cTD6yjqj9Mpte2zdFNXhJSk9Ju01SZYyptBCsSb9cxakA@mail.gmail.com","threadId":"53925","inReplyTo":"20200726195424.626969-38-sandals@crustytoothpaste.net","subject":"Re: [PATCH v4 37/39] ci: run tests with SHA-256","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2020-07-26T23:54:54Z","receivedAt":"2020-07-26T23:55:08Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Sun, Jul 26, 2020 at 3:56 PM brian m. carlson\n<sandals@crustytoothpaste.net> wrote:\n> Now that we have Git supporting SHA-256, we'd like to make sure that we\n> don't regress that state.  Unfortunately, it's easy to do so, so to\n> help, let's add code to run one of our CI jobs with SHA-256 as the\n> default hash.  This will help us detect any problems that may occur.\n>\n> We pick the linux-clang job because it's relatively fast and the\n> linux-gcc job already runs the testsuite twice.  We want our tests to\n> run as fast as possible, so we wouldn't want to add a third run to the\n> linux-gcc job.  To make sure we properly exercise the code, let's run\n> the tests in the default mode (SHA-1) first and then run a second time\n> with SHA-256.\n>\n> Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n> ---\n> diff --git a/ci/run-build-and-tests.sh b/ci/run-build-and-tests.sh\n> @@ -24,6 +24,11 @@ linux-gcc)\n> +linux-clang)\n> +       make test\n> +       export GIT_TEST_DEFAULT_HASH=sha256\n> +       make test\n> +       ;;\n\nIf the default someday flips from sha1 to sha256, then this will\nmerely run the entire test suite twice with SHA-256. Perhaps it could\nbe more explicit like this:\n\n    export GIT_TEST_DEFAULT_HASH=sha1\n    make test\n    export GIT_TEST_DEFAULT_HASH=sha256\n    make test\n"},{"id":"402123","messageId":"CAPig+cRQN_JWEd-EZchDaa-BSeDynx_+b+h9SJ1o6MFS3DQ+JA@mail.gmail.com","threadId":"53925","inReplyTo":"20200726195424.626969-39-sandals@crustytoothpaste.net","subject":"Re: [PATCH v4 38/39] docs: add documentation for extensions.objectFormat","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2020-07-26T23:56:57Z","receivedAt":"2020-07-26T23:57:10Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Sun, Jul 26, 2020 at 3:56 PM brian m. carlson\n<sandals@crustytoothpaste.net> wrote:\n> Document the extensions.objectFormat config setting.  Warn users not to\n> modify it themselves.\n>\n> Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n> ---\n> diff --git a/Documentation/config/extensions.txt b/Documentation/config/extensions.txt\n> @@ -0,0 +1,8 @@\n> +extensions.objectFormat::\n> +       Specify the hash algorithm to use.  The acceptable values are `sha1` and\n> +       `sha256`.  If not specified, `sha1` is assumed.  It is an error to specify\n> +       this key unless `core.repositoryformatversion` is 1.\n\nSince this is user-facing, I think we'd want to write it in camelCase:\n\n    this key unless `core.repositoryFormatVersion` is 1.\n"}]}