{"thread":{"id":"53944","subject":"[PATCH v5 02/39] t1001: use $ZERO_OID","startedAt":"2020-07-28T23:34:58Z","lastAt":"2021-03-11T19:16:36Z","messageCount":116,"participants":["brian m. carlson","Eric Sunshine","Junio C Hamano","Ævar Arnfjörð Bjarmason","Elijah Newren","Jeff King"],"isPatch":true,"patchVersion":5,"patchTotal":39},"messages":[{"id":"402269","messageId":"20200728233446.3066485-3-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200728233446.3066485-1-sandals@crustytoothpaste.net","subject":"[PATCH v5 02/39] t1001: use $ZERO_OID","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-28T23:34:09Z","receivedAt":"2020-07-28T23:34:58Z","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":"402275","messageId":"20200728233446.3066485-4-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200728233446.3066485-1-sandals@crustytoothpaste.net","subject":"[PATCH v5 03/39] t3305: make hash agnostic","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-28T23:34:10Z","receivedAt":"2020-07-28T23:34:59Z","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":"402273","messageId":"20200728233446.3066485-5-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200728233446.3066485-1-sandals@crustytoothpaste.net","subject":"[PATCH v5 04/39] t3404: prepare 'short SHA-1 collision' tests for SHA-256","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-28T23:34:11Z","receivedAt":"2020-07-28T23:35:01Z","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\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":"402271","messageId":"20200728233446.3066485-7-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200728233446.3066485-1-sandals@crustytoothpaste.net","subject":"[PATCH v5 06/39] t6101: make hash size independent","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-28T23:34:13Z","receivedAt":"2020-07-28T23:35:02Z","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":"402270","messageId":"20200728233446.3066485-11-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200728233446.3066485-1-sandals@crustytoothpaste.net","subject":"[PATCH v5 10/39] t7003: compute appropriate length constant","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-28T23:34:17Z","receivedAt":"2020-07-28T23:35:03Z","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":"402274","messageId":"20200728233446.3066485-13-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200728233446.3066485-1-sandals@crustytoothpaste.net","subject":"[PATCH v5 12/39] t7201: abstract away SHA-1-specific constants","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-28T23:34:19Z","receivedAt":"2020-07-28T23:35:03Z","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 | 6 ++++--\n 1 file changed, 4 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t7201-co.sh b/t/t7201-co.sh\nindex b696bae5f5..4d62b9b00f 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@@ -248,9 +249,10 @@ test_expect_success 'checkout to detach HEAD (with advice declined)' '\n \n test_expect_success 'checkout to detach HEAD' '\n \tgit config advice.detachedHead true &&\n+\trev=$(git rev-parse --short renamer^) &&\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":"402272","messageId":"20200728233446.3066485-16-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200728233446.3066485-1-sandals@crustytoothpaste.net","subject":"[PATCH v5 15/39] t7405: make hash size independent","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-28T23:34:22Z","receivedAt":"2020-07-28T23:35:07Z","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":"402276","messageId":"20200728233446.3066485-14-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200728233446.3066485-1-sandals@crustytoothpaste.net","subject":"[PATCH v5 13/39] t7102: abstract away SHA-1-specific constants","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-28T23:34:20Z","receivedAt":"2020-07-28T23:35:08Z","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":"402278","messageId":"20200728233446.3066485-21-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200728233446.3066485-1-sandals@crustytoothpaste.net","subject":"[PATCH v5 20/39] t8011: make hash size independent","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-28T23:34:27Z","receivedAt":"2020-07-28T23:35:09Z","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..bdda0c03fe 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,} /) {\n \t\t\tflush();\n \t\t\t$hash = $&;\n \t\t} elsif (/^$field (.*)/) {\n"},{"id":"402277","messageId":"20200728233446.3066485-18-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200728233446.3066485-1-sandals@crustytoothpaste.net","subject":"[PATCH v5 17/39] t7508: use $ZERO_OID instead of hard-coded constant","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-28T23:34:24Z","receivedAt":"2020-07-28T23:35:10Z","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":"402287","messageId":"20200728233446.3066485-28-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200728233446.3066485-1-sandals@crustytoothpaste.net","subject":"[PATCH v5 27/39] t5308: make test work with SHA-256","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-28T23:34:34Z","receivedAt":"2020-07-28T23:35:12Z","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":"402279","messageId":"20200728233446.3066485-27-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200728233446.3066485-1-sandals@crustytoothpaste.net","subject":"[PATCH v5 26/39] t9700: make hash size independent","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-28T23:34:33Z","receivedAt":"2020-07-28T23:35:14Z","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":"402284","messageId":"20200728233446.3066485-25-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200728233446.3066485-1-sandals@crustytoothpaste.net","subject":"[PATCH v5 24/39] t9350: make hash size independent","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-28T23:34:31Z","receivedAt":"2020-07-28T23:35:14Z","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":"402282","messageId":"20200728233446.3066485-23-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200728233446.3066485-1-sandals@crustytoothpaste.net","subject":"[PATCH v5 22/39] t9300: use $ZERO_OID instead of hard-coded object ID","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-28T23:34:29Z","receivedAt":"2020-07-28T23:35:16Z","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 f2d2cb06ad..308c1ef42c 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@@ -286,7 +286,7 @@ test_expect_success 'A: verify pack' '\n test_expect_success 'A: verify diff' '\n \tcopy=$(git rev-parse --verify master:file2) &&\n \tcat >expect <<-EOF &&\n-\t:000000 100755 0000000000000000000000000000000000000000 $copy A\tcopy-of-file2\n+\t:000000 100755 $ZERO_OID $copy A\tcopy-of-file2\n \tEOF\n \tgit diff-tree -M -r master verify--import-marks >actual &&\n \tcompare_diff_raw expect actual &&\n@@ -365,7 +365,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@@ -620,8 +620,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@@ -2733,7 +2733,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@@ -3084,7 +3084,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":"402288","messageId":"20200728233446.3066485-33-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200728233446.3066485-1-sandals@crustytoothpaste.net","subject":"[PATCH v5 32/39] setup: add support for reading extensions.objectformat","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-28T23:34:39Z","receivedAt":"2020-07-28T23:35:16Z","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":"402281","messageId":"20200728233446.3066485-36-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200728233446.3066485-1-sandals@crustytoothpaste.net","subject":"[PATCH v5 35/39] t: allow testing different hash algorithms via environment","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-28T23:34:42Z","receivedAt":"2020-07-28T23:35:18Z","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":"402283","messageId":"20200728233446.3066485-39-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200728233446.3066485-1-sandals@crustytoothpaste.net","subject":"[PATCH v5 38/39] docs: add documentation for extensions.objectFormat","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-28T23:34:45Z","receivedAt":"2020-07-28T23:35:19Z","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..4e23d73cdc\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":"402280","messageId":"20200728233446.3066485-37-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200728233446.3066485-1-sandals@crustytoothpaste.net","subject":"[PATCH v5 36/39] t: make SHA1 prerequisite depend on default hash","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-28T23:34:43Z","receivedAt":"2020-07-28T23:35:20Z","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 | 6 +++++-\n 1 file changed, 5 insertions(+), 1 deletion(-)\n\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex 307bb2207e..b278d37d12 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -1689,7 +1689,11 @@ 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+\tcase \"$GIT_DEFAULT_HASH\" in\n+\tsha1) true ;;\n+\t\"\") test $(git hash-object /dev/null) = e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 ;;\n+\t*) false ::\n+\tesac\n '\n \n test_lazy_prereq REBASE_P '\n"},{"id":"402286","messageId":"20200728233446.3066485-32-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200728233446.3066485-1-sandals@crustytoothpaste.net","subject":"[PATCH v5 31/39] bundle: add new version for use with SHA-256","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-28T23:34:38Z","receivedAt":"2020-07-28T23:35:24Z","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                                  | 83 +++++++++++++++++------\n bundle.h                                  |  4 +-\n t/t5510-fetch.sh                          | 16 +++--\n t/t5607-clone-bundle.sh                   | 31 +++++++++\n 7 files changed, 147 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..35585f237c 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(_(\"unrecognized bundle hash algorithm: %s\"), arg);\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,19 +83,19 @@ 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 (*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\tif (header->version == 3 && *buf.buf == '@') {\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 \n \t\t/*\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 min_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 = min_version;\n+\n+\tif (version < 2 || version > 3) {\n+\t\tdie(_(\"unsupported bundle version %d\"), version);\n+\t} else if (version < min_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..9243335ab0 100755\n--- a/t/t5510-fetch.sh\n+++ b/t/t5510-fetch.sh\n@@ -281,15 +281,19 @@ 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 updated by origin\n+\tOID refs/heads/master\n+\n+\tEOF\n+\tsed -e \"s/$OID_REGEX/OID/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":"402289","messageId":"20200728233446.3066485-40-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200728233446.3066485-1-sandals@crustytoothpaste.net","subject":"[PATCH v5 39/39] t: remove test_oid_init in tests","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-28T23:34:46Z","receivedAt":"2020-07-28T23:35:24Z","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/t8003-blame-corner-cases.sh          | 2 --\n t/t9301-fast-import-notes.sh           | 1 -\n t/t9350-fast-export.sh                 | 2 --\n 36 files changed, 2 insertions(+), 50 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/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":"402285","messageId":"20200728233446.3066485-35-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200728233446.3066485-1-sandals@crustytoothpaste.net","subject":"[PATCH v5 34/39] t: add test_oid option to select hash algorithm","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-28T23:34:41Z","receivedAt":"2020-07-28T23:35:25Z","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":"402292","messageId":"20200728233446.3066485-38-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200728233446.3066485-1-sandals@crustytoothpaste.net","subject":"[PATCH v5 37/39] ci: run tests with SHA-256","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-28T23:34:44Z","receivedAt":"2020-07-28T23:35:27Z","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.  We explicitly specify SHA-1 for the first run so that if\nwe change the default in the future, we make sure to test both cases.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n ci/run-build-and-tests.sh | 6 ++++++\n 1 file changed, 6 insertions(+)\n\ndiff --git a/ci/run-build-and-tests.sh b/ci/run-build-and-tests.sh\nindex 17e25aade9..6c27b886b8 100755\n--- a/ci/run-build-and-tests.sh\n+++ b/ci/run-build-and-tests.sh\n@@ -24,6 +24,12 @@ linux-gcc)\n \texport GIT_TEST_ADD_I_USE_BUILTIN=1\n \tmake test\n \t;;\n+linux-clang)\n+\texport GIT_TEST_DEFAULT_HASH=sha1\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":"402290","messageId":"20200728233446.3066485-26-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200728233446.3066485-1-sandals@crustytoothpaste.net","subject":"[PATCH v5 25/39] t9500: ensure that algorithm info is preserved in config","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-28T23:34:32Z","receivedAt":"2020-07-28T23:35:28Z","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":"402291","messageId":"20200728233446.3066485-2-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200728233446.3066485-1-sandals@crustytoothpaste.net","subject":"[PATCH v5 01/39] t: make test-bloom initialize repository","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-28T23:34:08Z","receivedAt":"2020-07-28T23:35:30Z","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":"402298","messageId":"20200728233446.3066485-1-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":null,"subject":"[PATCH v5 00/39] SHA-256, part 3/3","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-28T23:34:07Z","receivedAt":"2020-07-28T23:35:31Z","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 v4:\n* Fix several commit message to fix typos and inaccuracies.\n* Remove useless touch statement in tests.\n* Adjust several tests to introduce less dependence on previous test\n  assertions other than the setup ones.\n* Loosen the regexp for object IDs in a Perl script in a test.\n* Ensure help functionality works for git http-fetch.\n* Switch http-fetch.c to use the already existing struct argv_array\n  instance.\n* Avoid a memory leak, albeit a minor one.\n* Improve error message for unknown bundle hash algorithm.\n* Hoist a strbuf_rtrim in the bundle parsing code to simplify things.\n* Specify a minimum version instead of a default version in the bundle\n  code.\n* Remove a useless line in tests.\n* Avoid invoking git hash-object needlessly for the SHA1 prerequisite.\n* Be explicit about which algorithms we're testing in CI.\n* Properly capitalize \"core.repositoryFormatVersion\" in documentation.\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                     |  23 ++--\n bundle.c                                  |  83 +++++++++---\n bundle.h                                  |   4 +-\n ci/run-build-and-tests.sh                 |   6 +\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                           |  33 +++++\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                          |  16 ++-\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         | 150 ++++++++++++----------\n t/t7102-reset.sh                          |  93 ++++++++------\n t/t7201-co.sh                             |   6 +-\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                          |  18 ++-\n t/t8003-blame-corner-cases.sh             |   3 +-\n t/t8011-blame-split-file.sh               |   2 +-\n t/t9300-fast-import.sh                    | 118 +++++++++--------\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                             |   9 +-\n 74 files changed, 635 insertions(+), 354 deletions(-)\n create mode 100644 Documentation/config/extensions.txt\n\nDiff-intervalle contre v4 :\n 1:  2d720a6beb =  1:  fb53834bd3 t: make test-bloom initialize repository\n 2:  530704736a =  2:  8170f55d65 t1001: use $ZERO_OID\n 3:  33e7822d0e =  3:  4b14099f1a t3305: make hash agnostic\n 4:  82a6827f45 !  4:  8d3ce7cccd t3404: prepare 'short SHA-1 collision' tests for SHA-256\n    @@ Commit message\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    -\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 5:  23cbd25060 =  5:  8329368075 t6100: make hash size independent\n 6:  9e2553b1f2 =  6:  63595c30d4 t6101: make hash size independent\n 7:  c2c5dd407e =  7:  88c7a501db t6301: make hash size independent\n 8:  1ab4ed032a =  8:  4546001417 t6500: specify test values for SHA-256\n 9:  54fcc025bb =  9:  4a9304a648 t6501: avoid hard-coded objects\n10:  a2f420fcd4 = 10:  7785b7cc1f t7003: compute appropriate length constant\n11:  766bba42f6 ! 11:  71db1716f5 t7063: make hash size independent\n    @@ Metadata\n      ## Commit message ##\n         t7063: make hash size independent\n     \n    -    Use test_oid instead of hard-coding a fixed size all-zeros object ID.\n    +    Use test_oid instead of hard-coding algorithm-specific constants and\n    +    all-zero values.\n     \n         Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n     \n    @@ t/t7063-status-untracked-cache.sh: EOF\n      two\n      EOF\n      \ttest_cmp ../expect-from-test-dump ../actual\n    -@@ t/t7063-status-untracked-cache.sh: 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     @@ t/t7063-status-untracked-cache.sh: 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 &&\n12:  66d242ccd9 ! 12:  79dcdc3496 t7201: abstract away SHA-1-specific constants\n    @@ t/t7201-co.sh: test_expect_success 'switch to another branch while carrying a de\n      \ttest_line_count = 1 messages &&\n      \tH=$(git rev-parse --verify HEAD) &&\n      \tM=$(git show-ref -s --verify refs/heads/master) &&\n    -@@ t/t7201-co.sh: test_expect_success 'checkout to detach HEAD' '\n    +@@ t/t7201-co.sh: test_expect_success 'checkout to detach HEAD (with advice declined)' '\n    + \n    + test_expect_success 'checkout to detach HEAD' '\n      \tgit config advice.detachedHead true &&\n    ++\trev=$(git rev-parse --short renamer^) &&\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 &&\n13:  090041ee54 = 13:  f89560df08 t7102: abstract away SHA-1-specific constants\n14:  4a6991d6a1 = 14:  79800ba8a3 t7400: make hash size independent\n15:  d39bbeb5a2 = 15:  07d287fe0f t7405: make hash size independent\n16:  5b0d52ae0e = 16:  1ee37967f2 t7506: avoid checking for SHA-1-specific constants\n17:  54d1706107 = 17:  ba3c997fd7 t7508: use $ZERO_OID instead of hard-coded constant\n18:  f3f4239ce9 ! 18:  362e0a9440 t8002: make hash size independent\n    @@ Metadata\n      ## Commit message ##\n         t8002: make hash size independent\n     \n    -    Compute the length of an object ID instead of of hard-coding 40-based\n    +    Compute the length of an object ID instead of hard-coding 40-based\n         values.\n     \n         Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n    @@ t/t8002-blame.sh: test_description='git blame'\n      . \"$TEST_DIRECTORY\"/annotate-tests.sh\n      \n     +test_expect_success 'setup' '\n    -+\ttest_oid_init\n    ++\thexsz=$(test_oid hexsz)\n     +'\n     +\n      test_expect_success 'blame untracked file in empty repo' '\n    @@ t/t8002-blame.sh: test_expect_success 'blame --abbrev=<n> works' '\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      '\n19:  719db3822e = 19:  eeeba30e75 t8003: make hash size independent\n20:  803e5665e9 ! 20:  a71b7fb7f1 t8011: make hash size independent\n    @@ t/t8011-blame-split-file.sh: test_expect_success 'setup simulated porcelain' '\n      \tmy $field = shift;\n      \twhile (<>) {\n     -\t\tif (/^[0-9a-f]{40} /) {\n    -+\t\tif (/^[0-9a-f]{40,64} /) {\n    ++\t\tif (/^[0-9a-f]{40,} /) {\n      \t\t\tflush();\n      \t\t\t$hash = $&;\n      \t\t} elsif (/^$field (.*)/) {\n21:  d1c4351bc9 ! 21:  b9a4ac6547 t9300: abstract away SHA-1-specific constants\n    @@ Commit message\n         t9300: abstract away SHA-1-specific constants\n     \n         Adjust the test so that it computes variables for object IDs instead of\n    -    using hard-coded hashes.\n    +    using hard-coded hashes.  In addition, use cut to filter out the object\n    +    IDs and verify only the information that we're really interested in.\n     \n         Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n     \n      ## t/t9300-fast-import.sh ##\n     @@ t/t9300-fast-import.sh: test_expect_success 'A: verify pack' '\n    + '\n      \n      test_expect_success 'A: verify diff' '\n    ++\tcopy=$(git rev-parse --verify master:file2) &&\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    ++\t:000000 100755 0000000000000000000000000000000000000000 $copy A\tcopy-of-file2\n      \tEOF\n      \tgit diff-tree -M -r master verify--import-marks >actual &&\n      \tcompare_diff_raw expect actual &&\n22:  db74bf3c8c ! 22:  8d617381c0 t9300: use $ZERO_OID instead of hard-coded object ID\n    @@ t/t9300-fast-import.sh: test_expect_success 'A: create pack from stdin' '\n      \ttag nested\n      \tmark :7\n     @@ t/t9300-fast-import.sh: test_expect_success 'A: verify pack' '\n    - \n      test_expect_success 'A: verify diff' '\n    + \tcopy=$(git rev-parse --verify master:file2) &&\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    +-\t:000000 100755 0000000000000000000000000000000000000000 $copy A\tcopy-of-file2\n    ++\t:000000 100755 $ZERO_OID $copy A\tcopy-of-file2\n      \tEOF\n      \tgit diff-tree -M -r master verify--import-marks >actual &&\n      \tcompare_diff_raw expect actual &&\n23:  fa7daed2bf = 23:  d3ddbe3bcf t9301: make hash size independent\n24:  84aef86ac0 = 24:  70bfe6c076 t9350: make hash size independent\n25:  541108fc64 = 25:  c784e76075 t9500: ensure that algorithm info is preserved in config\n26:  2de5d2da58 = 26:  00e82dc23e t9700: make hash size independent\n27:  c916058c38 = 27:  2d03d136df t5308: make test work with SHA-256\n28:  b0781430ef = 28:  d8941dd81d t0410: mark test with SHA1 prerequisite\n29:  230a933e87 ! 29:  39eb2e82b5 http-fetch: set up git directory before parsing pack hashes\n    @@ Commit message\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    +    Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n    +\n      ## http-fetch.c ##\n     @@ http-fetch.c: int cmd_main(int argc, const char **argv)\n      \tint packfile = 0;\n      \tstruct object_id packfile_hash;\n      \n    -+\tsetup_git_directory();\n    ++\tsetup_git_directory_gently(NULL);\n     +\n      \twhile (arg < argc && argv[arg][0] == '-') {\n      \t\tconst char *p;\n30:  d3dbe9e760 ! 30:  7c71a12f67 builtin/verify-pack: implement an --object-format option\n    @@ builtin/verify-pack.c\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    ++\tstruct argv_array *argv = &index_pack.args;\n    + \tstruct strbuf 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    ++\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    ++\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    ++\t\targv_array_push(argv, \"--verify-stat\");\n      \telse\n     -\t\targv[1] = \"--verify\";\n    -+\t\targv_array_push(&argv, \"--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    ++\tif (hash_algo)\n    ++\t\targv_array_pushf(argv, \"--object-format=%s\", hash_algo);\n      \n      \t/*\n      \t * In addition to \"foo.pack\" we accept \"foo.idx\" and \"foo\";\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_array_push(&argv, 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    -@@ 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:  e3805101ce ! 31:  9a0345a1f6 bundle: add new version for use with SHA-256\n    @@ bundle.c: static void add_to_ref_list(const struct object_id *oid, const char *n\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\t\treturn error(_(\"unrecognized bundle hash algorithm: %s\"), arg);\n     +\t\theader->hash_algo = &hash_algos[algo];\n     +\t\treturn 0;\n     +\t}\n    @@ bundle.c: 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\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\tif (header->version == 3 && *buf.buf == '@') {\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    + \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     @@ bundle.c: static int write_bundle_refs(int bundle_fd, struct rev_info *revs)\n      }\n      \n    @@ bundle.c: static int write_bundle_refs(int bundle_fd, struct rev_info *revs)\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    ++\tint min_version = the_hash_algo == &hash_algos[GIT_HASH_SHA1] ? 2 : 3;\n      \n      \tbundle_to_stdout = !strcmp(path, \"-\");\n      \tif (bundle_to_stdout)\n    @@ bundle.c: int create_bundle(struct repository *r, const char *path,\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    ++\t\tversion = min_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} else if (version < min_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/t5510-fetch.sh: test_expect_success 'create bundle 1' '\n      '\n      \n      test_expect_success 'header of bundle looks right' '\n    - \thead -n 4 \"$D\"/bundle1 &&\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    @@ t/t5510-fetch.sh: test_expect_success 'create bundle 1' '\n     +\tcat >expect <<-EOF &&\n     +\t# v3 git bundle\n     +\t@object-format=$(test_oid algo)\n    -+\t-OID message\n    -+\tOID message\n    ++\t-OID updated by origin\n    ++\tOID refs/heads/master\n     +\n     +\tEOF\n    -+\tsed -e \"s/$OID_REGEX .*/OID message/g\" -e \"5q\" \"$D\"/bundle1 >actual &&\n    ++\tsed -e \"s/$OID_REGEX/OID/g\" -e \"5q\" \"$D\"/bundle1 >actual &&\n     +\ttest_cmp expect actual\n      '\n      \n32:  c941fcf63c = 32:  4b72b98ce7 setup: add support for reading extensions.objectformat\n33:  7c6264ac79 ! 33:  73ef3ef66a Enable SHA-256 support by default\n    @@ t/t0001-init.sh: test_expect_success 're-init from a linked worktree' '\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    ++\tgit init --object-format=sha1 explicit-sha1 &&\n    ++\tgit -C explicit-sha1 rev-parse --show-object-format >actual &&\n    ++\techo sha1 >expected &&\n    ++\ttest_cmp expected actual &&\n    ++\tgit init --object-format=sha256 explicit-sha256 &&\n    ++\tgit -C explicit-sha256 rev-parse --show-object-format >actual &&\n     +\techo sha256 >expected &&\n     +\ttest_cmp expected actual\n     +'\n34:  2719ab94e6 = 34:  2512a1669c t: add test_oid option to select hash algorithm\n35:  1c8e5041d1 = 35:  015636559b t: allow testing different hash algorithms via environment\n36:  7213d59222 <  -:  ---------- t: make SHA1 prerequisite depend on default hash\n -:  ---------- > 36:  6f2dec51cd t: make SHA1 prerequisite depend on default hash\n37:  caf6c026ba ! 37:  32536503f3 ci: run tests with SHA-256\n    @@ Commit message\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    +    with SHA-256.  We explicitly specify SHA-1 for the first run so that if\n    +    we change the default in the future, we make sure to test both cases.\n     \n         Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n     \n    @@ ci/run-build-and-tests.sh: linux-gcc)\n      \tmake test\n      \t;;\n     +linux-clang)\n    ++\texport GIT_TEST_DEFAULT_HASH=sha1\n     +\tmake test\n     +\texport GIT_TEST_DEFAULT_HASH=sha256\n     +\tmake test\n38:  ec4e6ae166 ! 38:  cc5679d353 docs: add documentation for extensions.objectFormat\n    @@ Documentation/config/extensions.txt (new)\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    ++\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\n39:  3185c62cfc ! 39:  307b75c88e t: remove test_oid_init in tests\n    @@ t/t7003-filter-branch.sh: test_description='git filter-branch'\n      \tGIT_COMMITTER_DATE=\"@0 +0000\" GIT_AUTHOR_DATE=\"@0 +0000\" &&\n      \ttest_commit --notick B &&\n     \n    - ## t/t8002-blame.sh ##\n    -@@ t/t8002-blame.sh: 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    -\n      ## t/t8003-blame-corner-cases.sh ##\n     @@ t/t8003-blame-corner-cases.sh: test_description='git blame corner cases'\n      pick_fc='s/^[0-9a-f^]* *\\([^ ]*\\) *(\\([^ ]*\\) .*/\\1-\\2/'\n"},{"id":"402293","messageId":"20200728233446.3066485-6-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200728233446.3066485-1-sandals@crustytoothpaste.net","subject":"[PATCH v5 05/39] t6100: make hash size independent","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-28T23:34:12Z","receivedAt":"2020-07-28T23:35:35Z","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":"402295","messageId":"20200728233446.3066485-15-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200728233446.3066485-1-sandals@crustytoothpaste.net","subject":"[PATCH v5 14/39] t7400: make hash size independent","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-28T23:34:21Z","receivedAt":"2020-07-28T23:35:37Z","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":"402297","messageId":"20200728233446.3066485-12-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200728233446.3066485-1-sandals@crustytoothpaste.net","subject":"[PATCH v5 11/39] t7063: make hash size independent","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-28T23:34:18Z","receivedAt":"2020-07-28T23:35:38Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Use test_oid instead of hard-coding algorithm-specific constants and\nall-zero values.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n t/t7063-status-untracked-cache.sh | 150 ++++++++++++++++--------------\n 1 file changed, 80 insertions(+), 70 deletions(-)\n\ndiff --git a/t/t7063-status-untracked-cache.sh b/t/t7063-status-untracked-cache.sh\nindex 428cff9cf3..a682a3d826 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@@ -806,8 +816,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":"402294","messageId":"20200728233446.3066485-10-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200728233446.3066485-1-sandals@crustytoothpaste.net","subject":"[PATCH v5 09/39] t6501: avoid hard-coded objects","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-28T23:34:16Z","receivedAt":"2020-07-28T23:35:40Z","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":"402296","messageId":"20200728233446.3066485-8-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200728233446.3066485-1-sandals@crustytoothpaste.net","subject":"[PATCH v5 07/39] t6301: make hash size independent","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-28T23:34:14Z","receivedAt":"2020-07-28T23:35:41Z","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":"402304","messageId":"20200728233446.3066485-30-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200728233446.3066485-1-sandals@crustytoothpaste.net","subject":"[PATCH v5 29/39] http-fetch: set up git directory before parsing pack hashes","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-28T23:34:36Z","receivedAt":"2020-07-28T23:35:42Z","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\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\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..65050dee2b 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_gently(NULL);\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":"402303","messageId":"20200728233446.3066485-22-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200728233446.3066485-1-sandals@crustytoothpaste.net","subject":"[PATCH v5 21/39] t9300: abstract away SHA-1-specific constants","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-28T23:34:28Z","receivedAt":"2020-07-28T23:35:43Z","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.  In addition, use cut to filter out the object\nIDs and verify only the information that we're really interested in.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n t/t9300-fast-import.sh | 108 ++++++++++++++++++++++-------------------\n 1 file changed, 59 insertions(+), 49 deletions(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex e151df81c0..f2d2cb06ad 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -284,8 +284,9 @@ test_expect_success 'A: verify pack' '\n '\n \n test_expect_success 'A: verify diff' '\n+\tcopy=$(git rev-parse --verify master:file2) &&\n \tcat >expect <<-EOF &&\n-\t:000000 100755 0000000000000000000000000000000000000000 7123f7f44e39be127c5eb701e5968176ee9d78b1 A\tcopy-of-file2\n+\t:000000 100755 0000000000000000000000000000000000000000 $copy 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 +529,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 +572,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 +617,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 +784,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 +941,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 +1011,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 +1032,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 +1053,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 +1074,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 +1104,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 +1136,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 +1169,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 +1190,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 +1261,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 +1282,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 +1347,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 +3124,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 +3147,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 +3172,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 +3197,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":"402305","messageId":"20200728233446.3066485-31-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200728233446.3066485-1-sandals@crustytoothpaste.net","subject":"[PATCH v5 30/39] builtin/verify-pack: implement an --object-format option","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-28T23:34:37Z","receivedAt":"2020-07-28T23:35:44Z","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  | 23 +++++++++++++++--------\n t/t5702-protocol-v2.sh |  2 +-\n 2 files changed, 16 insertions(+), 9 deletions(-)\n\ndiff --git a/builtin/verify-pack.c b/builtin/verify-pack.c\nindex c2a1a5c504..3669a90263 100644\n--- a/builtin/verify-pack.c\n+++ b/builtin/verify-pack.c\n@@ -7,21 +7,26 @@\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 argv_array *argv = &index_pack.args;\n \tstruct strbuf 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\targv_array_pushf(argv, \"--object-format=%s\", hash_algo);\n \n \t/*\n \t * In addition to \"foo.pack\" we accept \"foo.idx\" and \"foo\";\n@@ -31,9 +36,8 @@ 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.git_cmd = 1;\n \n \terr = run_command(&index_pack);\n@@ -60,12 +64,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 +82,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":"402301","messageId":"20200728233446.3066485-34-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200728233446.3066485-1-sandals@crustytoothpaste.net","subject":"[PATCH v5 33/39] Enable SHA-256 support by default","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-28T23:34:40Z","receivedAt":"2020-07-28T23:35:45Z","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   | 33 +++++++++++++++++++++++++++++++++\n 4 files changed, 33 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..d71d4c7238 100755\n--- a/t/t0001-init.sh\n+++ b/t/t0001-init.sh\n@@ -441,6 +441,39 @@ 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=sha1 explicit-sha1 &&\n+\tgit -C explicit-sha1 rev-parse --show-object-format >actual &&\n+\techo sha1 >expected &&\n+\ttest_cmp expected actual &&\n+\tgit init --object-format=sha256 explicit-sha256 &&\n+\tgit -C explicit-sha256 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":"402302","messageId":"20200728233446.3066485-29-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200728233446.3066485-1-sandals@crustytoothpaste.net","subject":"[PATCH v5 28/39] t0410: mark test with SHA1 prerequisite","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-28T23:34:35Z","receivedAt":"2020-07-28T23:35:46Z","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":"402300","messageId":"20200728233446.3066485-9-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200728233446.3066485-1-sandals@crustytoothpaste.net","subject":"[PATCH v5 08/39] t6500: specify test values for SHA-256","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-28T23:34:15Z","receivedAt":"2020-07-28T23:35:48Z","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":"402306","messageId":"20200728233446.3066485-19-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200728233446.3066485-1-sandals@crustytoothpaste.net","subject":"[PATCH v5 18/39] t8002: make hash size independent","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-28T23:34:25Z","receivedAt":"2020-07-28T23:35:50Z","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 hard-coding 40-based\nvalues.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n t/t8002-blame.sh | 18 +++++++++++-------\n 1 file changed, 11 insertions(+), 7 deletions(-)\n\ndiff --git a/t/t8002-blame.sh b/t/t8002-blame.sh\nindex eea048e52c..c3b70b025e 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+\thexsz=$(test_oid hexsz)\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,17 @@ 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+\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":"402299","messageId":"20200728233446.3066485-20-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200728233446.3066485-1-sandals@crustytoothpaste.net","subject":"[PATCH v5 19/39] t8003: make hash size independent","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-28T23:34:26Z","receivedAt":"2020-07-28T23:35:51Z","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":"402307","messageId":"20200728233446.3066485-24-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200728233446.3066485-1-sandals@crustytoothpaste.net","subject":"[PATCH v5 23/39] t9301: make hash size independent","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-28T23:34:30Z","receivedAt":"2020-07-28T23:35:52Z","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":"402308","messageId":"20200728233446.3066485-17-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200728233446.3066485-1-sandals@crustytoothpaste.net","subject":"[PATCH v5 16/39] t7506: avoid checking for SHA-1-specific constants","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-28T23:34:23Z","receivedAt":"2020-07-28T23:35:54Z","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":"402319","messageId":"CAPig+cTw0XXNcKp5vVLhPtV5jH9d9gwfuYGuLqpSXsGmpn_fqw@mail.gmail.com","threadId":"53944","inReplyTo":"20200728233446.3066485-19-sandals@crustytoothpaste.net","subject":"Re: [PATCH v5 18/39] t8002: make hash size independent","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2020-07-29T02:24:42Z","receivedAt":"2020-07-29T02:24:57Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Tue, Jul 28, 2020 at 7:35 PM brian m. carlson\n<sandals@crustytoothpaste.net> wrote:\n> Compute the length of an object ID instead of hard-coding 40-based\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> +       hexsz=$(test_oid hexsz)\n> +'\n\nIn the previous version of this series, the \"setup\" test  invoked\ntest_oid_init() as its very first step. This version doesn't. As a\nreviewer, I was caught off-guard by this unexpected and unexplained\ndifference between versions. The script works fine without\ntest_oid_init() anyhow since test-lib.sh invokes test_oid_init(), so\nthe test_oid_init() call introduced here by the previous version was\nredundant.\n\nSome of the patches in this series add test_oid_init() calls to their\n\"setup\" tests, while others don't, which makes for a somewhat\nconfusing impression as one reads the series. In general, it would be\nnice for the patches to paint a consistent picture (i.e either\nuniformly employ test_oid_init() or don't), however, I would not want\nto see a re-roll just for that. Also, since the final patch of the\nseries ends up removing all those test_oid_init() calls anyhow, it's\nall straightened out in the end.\n"},{"id":"402320","messageId":"CAPig+cSP-NKjBHfD+REAUECJm4qjhKMc0vhYg9rMaeapWSTKWg@mail.gmail.com","threadId":"53944","inReplyTo":"20200728233446.3066485-30-sandals@crustytoothpaste.net","subject":"Re: [PATCH v5 29/39] http-fetch: set up git directory before parsing pack hashes","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2020-07-29T02:36:53Z","receivedAt":"2020-07-29T02:37:09Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Tue, Jul 28, 2020 at 7:35 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> 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> Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>\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_gently(NULL);\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\nIn the previous version of this series the setup_git_directory() call\nwas moved verbatim above the 'while' loop, and my review pointed out\nthat doing so made \"git-http-fetch -h\" fail when not in a Git\nrepository. It was recommended, therefore, to take advantage of\nsetup_git_directory_gently() to fix this problem.\n\nBut note that setup_git_directory() is defined like this:\n\n    const char *setup_git_directory(void)\n    {\n        return setup_git_directory_gently(NULL);\n    }\n\nSo, your use of setup_git_directory_gently(NULL) in this version of\nthe patch is no better than the plain setup_git_directory() call in\nthe previous version. It is still impossible to ask git-http-fetch for\nhelp when not in a Git repository.\n\nTo fix this, you must pass non-NULL for the 'nongit' argument of\nsetup_git_directory_gently().\n\nFor robustness, in order to retain the original behavior (prior to\nthis patch), it would be best to check the value of 'nongit' _after_\nthe 'while' loop and error out if not in a repository. Perhaps\nsomething like this (taking a hint from builtin/diff.c):\n\n    setup_git_directory_gently(&nongit);\n\n    while (...) {\n        ...\n    }\n\n    if (nongit)\n        die(_(\"not a git repository\"));\n"},{"id":"402321","messageId":"CAPig+cSJc9P6hdBDrH9QbkvARcqc3EygMMXXB8vbU=W43viLqA@mail.gmail.com","threadId":"53944","inReplyTo":"20200728233446.3066485-32-sandals@crustytoothpaste.net","subject":"Re: [PATCH v5 31/39] bundle: add new version for use with SHA-256","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2020-07-29T02:53:47Z","receivedAt":"2020-07-29T02:54:02Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Tue, Jul 28, 2020 at 7:36 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> @@ -57,19 +83,19 @@ static int parse_bundle_header(int fd, struct bundle_header *header,\n> -               if (*buf.buf == '-') {\n> -                       is_prereq = 1;\n> -                       strbuf_remove(&buf, 0, 1);\n> -               }\n>                 strbuf_rtrim(&buf);\n>\n> -               if (!header->hash_algo) {\n> -                       header->hash_algo = detect_hash_algo(&buf);\n> -                       if (!header->hash_algo) {\n> -                               error(_(\"unknown hash algorithm length\"));\n> +               if (header->version == 3 && *buf.buf == '@') {\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\nMoving the strbuf_rtrim() earlier in the loop, as suggested in my\nprevious review, made the diff a lot noisier, uglier, and more\ndifficult to read, however, the code itself ends up being easier to\nreason about than in the previous round. Good.\n\nBy the way (I didn't think of this in my previous review), but\nwouldn't it be better for this:\n\n    if (header->version == 3 && *buf.buf == '@') {\n\nto instead be written as:\n\n    if (header->version >= 3 && *buf.buf == '@') {\n\nto future-proof it since versions beyond 3 will also almost certainly\nsupport \"@foo\" capabilities?\n\n> @@ -449,13 +475,14 @@ static int write_bundle_refs(int bundle_fd, struct rev_info *revs)\n> +       int min_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 = min_version;\n> +\n> +       if (version < 2 || version > 3) {\n> +               die(_(\"unsupported bundle version %d\"), version);\n> +       } else if (version < min_version) {\n> +               die(_(\"cannot write bundle version %d with algorithm %s\"), version, the_hash_algo->name);\n> +       } else if (version == 2) {\n> +               write_or_die(bundle_fd, v2_bundle_signature, strlen(v2_bundle_signature));\n\nThis looks better than the previous attempt; less likely to be fragile\nas new bundle versions are introduced. Good.\n"},{"id":"402322","messageId":"CAPig+cSErEWAaDtpOBbWDuQd+6yN4UKmUvMjKpT6AAd+SwkyTw@mail.gmail.com","threadId":"53944","inReplyTo":"20200728233446.3066485-34-sandals@crustytoothpaste.net","subject":"Re: [PATCH v5 33/39] Enable SHA-256 support by default","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2020-07-29T02:57:17Z","receivedAt":"2020-07-29T02:57:30Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Tue, Jul 28, 2020 at 7:36 PM brian m. carlson\n<sandals@crustytoothpaste.net> wrote:\n> Subject: Enable SHA-256 support by default\n\nIf you happen to re-roll, perhaps: s/Enable/enable/\n\n> Now that the we have a complete SHA-256 implementation in Git, let's\n\nStill wonky grammar here (mentioned previously): \"Now that the we have...\"\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"},{"id":"402323","messageId":"CAPig+cSXmsUtFAgtM9+vXEcsk7USeNNK39RKQ5h_=y0fh+6Z9w@mail.gmail.com","threadId":"53944","inReplyTo":"20200728233446.3066485-37-sandals@crustytoothpaste.net","subject":"Re: [PATCH v5 36/39] t: make SHA1 prerequisite depend on default hash","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2020-07-29T03:01:30Z","receivedAt":"2020-07-29T03:01:44Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Tue, Jul 28, 2020 at 7:36 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,11 @@ test_lazy_prereq CURL '\n>  test_lazy_prereq SHA1 '\n> -       test $(git hash-object /dev/null) = e69de29bb2d1d6434b8b29ae775ad8c2e48c5391\n> +       case \"$GIT_DEFAULT_HASH\" in\n> +       sha1) true ;;\n> +       \"\") test $(git hash-object /dev/null) = e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 ;;\n> +       *) false ::\n> +       esac\n>  '\n\nThis deserves a s/::/;;/ in the final case arm. The \"::\" does work --\nin a manner of speaking -- but only \"by accident\"; merely because it's\nbeing interpreted as an argument to 'false' and it happens to be the\nfinal case arm, but it still ought to be fixed.\n\n(I'm pretty sure I typed \";;\", not \"::\", when I gave this code as an\nexample in my previous review... {goes and checks...} indeed, I did\ntype \";;\".)\n"},{"id":"402394","messageId":"20200729222829.GF6540@camp.crustytoothpaste.net","threadId":"53944","inReplyTo":"CAPig+cSJc9P6hdBDrH9QbkvARcqc3EygMMXXB8vbU=W43viLqA@mail.gmail.com","subject":"Re: [PATCH v5 31/39] bundle: add new version for use with SHA-256","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-29T22:28:29Z","receivedAt":"2020-07-29T22:29:07Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On 2020-07-29 at 02:53:47, Eric Sunshine wrote:\n> Moving the strbuf_rtrim() earlier in the loop, as suggested in my\n> previous review, made the diff a lot noisier, uglier, and more\n> difficult to read, however, the code itself ends up being easier to\n> reason about than in the previous round. Good.\n\nYeah, I noticed that.  The code is much nicer, so thank you for that\nsuggestion.\n\n> By the way (I didn't think of this in my previous review), but\n> wouldn't it be better for this:\n> \n>     if (header->version == 3 && *buf.buf == '@') {\n> \n> to instead be written as:\n> \n>     if (header->version >= 3 && *buf.buf == '@') {\n> \n> to future-proof it since versions beyond 3 will also almost certainly\n> support \"@foo\" capabilities?\n\nI think this will need to be dealt with by the author of bundle v4,\nsince currently bundle v4 will error out before we get here.  I don't\nwant to make too many assumptions about a future format.\n-- \nbrian m. carlson: Houston, Texas, US\n"},{"id":"402395","messageId":"20200729223116.GG6540@camp.crustytoothpaste.net","threadId":"53944","inReplyTo":"CAPig+cTw0XXNcKp5vVLhPtV5jH9d9gwfuYGuLqpSXsGmpn_fqw@mail.gmail.com","subject":"Re: [PATCH v5 18/39] t8002: make hash size independent","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-29T22:31:16Z","receivedAt":"2020-07-29T22:31:53Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On 2020-07-29 at 02:24:42, Eric Sunshine wrote:\n> In the previous version of this series, the \"setup\" test  invoked\n> test_oid_init() as its very first step. This version doesn't. As a\n> reviewer, I was caught off-guard by this unexpected and unexplained\n> difference between versions. The script works fine without\n> test_oid_init() anyhow since test-lib.sh invokes test_oid_init(), so\n> the test_oid_init() call introduced here by the previous version was\n> redundant.\n> \n> Some of the patches in this series add test_oid_init() calls to their\n> \"setup\" tests, while others don't, which makes for a somewhat\n> confusing impression as one reads the series. In general, it would be\n> nice for the patches to paint a consistent picture (i.e either\n> uniformly employ test_oid_init() or don't), however, I would not want\n> to see a re-roll just for that. Also, since the final patch of the\n> series ends up removing all those test_oid_init() calls anyhow, it's\n> all straightened out in the end.\n\nGood point.  I'll try to remove them from the existing tests which add\nthem in the rest of the series.\n-- \nbrian m. carlson: Houston, Texas, US\n"},{"id":"402399","messageId":"20200729231428.3658647-2-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200729231428.3658647-1-sandals@crustytoothpaste.net","subject":"[PATCH v6 01/39] t: make test-bloom initialize repository","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-29T23:13:50Z","receivedAt":"2020-07-29T23:14:48Z","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":"402400","messageId":"20200729231428.3658647-5-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200729231428.3658647-1-sandals@crustytoothpaste.net","subject":"[PATCH v6 04/39] t3404: prepare 'short SHA-1 collision' tests for SHA-256","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-29T23:13:53Z","receivedAt":"2020-07-29T23:14:51Z","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\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 | 49 ++++++++++++++++++++++++++++-------\n 1 file changed, 40 insertions(+), 9 deletions(-)\n\ndiff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh\nindex 4a7d21f898..9744e88760 100755\n--- a/t/t3404-rebase-interactive.sh\n+++ b/t/t3404-rebase-interactive.sh\n@@ -1250,7 +1250,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 +1262,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":"402401","messageId":"20200729231428.3658647-8-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200729231428.3658647-1-sandals@crustytoothpaste.net","subject":"[PATCH v6 07/39] t6301: make hash size independent","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-29T23:13:56Z","receivedAt":"2020-07-29T23:14: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 is\nchecked.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n t/t6301-for-each-ref-errors.sh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/t/t6301-for-each-ref-errors.sh b/t/t6301-for-each-ref-errors.sh\nindex 49cc65bb58..809854fc0c 100755\n--- a/t/t6301-for-each-ref-errors.sh\n+++ b/t/t6301-for-each-ref-errors.sh\n@@ -5,9 +5,9 @@ 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+\tMISSING=$(test_oid deadbeef) &&\n \tgit commit --allow-empty -m \"Initial\" &&\n \tgit tag testtag &&\n \tgit for-each-ref >full-list &&\n"},{"id":"402402","messageId":"20200729231428.3658647-10-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200729231428.3658647-1-sandals@crustytoothpaste.net","subject":"[PATCH v6 09/39] t6501: avoid hard-coded objects","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-29T23:13:58Z","receivedAt":"2020-07-29T23:14:53Z","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 | 14 +++++++-------\n 1 file changed, 7 insertions(+), 7 deletions(-)\n\ndiff --git a/t/t6501-freshen-objects.sh b/t/t6501-freshen-objects.sh\nindex f30b4849b6..8a3bb4105b 100755\n--- a/t/t6501-freshen-objects.sh\n+++ b/t/t6501-freshen-objects.sh\n@@ -128,9 +128,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 +143,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 +153,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":"402403","messageId":"20200729231428.3658647-12-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200729231428.3658647-1-sandals@crustytoothpaste.net","subject":"[PATCH v6 11/39] t7063: make hash size independent","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-29T23:14:00Z","receivedAt":"2020-07-29T23:14:55Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Use test_oid instead of hard-coding algorithm-specific constants and\nall-zero values.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n t/t7063-status-untracked-cache.sh | 150 ++++++++++++++++--------------\n 1 file changed, 80 insertions(+), 70 deletions(-)\n\ndiff --git a/t/t7063-status-untracked-cache.sh b/t/t7063-status-untracked-cache.sh\nindex 428cff9cf3..a682a3d826 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@@ -806,8 +816,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":"402404","messageId":"20200729231428.3658647-14-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200729231428.3658647-1-sandals@crustytoothpaste.net","subject":"[PATCH v6 13/39] t7102: abstract away SHA-1-specific constants","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-29T23:14:02Z","receivedAt":"2020-07-29T23:14:56Z","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":"402405","messageId":"20200729231428.3658647-17-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200729231428.3658647-1-sandals@crustytoothpaste.net","subject":"[PATCH v6 16/39] t7506: avoid checking for SHA-1-specific constants","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-29T23:14:05Z","receivedAt":"2020-07-29T23:14:58Z","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":"402406","messageId":"20200729231428.3658647-18-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200729231428.3658647-1-sandals@crustytoothpaste.net","subject":"[PATCH v6 17/39] t7508: use $ZERO_OID instead of hard-coded constant","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-29T23:14:06Z","receivedAt":"2020-07-29T23:14:59Z","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":"402407","messageId":"20200729231428.3658647-20-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200729231428.3658647-1-sandals@crustytoothpaste.net","subject":"[PATCH v6 19/39] t8003: make hash size independent","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-29T23:14:08Z","receivedAt":"2020-07-29T23:15:02Z","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, 1 insertion(+), 2 deletions(-)\n\ndiff --git a/t/t8003-blame-corner-cases.sh b/t/t8003-blame-corner-cases.sh\nindex 9130b887d2..b871dd4f86 100755\n--- a/t/t8003-blame-corner-cases.sh\n+++ b/t/t8003-blame-corner-cases.sh\n@@ -6,7 +6,6 @@ test_description='git blame corner cases'\n pick_fc='s/^[0-9a-f^]* *\\([^ ]*\\) *(\\([^ ]*\\) .*/\\1-\\2/'\n \n test_expect_success setup '\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 &&\n@@ -306,7 +305,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":"402408","messageId":"20200729231428.3658647-23-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200729231428.3658647-1-sandals@crustytoothpaste.net","subject":"[PATCH v6 22/39] t9300: use $ZERO_OID instead of hard-coded object ID","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-29T23:14:11Z","receivedAt":"2020-07-29T23:15:03Z","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 f2d2cb06ad..308c1ef42c 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@@ -286,7 +286,7 @@ test_expect_success 'A: verify pack' '\n test_expect_success 'A: verify diff' '\n \tcopy=$(git rev-parse --verify master:file2) &&\n \tcat >expect <<-EOF &&\n-\t:000000 100755 0000000000000000000000000000000000000000 $copy A\tcopy-of-file2\n+\t:000000 100755 $ZERO_OID $copy A\tcopy-of-file2\n \tEOF\n \tgit diff-tree -M -r master verify--import-marks >actual &&\n \tcompare_diff_raw expect actual &&\n@@ -365,7 +365,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@@ -620,8 +620,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@@ -2733,7 +2733,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@@ -3084,7 +3084,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":"402409","messageId":"20200729231428.3658647-26-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200729231428.3658647-1-sandals@crustytoothpaste.net","subject":"[PATCH v6 25/39] t9500: ensure that algorithm info is preserved in config","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-29T23:14:14Z","receivedAt":"2020-07-29T23:15:04Z","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":"402410","messageId":"20200729231428.3658647-28-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200729231428.3658647-1-sandals@crustytoothpaste.net","subject":"[PATCH v6 27/39] t5308: make test work with SHA-256","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-29T23:14:16Z","receivedAt":"2020-07-29T23:15:06Z","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":"402411","messageId":"20200729231428.3658647-27-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200729231428.3658647-1-sandals@crustytoothpaste.net","subject":"[PATCH v6 26/39] t9700: make hash size independent","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-29T23:14:15Z","receivedAt":"2020-07-29T23:15:07Z","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":"402412","messageId":"20200729231428.3658647-32-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200729231428.3658647-1-sandals@crustytoothpaste.net","subject":"[PATCH v6 31/39] bundle: add new version for use with SHA-256","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-29T23:14:20Z","receivedAt":"2020-07-29T23:15:08Z","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                                  | 83 +++++++++++++++++------\n bundle.h                                  |  4 +-\n t/t5510-fetch.sh                          | 16 +++--\n t/t5607-clone-bundle.sh                   | 31 +++++++++\n 7 files changed, 147 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..35585f237c 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(_(\"unrecognized bundle hash algorithm: %s\"), arg);\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,19 +83,19 @@ 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 (*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\tif (header->version == 3 && *buf.buf == '@') {\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 \n \t\t/*\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 min_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 = min_version;\n+\n+\tif (version < 2 || version > 3) {\n+\t\tdie(_(\"unsupported bundle version %d\"), version);\n+\t} else if (version < min_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..9243335ab0 100755\n--- a/t/t5510-fetch.sh\n+++ b/t/t5510-fetch.sh\n@@ -281,15 +281,19 @@ 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 updated by origin\n+\tOID refs/heads/master\n+\n+\tEOF\n+\tsed -e \"s/$OID_REGEX/OID/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":"402413","messageId":"20200729231428.3658647-39-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200729231428.3658647-1-sandals@crustytoothpaste.net","subject":"[PATCH v6 38/39] docs: add documentation for extensions.objectFormat","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-29T23:14:27Z","receivedAt":"2020-07-29T23:15:10Z","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..4e23d73cdc\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":"402414","messageId":"20200729231428.3658647-34-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200729231428.3658647-1-sandals@crustytoothpaste.net","subject":"[PATCH v6 33/39] repository: enable SHA-256 support by default","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-29T23:14:22Z","receivedAt":"2020-07-29T23:15:10Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Now that we have a complete SHA-256 implementation in Git, let's enable\nit so people can use it.  Remove the ENABLE_SHA256 define constant\neverywhere it's used.  Add tests for initializing a repository with\nSHA-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   | 33 +++++++++++++++++++++++++++++++++\n 4 files changed, 33 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..d71d4c7238 100755\n--- a/t/t0001-init.sh\n+++ b/t/t0001-init.sh\n@@ -441,6 +441,39 @@ 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=sha1 explicit-sha1 &&\n+\tgit -C explicit-sha1 rev-parse --show-object-format >actual &&\n+\techo sha1 >expected &&\n+\ttest_cmp expected actual &&\n+\tgit init --object-format=sha256 explicit-sha256 &&\n+\tgit -C explicit-sha256 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":"402415","messageId":"20200729231428.3658647-38-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200729231428.3658647-1-sandals@crustytoothpaste.net","subject":"[PATCH v6 37/39] ci: run tests with SHA-256","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-29T23:14:26Z","receivedAt":"2020-07-29T23:15:12Z","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.  We explicitly specify SHA-1 for the first run so that if\nwe change the default in the future, we make sure to test both cases.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n ci/run-build-and-tests.sh | 6 ++++++\n 1 file changed, 6 insertions(+)\n\ndiff --git a/ci/run-build-and-tests.sh b/ci/run-build-and-tests.sh\nindex 17e25aade9..6c27b886b8 100755\n--- a/ci/run-build-and-tests.sh\n+++ b/ci/run-build-and-tests.sh\n@@ -24,6 +24,12 @@ linux-gcc)\n \texport GIT_TEST_ADD_I_USE_BUILTIN=1\n \tmake test\n \t;;\n+linux-clang)\n+\texport GIT_TEST_DEFAULT_HASH=sha1\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":"402416","messageId":"20200729231428.3658647-31-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200729231428.3658647-1-sandals@crustytoothpaste.net","subject":"[PATCH v6 30/39] builtin/verify-pack: implement an --object-format option","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-29T23:14:19Z","receivedAt":"2020-07-29T23:15:14Z","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  | 23 +++++++++++++++--------\n t/t5702-protocol-v2.sh |  2 +-\n 2 files changed, 16 insertions(+), 9 deletions(-)\n\ndiff --git a/builtin/verify-pack.c b/builtin/verify-pack.c\nindex c2a1a5c504..3669a90263 100644\n--- a/builtin/verify-pack.c\n+++ b/builtin/verify-pack.c\n@@ -7,21 +7,26 @@\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 argv_array *argv = &index_pack.args;\n \tstruct strbuf 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\targv_array_pushf(argv, \"--object-format=%s\", hash_algo);\n \n \t/*\n \t * In addition to \"foo.pack\" we accept \"foo.idx\" and \"foo\";\n@@ -31,9 +36,8 @@ 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.git_cmd = 1;\n \n \terr = run_command(&index_pack);\n@@ -60,12 +64,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 +82,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":"402417","messageId":"20200729231428.3658647-36-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200729231428.3658647-1-sandals@crustytoothpaste.net","subject":"[PATCH v6 35/39] t: allow testing different hash algorithms via environment","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-29T23:14:24Z","receivedAt":"2020-07-29T23:15:15Z","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":"402418","messageId":"20200729231428.3658647-33-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200729231428.3658647-1-sandals@crustytoothpaste.net","subject":"[PATCH v6 32/39] setup: add support for reading extensions.objectformat","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-29T23:14:21Z","receivedAt":"2020-07-29T23:15:16Z","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":"402419","messageId":"20200729231428.3658647-40-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200729231428.3658647-1-sandals@crustytoothpaste.net","subject":"[PATCH v6 39/39] t: remove test_oid_init in tests","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-29T23:14:28Z","receivedAt":"2020-07-29T23:15:19Z","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/t3308-notes-merge.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 28 files changed, 2 insertions(+), 37 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/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/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 &&\n"},{"id":"402420","messageId":"20200729231428.3658647-4-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200729231428.3658647-1-sandals@crustytoothpaste.net","subject":"[PATCH v6 03/39] t3305: make hash agnostic","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-29T23:13:52Z","receivedAt":"2020-07-29T23:15:20Z","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 | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/t/t3305-notes-fanout.sh b/t/t3305-notes-fanout.sh\nindex 3b4753e1b4..94c1b02251 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"},{"id":"402421","messageId":"20200729231428.3658647-6-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200729231428.3658647-1-sandals@crustytoothpaste.net","subject":"[PATCH v6 05/39] t6100: make hash size independent","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-29T23:13:54Z","receivedAt":"2020-07-29T23:15:21Z","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":"402422","messageId":"20200729231428.3658647-9-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200729231428.3658647-1-sandals@crustytoothpaste.net","subject":"[PATCH v6 08/39] t6500: specify test values for SHA-256","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-29T23:13:57Z","receivedAt":"2020-07-29T23:15:24Z","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":"402423","messageId":"20200729231428.3658647-1-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200728233446.3066485-1-sandals@crustytoothpaste.net","subject":"[PATCH v6 00/39] SHA-256, part 3/3","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-29T23:13:49Z","receivedAt":"2020-07-29T23:15:24Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Changes from v5:\n* Remove useless test_oid_init invocations throughout the series.\n* Fix a commit message for grammar and style.\n* Fix a typo in a shell case statement.\n* Fix http-fetch to allow parsing options before failing on a missing\n  git directory.\n\nChanges from v4:\n* Fix several commit message to fix typos and inaccuracies.\n* Remove useless touch statement in tests.\n* Adjust several tests to introduce less dependence on previous test\n  assertions other than the setup ones.\n* Loosen the regexp for object IDs in a Perl script in a test.\n* Ensure help functionality works for git http-fetch.\n* Switch http-fetch.c to use the already existing struct argv_array\n  instance.\n* Avoid a memory leak, albeit a minor one.\n* Improve error message for unknown bundle hash algorithm.\n* Hoist a strbuf_rtrim in the bundle parsing code to simplify things.\n* Specify a minimum version instead of a default version in the bundle\n  code.\n* Remove a useless line in tests.\n* Avoid invoking git hash-object needlessly for the SHA1 prerequisite.\n* Be explicit about which algorithms we're testing in CI.\n* Properly capitalize \"core.repositoryFormatVersion\" in documentation.\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  repository: 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                     |  23 ++--\n bundle.c                                  |  83 +++++++++---\n bundle.h                                  |   4 +-\n ci/run-build-and-tests.sh                 |   6 +\n config.mak.dev                            |   2 -\n http-fetch.c                              |   6 +-\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                           |  33 +++++\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                          |  16 ++-\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         | 150 ++++++++++++----------\n t/t7102-reset.sh                          |  93 ++++++++------\n t/t7201-co.sh                             |   6 +-\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                          |  18 ++-\n t/t8003-blame-corner-cases.sh             |   3 +-\n t/t8011-blame-split-file.sh               |   2 +-\n t/t9300-fast-import.sh                    | 118 +++++++++--------\n t/t9301-fast-import-notes.sh              |  12 +-\n t/t9350-fast-export.sh                    |  14 +-\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                             |   9 +-\n 74 files changed, 638 insertions(+), 351 deletions(-)\n create mode 100644 Documentation/config/extensions.txt\n\nDiff-intervalle contre v5 :\n 1:  2d720a6beb =  1:  fb53834bd3 t: make test-bloom initialize repository\n 2:  530704736a =  2:  8170f55d65 t1001: use $ZERO_OID\n 3:  33e7822d0e !  3:  94b585296d t3305: make hash agnostic\n    @@ t/t3305-notes-fanout.sh: test_description='Test that adding/removing many notes\n      \techo $path | grep -q \"^\\([0-9a-f]\\{2\\}/\\)\\{$fanout\\}[0-9a-f]\\{$after_last_slash\\}$\"\n      }\n      \n    -@@ t/t3305-notes-fanout.sh: 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 4:  99081937cf !  4:  82b373b830 t3404: prepare 'short SHA-1 collision' tests for SHA-256\n    @@ Commit message\n         Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n     \n      ## t/t3404-rebase-interactive.sh ##\n    -@@ t/t3404-rebase-interactive.sh: 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     @@ t/t3404-rebase-interactive.sh: test_expect_success 'rebase -i error on commits with \\ in message' '\n      \ttest_expect_code 1 grep  \"\temp\" error\n      '\n 5:  3cfa8bba75 =  5:  adc32c2903 t6100: make hash size independent\n 6:  9a7de5790c =  6:  40db5bb392 t6101: make hash size independent\n 7:  76942eec3d !  7:  d4055790f3 t6301: make hash size independent\n    @@ Commit message\n     \n         Instead of hard-coding a fixed length example object ID in the test,\n         compute one using the translation tables.  Move a variable into the\n    -    setup block so that we can ensure the exit status of test_oid_init is\n    +    setup block so that we can ensure the exit status of test_oid is\n         checked.\n     \n         Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n    @@ t/t6301-for-each-ref-errors.sh: test_description='for-each-ref errors for broken\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 8:  b30a8a6736 =  8:  a9578382ab t6500: specify test values for SHA-256\n 9:  c3d68dcf1b !  9:  b022dda379 t6501: avoid hard-coded objects\n    @@ Commit message\n         Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n     \n      ## t/t6501-freshen-objects.sh ##\n    -@@ t/t6501-freshen-objects.sh: 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     @@ t/t6501-freshen-objects.sh: for repack in '' true; do\n      done\n      \n10:  865662f5c5 ! 10:  d9eda002b9 t7003: compute appropriate length constant\n    @@ Commit message\n         Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n     \n      ## t/t7003-filter-branch.sh ##\n    -@@ t/t7003-filter-branch.sh: 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     @@ t/t7003-filter-branch.sh: test_expect_success 'rewrite submodule with another content' '\n      '\n      \n11:  1a7bd71fb4 = 11:  02da9e5630 t7063: make hash size independent\n12:  55c545cf1f = 12:  4f567ee443 t7201: abstract away SHA-1-specific constants\n13:  9875576b08 = 13:  cec9eca4a3 t7102: abstract away SHA-1-specific constants\n14:  d1a2f91516 = 14:  0408e53002 t7400: make hash size independent\n15:  9acdbf294c = 15:  3f0bb9751d t7405: make hash size independent\n16:  2b506517de = 16:  406c9088af t7506: avoid checking for SHA-1-specific constants\n17:  976974106c = 17:  bea582c49f t7508: use $ZERO_OID instead of hard-coded constant\n18:  459e6d2455 = 18:  bb044354bc t8002: make hash size independent\n19:  8c19b1280d ! 19:  888ffd32d3 t8003: make hash size independent\n    @@ t/t8003-blame-corner-cases.sh: 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    +-\n      \techo A A A A A >one &&\n      \techo B B B B B >two &&\n    + \techo C C C C C >tres &&\n     @@ t/t8003-blame-corner-cases.sh: test_expect_success 'blame coalesce' '\n      \t$oid 1) ABC\n      \t$oid 2) DEF\n20:  42e8d962dc = 20:  a6f7345990 t8011: make hash size independent\n21:  076249fdea = 21:  25458092e4 t9300: abstract away SHA-1-specific constants\n22:  36fed34e25 = 22:  637673d0f4 t9300: use $ZERO_OID instead of hard-coded object ID\n23:  fd2b44e138 ! 23:  77a42dbf51 t9301: make hash size independent\n    @@ Commit message\n         Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n     \n      ## t/t9301-fast-import-notes.sh ##\n    -@@ t/t9301-fast-import-notes.sh: 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     @@ t/t9301-fast-import-notes.sh: test_expect_success 'add lots of commits and notes' '\n      '\n      \n24:  5cf2612131 ! 24:  3c405c54fd t9350: make hash size independent\n    @@ Commit message\n         Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n     \n      ## t/t9350-fast-export.sh ##\n    -@@ t/t9350-fast-export.sh: 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     @@ t/t9350-fast-export.sh: test_expect_success 'reencoding iso-8859-7' '\n      \tsed \"s/wer/i18n/\" iso-8859-7.fi |\n      \t\t(cd new &&\n25:  64b56a029a = 25:  c75d879bca t9500: ensure that algorithm info is preserved in config\n26:  46800750af = 26:  82f2a6146f t9700: make hash size independent\n27:  9c5a7b9c38 = 27:  60d7922842 t5308: make test work with SHA-256\n28:  1a98d1e4b6 = 28:  c668823701 t0410: mark test with SHA1 prerequisite\n29:  359543b8de <  -:  ---------- http-fetch: set up git directory before parsing pack hashes\n -:  ---------- > 29:  e1e0e04e83 http-fetch: set up git directory before parsing pack hashes\n30:  bc5e6f6199 = 30:  96e770dce2 builtin/verify-pack: implement an --object-format option\n31:  10f9420219 = 31:  dd79604c8b bundle: add new version for use with SHA-256\n32:  59717a9f42 = 32:  425fdcca3d setup: add support for reading extensions.objectformat\n33:  8313384a88 ! 33:  e7256281f4 Enable SHA-256 support by default\n    @@ Metadata\n     Author: brian m. carlson <sandals@crustytoothpaste.net>\n     \n      ## Commit message ##\n    -    Enable SHA-256 support by default\n    +    repository: enable SHA-256 support by default\n     \n    -    Now that the we have a complete SHA-256 implementation in Git, let's\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    +    Now that we have a complete SHA-256 implementation in Git, let's enable\n    +    it so people can use it.  Remove the ENABLE_SHA256 define constant\n    +    everywhere it's used.  Add tests for initializing a repository with\n    +    SHA-256.\n     \n         Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n     \n34:  e8439aa0d0 = 34:  65d43826f6 t: add test_oid option to select hash algorithm\n35:  e5c9553da9 = 35:  d32ff6431b t: allow testing different hash algorithms via environment\n36:  2a6f2ccd55 ! 36:  8cc8c77f48 t: make SHA1 prerequisite depend on default hash\n    @@ t/test-lib.sh: test_lazy_prereq CURL '\n     +\tcase \"$GIT_DEFAULT_HASH\" in\n     +\tsha1) true ;;\n     +\t\"\") test $(git hash-object /dev/null) = e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 ;;\n    -+\t*) false ::\n    ++\t*) false ;;\n     +\tesac\n      '\n      \n37:  2eec901cdf = 37:  01d865b03e ci: run tests with SHA-256\n38:  6a7fb3e911 = 38:  83f565d1d2 docs: add documentation for extensions.objectFormat\n39:  448faa92fe ! 39:  6c3bf65a7d t: remove test_oid_init in tests\n    @@ t/t1500-rev-parse.sh: test_rev_parse () {\n      \tcp -R .git repo.git\n      '\n     \n    - ## t/t3305-notes-fanout.sh ##\n    -@@ t/t3305-notes-fanout.sh: 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    -\n      ## t/t3308-notes-merge.sh ##\n     @@ t/t3308-notes-merge.sh: test_expect_success setup '\n      \t# Copy notes to remote-notes\n    @@ t/t3308-notes-merge.sh: test_expect_success setup '\n      \thash4a sha1:5e93d24084d32e1cb61f7070505b9d2530cca987\n      \thash3a sha1:8366731eeee53787d2bdf8fc1eff7d94757e8da0\n     \n    - ## t/t3404-rebase-interactive.sh ##\n    -@@ t/t3404-rebase-interactive.sh: 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    -\n      ## t/t3600-rm.sh ##\n     @@ t/t3600-rm.sh: test_expect_success 'refresh index before checking if it is up-to-date' '\n      '\n    @@ t/t6006-rev-list-format.sh: changed_iso88591=$(echo \"$changed\" | iconv -f utf-8\n      \t: >foo &&\n      \tgit add foo &&\n      \tgit config i18n.commitEncoding $test_encoding &&\n    -\n    - ## t/t6301-for-each-ref-errors.sh ##\n    -@@ t/t6301-for-each-ref-errors.sh: 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 &&\n    -\n    - ## t/t6501-freshen-objects.sh ##\n    -@@ t/t6501-freshen-objects.sh: 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    -\n    - ## t/t7003-filter-branch.sh ##\n    -@@ t/t7003-filter-branch.sh: 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    -\n    - ## t/t8003-blame-corner-cases.sh ##\n    -@@ t/t8003-blame-corner-cases.sh: 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 &&\n    -\n    - ## t/t9301-fast-import-notes.sh ##\n    -@@ t/t9301-fast-import-notes.sh: 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    - '\n    -\n    - ## t/t9350-fast-export.sh ##\n    -@@ t/t9350-fast-export.sh: 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":"402424","messageId":"20200729231428.3658647-13-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200729231428.3658647-1-sandals@crustytoothpaste.net","subject":"[PATCH v6 12/39] t7201: abstract away SHA-1-specific constants","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-29T23:14:01Z","receivedAt":"2020-07-29T23:15: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/t7201-co.sh | 6 ++++--\n 1 file changed, 4 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t7201-co.sh b/t/t7201-co.sh\nindex b696bae5f5..4d62b9b00f 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@@ -248,9 +249,10 @@ test_expect_success 'checkout to detach HEAD (with advice declined)' '\n \n test_expect_success 'checkout to detach HEAD' '\n \tgit config advice.detachedHead true &&\n+\trev=$(git rev-parse --short renamer^) &&\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":"402425","messageId":"20200729231428.3658647-7-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200729231428.3658647-1-sandals@crustytoothpaste.net","subject":"[PATCH v6 06/39] t6101: make hash size independent","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-29T23:13:55Z","receivedAt":"2020-07-29T23:15:28Z","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":"402426","messageId":"20200729231428.3658647-19-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200729231428.3658647-1-sandals@crustytoothpaste.net","subject":"[PATCH v6 18/39] t8002: make hash size independent","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-29T23:14:07Z","receivedAt":"2020-07-29T23:15:29Z","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 hard-coding 40-based\nvalues.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n t/t8002-blame.sh | 18 +++++++++++-------\n 1 file changed, 11 insertions(+), 7 deletions(-)\n\ndiff --git a/t/t8002-blame.sh b/t/t8002-blame.sh\nindex eea048e52c..c3b70b025e 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+\thexsz=$(test_oid hexsz)\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,17 @@ 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+\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":"402427","messageId":"20200729231428.3658647-11-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200729231428.3658647-1-sandals@crustytoothpaste.net","subject":"[PATCH v6 10/39] t7003: compute appropriate length constant","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-29T23:13:59Z","receivedAt":"2020-07-29T23:15:30Z","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 | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git a/t/t7003-filter-branch.sh b/t/t7003-filter-branch.sh\nindex e23de7d0b5..36477cb1f4 100755\n--- a/t/t7003-filter-branch.sh\n+++ b/t/t7003-filter-branch.sh\n@@ -463,10 +463,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":"402428","messageId":"20200729231428.3658647-15-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200729231428.3658647-1-sandals@crustytoothpaste.net","subject":"[PATCH v6 14/39] t7400: make hash size independent","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-29T23:14:03Z","receivedAt":"2020-07-29T23:15:30Z","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":"402429","messageId":"20200729231428.3658647-16-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200729231428.3658647-1-sandals@crustytoothpaste.net","subject":"[PATCH v6 15/39] t7405: make hash size independent","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-29T23:14:04Z","receivedAt":"2020-07-29T23:15:32Z","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":"402430","messageId":"20200729231428.3658647-3-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200729231428.3658647-1-sandals@crustytoothpaste.net","subject":"[PATCH v6 02/39] t1001: use $ZERO_OID","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-29T23:13:51Z","receivedAt":"2020-07-29T23:15:32Z","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":"402431","messageId":"20200729231428.3658647-37-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200729231428.3658647-1-sandals@crustytoothpaste.net","subject":"[PATCH v6 36/39] t: make SHA1 prerequisite depend on default hash","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-29T23:14:25Z","receivedAt":"2020-07-29T23:15:33Z","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 | 6 +++++-\n 1 file changed, 5 insertions(+), 1 deletion(-)\n\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex 307bb2207e..0483ed51e1 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -1689,7 +1689,11 @@ 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+\tcase \"$GIT_DEFAULT_HASH\" in\n+\tsha1) true ;;\n+\t\"\") test $(git hash-object /dev/null) = e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 ;;\n+\t*) false ;;\n+\tesac\n '\n \n test_lazy_prereq REBASE_P '\n"},{"id":"402432","messageId":"20200729231428.3658647-29-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200729231428.3658647-1-sandals@crustytoothpaste.net","subject":"[PATCH v6 28/39] t0410: mark test with SHA1 prerequisite","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-29T23:14:17Z","receivedAt":"2020-07-29T23:15:35Z","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":"402433","messageId":"20200729231428.3658647-22-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200729231428.3658647-1-sandals@crustytoothpaste.net","subject":"[PATCH v6 21/39] t9300: abstract away SHA-1-specific constants","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-29T23:14:10Z","receivedAt":"2020-07-29T23:15:36Z","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.  In addition, use cut to filter out the object\nIDs and verify only the information that we're really interested in.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n t/t9300-fast-import.sh | 108 ++++++++++++++++++++++-------------------\n 1 file changed, 59 insertions(+), 49 deletions(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex e151df81c0..f2d2cb06ad 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -284,8 +284,9 @@ test_expect_success 'A: verify pack' '\n '\n \n test_expect_success 'A: verify diff' '\n+\tcopy=$(git rev-parse --verify master:file2) &&\n \tcat >expect <<-EOF &&\n-\t:000000 100755 0000000000000000000000000000000000000000 7123f7f44e39be127c5eb701e5968176ee9d78b1 A\tcopy-of-file2\n+\t:000000 100755 0000000000000000000000000000000000000000 $copy 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 +529,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 +572,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 +617,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 +784,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 +941,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 +1011,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 +1032,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 +1053,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 +1074,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 +1104,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 +1136,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 +1169,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 +1190,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 +1261,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 +1282,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 +1347,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 +3124,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 +3147,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 +3172,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 +3197,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":"402434","messageId":"20200729231428.3658647-25-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200729231428.3658647-1-sandals@crustytoothpaste.net","subject":"[PATCH v6 24/39] t9350: make hash size independent","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-29T23:14:13Z","receivedAt":"2020-07-29T23:15:38Z","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 | 14 +++++++-------\n 1 file changed, 7 insertions(+), 7 deletions(-)\n\ndiff --git a/t/t9350-fast-export.sh b/t/t9350-fast-export.sh\nindex 690c90fb82..1372842559 100755\n--- a/t/t9350-fast-export.sh\n+++ b/t/t9350-fast-export.sh\n@@ -132,12 +132,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 +164,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 +192,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 +694,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 +704,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":"402435","messageId":"20200729231428.3658647-24-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200729231428.3658647-1-sandals@crustytoothpaste.net","subject":"[PATCH v6 23/39] t9301: make hash size independent","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-29T23:14:12Z","receivedAt":"2020-07-29T23:15:39Z","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 | 12 ++++++------\n 1 file changed, 6 insertions(+), 6 deletions(-)\n\ndiff --git a/t/t9301-fast-import-notes.sh b/t/t9301-fast-import-notes.sh\nindex ca223dca98..14c1baa739 100755\n--- a/t/t9301-fast-import-notes.sh\n+++ b/t/t9301-fast-import-notes.sh\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":"402436","messageId":"20200729231428.3658647-21-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200729231428.3658647-1-sandals@crustytoothpaste.net","subject":"[PATCH v6 20/39] t8011: make hash size independent","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-29T23:14:09Z","receivedAt":"2020-07-29T23:15:39Z","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..bdda0c03fe 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,} /) {\n \t\t\tflush();\n \t\t\t$hash = $&;\n \t\t} elsif (/^$field (.*)/) {\n"},{"id":"402437","messageId":"20200729231428.3658647-30-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200729231428.3658647-1-sandals@crustytoothpaste.net","subject":"[PATCH v6 29/39] http-fetch: set up git directory before parsing pack hashes","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-29T23:14:18Z","receivedAt":"2020-07-29T23:15:41Z","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\nSince we still want to allow the invocation of -h to print the help when\nwe're not in a repository, gracefully handle us being outside of one and\nproduce an error after argument parsing has finished.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n http-fetch.c | 6 +++++-\n 1 file changed, 5 insertions(+), 1 deletion(-)\n\ndiff --git a/http-fetch.c b/http-fetch.c\nindex 1df376e745..c4ccc5fea9 100644\n--- a/http-fetch.c\n+++ b/http-fetch.c\n@@ -84,8 +84,11 @@ int cmd_main(int argc, const char **argv)\n \tint get_verbosely = 0;\n \tint get_recover = 0;\n \tint packfile = 0;\n+\tint nongit;\n \tstruct object_id packfile_hash;\n \n+\tsetup_git_directory_gently(&nongit);\n+\n \twhile (arg < argc && argv[arg][0] == '-') {\n \t\tconst char *p;\n \n@@ -115,7 +118,8 @@ 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+\tif (nongit)\n+\t\tdie(_(\"not a git repository\"));\n \n \tgit_config(git_default_config, NULL);\n \n"},{"id":"402438","messageId":"20200729231428.3658647-35-sandals@crustytoothpaste.net","threadId":"53944","inReplyTo":"20200729231428.3658647-1-sandals@crustytoothpaste.net","subject":"[PATCH v6 34/39] t: add test_oid option to select hash algorithm","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-07-29T23:14:23Z","receivedAt":"2020-07-29T23:15:42Z","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":"402452","messageId":"CAPig+cTxfheSPHJvC3_=jQjef0S7FiMEWCQ71ER7epfpeD_5OQ@mail.gmail.com","threadId":"53944","inReplyTo":"20200729231428.3658647-1-sandals@crustytoothpaste.net","subject":"Re: [PATCH v6 00/39] SHA-256, part 3/3","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2020-07-30T02:48:24Z","receivedAt":"2020-07-30T02:48:38Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Wed, Jul 29, 2020 at 7:15 PM brian m. carlson\n<sandals@crustytoothpaste.net> wrote:\n> Changes from v5:\n> * Remove useless test_oid_init invocations throughout the series.\n> * Fix a commit message for grammar and style.\n> * Fix a typo in a shell case statement.\n> * Fix http-fetch to allow parsing options before failing on a missing\n>   git directory.\n\nThanks, I think this version addresses all the comments from my\nreviews of the last several versions of this patch series.\n\nI've read through the entire series a couple times and paid close\nattention to the range-diffs, so FWIW, I'm reasonably comfortable\ngiving v6 my:\n\nReviewed-by: Eric Sunshine <sunshine@sunshineco.com>\n"},{"id":"402470","messageId":"xmqqmu3h6kp3.fsf@gitster.c.googlers.com","threadId":"53944","inReplyTo":"CAPig+cTxfheSPHJvC3_=jQjef0S7FiMEWCQ71ER7epfpeD_5OQ@mail.gmail.com","subject":"Re: [PATCH v6 00/39] SHA-256, part 3/3","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-07-30T16:18:00Z","receivedAt":"2020-07-30T16:18:10Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Eric Sunshine <sunshine@sunshineco.com> writes:\n\n> On Wed, Jul 29, 2020 at 7:15 PM brian m. carlson\n> <sandals@crustytoothpaste.net> wrote:\n>> Changes from v5:\n>> * Remove useless test_oid_init invocations throughout the series.\n>> * Fix a commit message for grammar and style.\n>> * Fix a typo in a shell case statement.\n>> * Fix http-fetch to allow parsing options before failing on a missing\n>>   git directory.\n>\n> Thanks, I think this version addresses all the comments from my\n> reviews of the last several versions of this patch series.\n>\n> I've read through the entire series a couple times and paid close\n> attention to the range-diffs, so FWIW, I'm reasonably comfortable\n> giving v6 my:\n>\n> Reviewed-by: Eric Sunshine <sunshine@sunshineco.com>\n\nThanks, both.\n\n"},{"id":"418684","messageId":"8735x3i59m.fsf@evledraar.gmail.com","threadId":"53944","inReplyTo":"20200729231428.3658647-1-sandals@crustytoothpaste.net","subject":"Re: [PATCH v6 00/39] SHA-256, part 3/3","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-03-10T12:04:37Z","receivedAt":"2021-03-10T12:05:24Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\n[I couldn't find a more relevant thing to reply to]\n\nOn Thu, Jul 30 2020, brian m. carlson wrote:\n\n> [...]\n\nB.t.w. thanks again for all your work on SHA-1 -> SHA-256.\n\nI found a missing spot that wasn't trivial to fix, so sending an E-Mail:\n\nIn git-filter-branch.sh we have:\n\n_x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'\n_x40=\"$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40\"\n\nThen later we have a case condition based on matching a SHA-1:\n\n        $_x40)\n                echo \"Ref '$ref' was rewritten\"\n                if ! git update-ref -m \"filter-branch: rewrite\" \\\n\nJust deleting that case arm has filter-branch tests passing, so whatever\nit's meant to do it has zero coverage, which explains why it hasn't\nbroken with our tests.\n\nI didn't have time to dig, so sending off this E-Mail instead.\n"},{"id":"418689","messageId":"CABPp-BFFLichkBY6Jh2qzE-=Md2eU5tZzHm4aVQVnVpJFD7b0w@mail.gmail.com","threadId":"53944","inReplyTo":"8735x3i59m.fsf@evledraar.gmail.com","subject":"Re: [PATCH v6 00/39] SHA-256, part 3/3","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2021-03-10T16:36:15Z","receivedAt":"2021-03-10T16:37:12Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Wed, Mar 10, 2021 at 4:04 AM Ævar Arnfjörð Bjarmason\n<avarab@gmail.com> wrote:\n>\n> [I couldn't find a more relevant thing to reply to]\n>\n> On Thu, Jul 30 2020, brian m. carlson wrote:\n>\n> > [...]\n>\n> B.t.w. thanks again for all your work on SHA-1 -> SHA-256.\n>\n> I found a missing spot that wasn't trivial to fix, so sending an E-Mail:\n>\n> In git-filter-branch.sh we have:\n>\n> _x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'\n> _x40=\"$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40\"\n>\n> Then later we have a case condition based on matching a SHA-1:\n>\n>         $_x40)\n>                 echo \"Ref '$ref' was rewritten\"\n>                 if ! git update-ref -m \"filter-branch: rewrite\" \\\n>\n> Just deleting that case arm has filter-branch tests passing, so whatever\n> it's meant to do it has zero coverage, which explains why it hasn't\n> broken with our tests.\n>\n> I didn't have time to dig, so sending off this E-Mail instead.\n\nHmm, perhaps we should revive the \"separate non-core tools out of\ngit.git\" thread --\nhttps://lore.kernel.org/git/a784a61e-1320-be1e-9dfb-d533a01827ec@gmail.com/.\n\nHonestly not sure it's worth bothering fixing filter-branch at this\npoint, given the strong WARNINGs we added to it.  If anything, I'd\njust add another warning to the pile for this issue.  If folks really\nstill want/need filter-branch once SHA-256 is the only option, I'm\nsure they'll be motivated to make the necessary fixes (or just use/fix\nfilter-repo's filter-branch-ish).\n"},{"id":"418691","messageId":"YEj8meoPn/g6tCe3@coredump.intra.peff.net","threadId":"53944","inReplyTo":"8735x3i59m.fsf@evledraar.gmail.com","subject":"[PATCH 0/3] sha256 fixes for filter-branch","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2021-03-10T17:06:33Z","receivedAt":"2021-03-10T17:07:08Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Mar 10, 2021 at 01:04:37PM +0100, Ævar Arnfjörð Bjarmason wrote:\n\n> I found a missing spot that wasn't trivial to fix, so sending an E-Mail:\n> \n> In git-filter-branch.sh we have:\n> \n> _x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'\n> _x40=\"$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40\"\n> \n> Then later we have a case condition based on matching a SHA-1:\n> \n>         $_x40)\n>                 echo \"Ref '$ref' was rewritten\"\n>                 if ! git update-ref -m \"filter-branch: rewrite\" \\\n> \n> Just deleting that case arm has filter-branch tests passing, so whatever\n> it's meant to do it has zero coverage, which explains why it hasn't\n> broken with our tests.\n\nIt actually does get covered. Dropping that case-arm means we'll fall\nthrough to the one below, which does _roughly_ the same thing with a\nbunch of extra warnings. But none of the tests actually check the error\nmessages, so they don't notice.\n\nHere's a series which fixes it, plus extra tests to notice the\ndistinction.\n\n  [1/3]: t7003: test ref rewriting explicitly\n  [2/3]: filter-branch: drop multiple-ancestor warning\n  [3/3]: filter-branch: drop $_x40 glob\n\n git-filter-branch.sh     | 16 ++--------------\n t/t7003-filter-branch.sh | 31 +++++++++++++++++++++++++++++++\n 2 files changed, 33 insertions(+), 14 deletions(-)\n\n-Peff\n"},{"id":"418692","messageId":"YEj82fOf+F4xJC8S@coredump.intra.peff.net","threadId":"53944","inReplyTo":"YEj8meoPn/g6tCe3@coredump.intra.peff.net","subject":"[PATCH 3/3] filter-branch: drop $_x40 glob","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2021-03-10T17:07:37Z","receivedAt":"2021-03-10T17:08:12Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"When checking whether a commit was rewritten to a single object id, we\nuse a glob that insists on a 40-hex result. This works for sha1, but\nfails t7003 when run with GIT_TEST_DEFAULT_HASH=sha256.\n\nSince the previous commit simplified the case statement here, we only\nhave two arms: an empty string or a single object id. We can just loosen\nour glob to match anything, and still distinguish those cases (we lose\nthe ability to notice bogus input, but that's not a problem; we are the\none who wrote the map in the first place, and anyway update-ref will\ncomplain loudly if the input isn't a valid hash).\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n git-filter-branch.sh | 7 +------\n 1 file changed, 1 insertion(+), 6 deletions(-)\n\ndiff --git a/git-filter-branch.sh b/git-filter-branch.sh\nindex a1e80bd552..cb89372813 100755\n--- a/git-filter-branch.sh\n+++ b/git-filter-branch.sh\n@@ -498,8 +498,6 @@ fi\n \n # Finally update the refs\n \n-_x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'\n-_x40=\"$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40\"\n echo\n while read ref\n do\n@@ -519,7 +517,7 @@ do\n \t\tgit update-ref -m \"filter-branch: delete\" -d \"$ref\" $sha1 ||\n \t\t\tdie \"Could not delete $ref\"\n \t;;\n-\t$_x40)\n+\t*)\n \t\techo \"Ref '$ref' was rewritten\"\n \t\tif ! git update-ref -m \"filter-branch: rewrite\" \\\n \t\t\t\t\t\"$ref\" $rewritten $sha1 2>/dev/null; then\n@@ -533,9 +531,6 @@ do\n \t\t\tfi\n \t\tfi\n \t;;\n-\t*)\n-\t\tdie \"BUG: multiple ancestors in map file?\"\n-\t;;\n \tesac\n \tgit update-ref -m \"filter-branch: backup\" \"$orig_namespace$ref\" $sha1 ||\n \t\t exit\n-- \n2.31.0.rc2.525.gc2268d2248\n"},{"id":"418693","messageId":"YEj8x5fQl1fyLGNg@coredump.intra.peff.net","threadId":"53944","inReplyTo":"YEj8meoPn/g6tCe3@coredump.intra.peff.net","subject":"[PATCH 1/3] t7003: test ref rewriting explicitly","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2021-03-10T17:07:19Z","receivedAt":"2021-03-10T17:08:12Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"After it has rewritten all of the commits, filter-branch will then\nrewrite each of the input refs based on the resulting map of old/new\ncommits. But we don't have any explicit test coverage of this code.\nLet's make sure we are covering each of those cases:\n\n  - deleting a ref when all of its commits were pruned\n\n  - rewriting a ref based on the mapping (this happens throughout the\n    script, but let's make sure we generate the correct messages)\n\n  - rewriting a ref whose tip was excluded, in which case we rewrite to\n    the nearest ancestor. Note in this case that we still insist that no\n    \"warning\" line is present (even though it looks like we'd trigger\n    the \"... was rewritten into multiple commits\" one). See the next\n    commit for more details.\n\nNote these all pass currently, but the latter two will fail when run\nwith GIT_TEST_DEFAULT_HASH=sha256.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n t/t7003-filter-branch.sh | 31 +++++++++++++++++++++++++++++++\n 1 file changed, 31 insertions(+)\n\ndiff --git a/t/t7003-filter-branch.sh b/t/t7003-filter-branch.sh\nindex 1c55695034..1349e5b232 100755\n--- a/t/t7003-filter-branch.sh\n+++ b/t/t7003-filter-branch.sh\n@@ -506,4 +506,35 @@ test_expect_success 'rewrite repository including refs that point at non-commit\n \t! fgrep fatal filter-output\n '\n \n+test_expect_success 'filter-branch handles ref deletion' '\n+\tgit switch --orphan empty-commit &&\n+\tgit commit --allow-empty -m \"empty commit\" &&\n+\tgit tag empty &&\n+\tgit branch to-delete &&\n+\tgit filter-branch -f --prune-empty to-delete >out 2>&1 &&\n+\tgrep \"to-delete.*was deleted\" out &&\n+\ttest_must_fail git rev-parse --verify to-delete\n+'\n+\n+test_expect_success 'filter-branch handles ref rewrite' '\n+\tgit checkout empty &&\n+\ttest_commit to-drop &&\n+\tgit branch rewrite &&\n+\tgit filter-branch -f \\\n+\t\t--index-filter \"git rm --ignore-unmatch --cached to-drop.t\" \\\n+\t\t rewrite >out 2>&1 &&\n+\tgrep \"rewrite.*was rewritten\" out &&\n+\t! grep -i warning out &&\n+\tgit diff-tree empty rewrite\n+'\n+\n+test_expect_success 'filter-branch handles ancestor rewrite' '\n+\ttest_commit to-exclude &&\n+\tgit branch ancestor &&\n+\tgit filter-branch -f ancestor -- :^to-exclude.t >out 2>&1 &&\n+\tgrep \"ancestor.*was rewritten\" out &&\n+\t! grep -i warning out &&\n+\tgit diff-tree HEAD^ ancestor\n+'\n+\n test_done\n-- \n2.31.0.rc2.525.gc2268d2248\n\n"},{"id":"418694","messageId":"YEj8zy5JX+KvlfGJ@coredump.intra.peff.net","threadId":"53944","inReplyTo":"YEj8meoPn/g6tCe3@coredump.intra.peff.net","subject":"[PATCH 2/3] filter-branch: drop multiple-ancestor warning","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2021-03-10T17:07:27Z","receivedAt":"2021-03-10T17:08:12Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"When a ref maps to a commit that is neither rewritten nor kept by\nfilter-branch (e.g., because it was eliminated by rev-list's pathspec\nselection), we rewrite it to its nearest ancestor.\n\nSince the initial commit in 6f6826c52b (Add git-filter-branch,\n2007-06-03), we have warned when there are multiple such ancestors in\nthe map file. However, the warning code is impossible to trigger these\ndays. Since a0e46390d3 (filter-branch: fix ref rewriting with\n--subdirectory-filter, 2008-08-12), we find the ancestor using \"rev-list\n-1\", so it can only ever have a single value.\n\nThis code is made doubly confusing by the fact that we append to the map\nfile when mapping ancestors. However, this can never yield multiple\nvalues because:\n\n  - we explicitly check whether the map already exists, and if so, do\n    nothing (so our \"append\" will always be to a file that does not\n    exist)\n\n  - even if we were to try mapping twice, the process to do so is\n    deterministic. I.e., we'd always end up with the same ancestor for a\n    given sha1. So warning about it would be pointless; there is no\n    ambiguity.\n\nSo swap out the warning code for a BUG (which we'll simplify further in\nthe next commit). And let's stop using the append operator to make the\nancestor-mapping code less confusing.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n git-filter-branch.sh | 11 ++---------\n 1 file changed, 2 insertions(+), 9 deletions(-)\n\ndiff --git a/git-filter-branch.sh b/git-filter-branch.sh\nindex fea7964617..a1e80bd552 100755\n--- a/git-filter-branch.sh\n+++ b/git-filter-branch.sh\n@@ -492,7 +492,7 @@ then\n \t\tsha1=$(git rev-parse \"$ref\"^0)\n \t\ttest -f \"$workdir\"/../map/$sha1 && continue\n \t\tancestor=$(git rev-list --simplify-merges -1 \"$ref\" \"$@\")\n-\t\ttest \"$ancestor\" && echo $(map $ancestor) >> \"$workdir\"/../map/$sha1\n+\t\ttest \"$ancestor\" && echo $(map $ancestor) >\"$workdir\"/../map/$sha1\n \tdone < \"$tempdir\"/heads\n fi\n \n@@ -534,14 +534,7 @@ do\n \t\tfi\n \t;;\n \t*)\n-\t\t# NEEDSWORK: possibly add -Werror, making this an error\n-\t\twarn \"WARNING: '$ref' was rewritten into multiple commits:\"\n-\t\twarn \"$rewritten\"\n-\t\twarn \"WARNING: Ref '$ref' points to the first one now.\"\n-\t\trewritten=$(echo \"$rewritten\" | head -n 1)\n-\t\tgit update-ref -m \"filter-branch: rewrite to first\" \\\n-\t\t\t\t\"$ref\" $rewritten $sha1 ||\n-\t\t\tdie \"Could not rewrite $ref\"\n+\t\tdie \"BUG: multiple ancestors in map file?\"\n \t;;\n \tesac\n \tgit update-ref -m \"filter-branch: backup\" \"$orig_namespace$ref\" $sha1 ||\n-- \n2.31.0.rc2.525.gc2268d2248\n\n"},{"id":"418695","messageId":"YEj9J5I7eInl3BAx@coredump.intra.peff.net","threadId":"53944","inReplyTo":"CABPp-BFFLichkBY6Jh2qzE-=Md2eU5tZzHm4aVQVnVpJFD7b0w@mail.gmail.com","subject":"Re: [PATCH v6 00/39] SHA-256, part 3/3","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2021-03-10T17:08:55Z","receivedAt":"2021-03-10T17:09:49Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Mar 10, 2021 at 08:36:15AM -0800, Elijah Newren wrote:\n\n> Honestly not sure it's worth bothering fixing filter-branch at this\n> point, given the strong WARNINGs we added to it.  If anything, I'd\n> just add another warning to the pile for this issue.  If folks really\n> still want/need filter-branch once SHA-256 is the only option, I'm\n> sure they'll be motivated to make the necessary fixes (or just use/fix\n> filter-repo's filter-branch-ish).\n\nYou're probably right that it's not a good use of time, but I just sent\na series fixing it. It was one of those cases where I was like \"oh, it's\nprobably just X\". And then \"no, wait...\", and before I knew it I had\nwasted an hour fixing filter-branch. ;)\n\n-Peff\n"},{"id":"418696","messageId":"CABPp-BH9epFANH15Om4095PHZTkNSAgV9o2cr5OD0vc0yWGMVg@mail.gmail.com","threadId":"53944","inReplyTo":"YEj8meoPn/g6tCe3@coredump.intra.peff.net","subject":"Re: [PATCH 0/3] sha256 fixes for filter-branch","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2021-03-10T17:54:37Z","receivedAt":"2021-03-10T17:55:36Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Wed, Mar 10, 2021 at 9:06 AM Jeff King <peff@peff.net> wrote:\n>\n> On Wed, Mar 10, 2021 at 01:04:37PM +0100, Ævar Arnfjörð Bjarmason wrote:\n>\n> > I found a missing spot that wasn't trivial to fix, so sending an E-Mail:\n> >\n> > In git-filter-branch.sh we have:\n> >\n> > _x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'\n> > _x40=\"$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40\"\n> >\n> > Then later we have a case condition based on matching a SHA-1:\n> >\n> >         $_x40)\n> >                 echo \"Ref '$ref' was rewritten\"\n> >                 if ! git update-ref -m \"filter-branch: rewrite\" \\\n> >\n> > Just deleting that case arm has filter-branch tests passing, so whatever\n> > it's meant to do it has zero coverage, which explains why it hasn't\n> > broken with our tests.\n>\n> It actually does get covered. Dropping that case-arm means we'll fall\n> through to the one below, which does _roughly_ the same thing with a\n> bunch of extra warnings. But none of the tests actually check the error\n> messages, so they don't notice.\n>\n> Here's a series which fixes it, plus extra tests to notice the\n> distinction.\n>\n>   [1/3]: t7003: test ref rewriting explicitly\n>   [2/3]: filter-branch: drop multiple-ancestor warning\n>   [3/3]: filter-branch: drop $_x40 glob\n>\n>  git-filter-branch.sh     | 16 ++--------------\n>  t/t7003-filter-branch.sh | 31 +++++++++++++++++++++++++++++++\n>  2 files changed, 33 insertions(+), 14 deletions(-)\n>\n> -Peff\n\nÆvar successfully nerd sniped you.\n\n...and sucked me in too, since I went through and read your patches.\n:-)  They look good to me.\n"},{"id":"418742","messageId":"xmqqtupiirin.fsf@gitster.g","threadId":"53944","inReplyTo":"YEj8zy5JX+KvlfGJ@coredump.intra.peff.net","subject":"Re: [PATCH 2/3] filter-branch: drop multiple-ancestor warning","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-03-10T22:16:16Z","receivedAt":"2021-03-10T22:17:12Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> When a ref maps to a commit that is neither rewritten nor kept by\n> filter-branch (e.g., because it was eliminated by rev-list's pathspec\n> selection), we rewrite it to its nearest ancestor.\n>\n> Since the initial commit in 6f6826c52b (Add git-filter-branch,\n> 2007-06-03), we have warned when there are multiple such ancestors in\n> the map file. However, the warning code is impossible to trigger these\n> days. Since a0e46390d3 (filter-branch: fix ref rewriting with\n> --subdirectory-filter, 2008-08-12), we find the ancestor using \"rev-list\n> -1\", so it can only ever have a single value.\n\n;-)\n\n"},{"id":"418745","messageId":"xmqqpn06ir6l.fsf@gitster.g","threadId":"53944","inReplyTo":"YEj82fOf+F4xJC8S@coredump.intra.peff.net","subject":"Re: [PATCH 3/3] filter-branch: drop $_x40 glob","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-03-10T22:23:30Z","receivedAt":"2021-03-10T22:24:08Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> When checking whether a commit was rewritten to a single object id, we\n> use a glob that insists on a 40-hex result. This works for sha1, but\n> fails t7003 when run with GIT_TEST_DEFAULT_HASH=sha256.\n>\n> Since the previous commit simplified the case statement here, we only\n> have two arms: an empty string or a single object id. We can just loosen\n> our glob to match anything, and still distinguish those cases (we lose\n> the ability to notice bogus input, but that's not a problem; we are the\n> one who wrote the map in the first place, and anyway update-ref will\n> complain loudly if the input isn't a valid hash).\n\nIf the input is any valid extended sha-1 expression, it probably\nwould not barf, so we technically are losing a bit of internal\nsafety valve to notice bogus rewrite (if the map recorded output of\n\"git describe --always\", this part would not notice and keep working\njust fine, but other parts of the code may not be happy).\n\nBut if this were a new code that said \"It is either empty of non-empty,\nand non-empty ones are object names we write, so we do not have to\ninsist it is hex object names\", it is very likely that we would\naccept it without any extra checks, so I think this is perfectly OK.\n\nThanks.\n\n> Signed-off-by: Jeff King <peff@peff.net>\n> ---\n>  git-filter-branch.sh | 7 +------\n>  1 file changed, 1 insertion(+), 6 deletions(-)\n>\n> diff --git a/git-filter-branch.sh b/git-filter-branch.sh\n> index a1e80bd552..cb89372813 100755\n> --- a/git-filter-branch.sh\n> +++ b/git-filter-branch.sh\n> @@ -498,8 +498,6 @@ fi\n>  \n>  # Finally update the refs\n>  \n> -_x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'\n> -_x40=\"$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40\"\n>  echo\n>  while read ref\n>  do\n> @@ -519,7 +517,7 @@ do\n>  \t\tgit update-ref -m \"filter-branch: delete\" -d \"$ref\" $sha1 ||\n>  \t\t\tdie \"Could not delete $ref\"\n>  \t;;\n> -\t$_x40)\n> +\t*)\n>  \t\techo \"Ref '$ref' was rewritten\"\n>  \t\tif ! git update-ref -m \"filter-branch: rewrite\" \\\n>  \t\t\t\t\t\"$ref\" $rewritten $sha1 2>/dev/null; then\n> @@ -533,9 +531,6 @@ do\n>  \t\t\tfi\n>  \t\tfi\n>  \t;;\n> -\t*)\n> -\t\tdie \"BUG: multiple ancestors in map file?\"\n> -\t;;\n>  \tesac\n>  \tgit update-ref -m \"filter-branch: backup\" \"$orig_namespace$ref\" $sha1 ||\n>  \t\t exit\n"},{"id":"418746","messageId":"xmqqlfauir4p.fsf@gitster.g","threadId":"53944","inReplyTo":"CABPp-BH9epFANH15Om4095PHZTkNSAgV9o2cr5OD0vc0yWGMVg@mail.gmail.com","subject":"Re: [PATCH 0/3] sha256 fixes for filter-branch","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-03-10T22:24:38Z","receivedAt":"2021-03-10T22:25:46Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Elijah Newren <newren@gmail.com> writes:\n\n> Ævar successfully nerd sniped you.\n>\n> ...and sucked me in too, since I went through and read your patches.\n> :-)  They look good to me.\n\nYup, thanks, both.\n"},{"id":"418752","messageId":"YElW9CXsL29zybOk@camp.crustytoothpaste.net","threadId":"53944","inReplyTo":"YEj8meoPn/g6tCe3@coredump.intra.peff.net","subject":"Re: [PATCH 0/3] sha256 fixes for filter-branch","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2021-03-10T23:32:04Z","receivedAt":"2021-03-10T23:33:43Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On 2021-03-10 at 17:06:33, Jeff King wrote:\n> It actually does get covered. Dropping that case-arm means we'll fall\n> through to the one below, which does _roughly_ the same thing with a\n> bunch of extra warnings. But none of the tests actually check the error\n> messages, so they don't notice.\n> \n> Here's a series which fixes it, plus extra tests to notice the\n> distinction.\n> \n>   [1/3]: t7003: test ref rewriting explicitly\n>   [2/3]: filter-branch: drop multiple-ancestor warning\n>   [3/3]: filter-branch: drop $_x40 glob\n\nThis series looked good to me.  Thanks for sending it.\n-- \nbrian m. carlson (he/him or they/them)\nHouston, Texas, US\n"},{"id":"418756","messageId":"87wnueh7nu.fsf@evledraar.gmail.com","threadId":"53944","inReplyTo":"YEj8x5fQl1fyLGNg@coredump.intra.peff.net","subject":"Re: [PATCH 1/3] t7003: test ref rewriting explicitly","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-03-11T00:10:29Z","receivedAt":"2021-03-11T00:11:20Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Wed, Mar 10 2021, Jeff King wrote:\n\n\nI've read it all over, looks good to me.\n\n> Note these all pass currently, but the latter two will fail when run\n> with GIT_TEST_DEFAULT_HASH=sha256.\n\nI don't know if anyone relies on that. Probably fine to have this as-is.\n\nBut wouldn't fixing that just be a matter of adding these tests as\ntest_expect_failure, and then flipping them to test_expect_success in\n3/3?\n"},{"id":"418757","messageId":"20210311001447.28254-2-avarab@gmail.com","threadId":"53944","inReplyTo":"YEj82fOf+F4xJC8S@coredump.intra.peff.net","subject":"[PATCH 1/4] git-bisect: remove unused SHA-1 $x40 shell variable","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-03-11T00:14:44Z","receivedAt":"2021-03-11T00:16:05Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"This variable was last used in code removed in\n06f5608c14 (bisect--helper: `bisect_start` shell function partially in\nC, 2019-01-02).\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n git-bisect.sh | 2 --\n 1 file changed, 2 deletions(-)\n\ndiff --git a/git-bisect.sh b/git-bisect.sh\nindex 6a7afaea8d..b59f3aaad4 100755\n--- a/git-bisect.sh\n+++ b/git-bisect.sh\n@@ -34,8 +34,6 @@ Please use \"git help bisect\" to get the full man page.'\n OPTIONS_SPEC=\n . git-sh-setup\n \n-_x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'\n-_x40=\"$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40\"\n TERM_BAD=bad\n TERM_GOOD=good\n \n-- \n2.31.0.rc1.213.gbfdb770ff55\n\n"},{"id":"418758","messageId":"20210311001447.28254-1-avarab@gmail.com","threadId":"53944","inReplyTo":"YEj82fOf+F4xJC8S@coredump.intra.peff.net","subject":"[PATCH 0/4] bisect + tests: remove old $_x05, $_x35 and $_x40 variables","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-03-11T00:14:43Z","receivedAt":"2021-03-11T00:16:05Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"A cleanup in the spirit of Jeff King's just-sent series:\nhttps://lore.kernel.org/git/YEj82fOf+F4xJC8S@coredump.intra.peff.net/\n\nApplies independently of that series though.\n\nÆvar Arnfjörð Bjarmason (4):\n  git-bisect: remove unused SHA-1 $x40 shell variable\n  test-lib: remove unused $_x40 and $_z40 variables\n  shortlog tests: rewrite to get rid of --abbrev=35 hardcoding\n  tests: get rid of $_x05 from the test suite\n\n git-bisect.sh                       |  2 -\n t/t3101-ls-tree-dirname.sh          |  2 +-\n t/t3508-cherry-pick-many-commits.sh |  4 +-\n t/t4201-shortlog.sh                 | 92 ++++++++++++++++-------------\n t/t6006-rev-list-format.sh          | 12 ++--\n t/t7600-merge.sh                    |  4 +-\n t/test-lib.sh                       |  9 +--\n 7 files changed, 65 insertions(+), 60 deletions(-)\n\n-- \n2.31.0.rc1.213.gbfdb770ff55\n\n"},{"id":"418760","messageId":"20210311001447.28254-5-avarab@gmail.com","threadId":"53944","inReplyTo":"YEj82fOf+F4xJC8S@coredump.intra.peff.net","subject":"[PATCH 4/4] tests: get rid of $_x05 from the test suite","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-03-11T00:14:47Z","receivedAt":"2021-03-11T00:16:05Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Remove the last users of the $_x05 variable from the tests. It turns\nout that all of these tests can be rewritten unambiguously to simply\nuse [0-9a-f]* instead.\n\nIn the case of the tree matching we're relying on there being a <TAB>\nafter the SHA (but a space between the modes and type), then in some\nof the other tests here that an abbreviated SHA is at the start of the\nline, etc.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n t/t3101-ls-tree-dirname.sh          |  2 +-\n t/t3508-cherry-pick-many-commits.sh |  4 ++--\n t/t6006-rev-list-format.sh          | 12 +++++++-----\n t/t7600-merge.sh                    |  4 ++--\n t/test-lib.sh                       |  6 +-----\n 5 files changed, 13 insertions(+), 15 deletions(-)\n\ndiff --git a/t/t3101-ls-tree-dirname.sh b/t/t3101-ls-tree-dirname.sh\nindex 12bf31022a..110ebf7d52 100755\n--- a/t/t3101-ls-tree-dirname.sh\n+++ b/t/t3101-ls-tree-dirname.sh\n@@ -187,7 +187,7 @@ EOF\n \n test_expect_success 'ls-tree --abbrev=5' '\n \tgit ls-tree --abbrev=5 $tree >current &&\n-\tsed -e \"s/ $_x05[0-9a-f]*\t/ X\t/\" <current >check &&\n+\tsed -e \"s/ [0-9a-f]*\t/ X\t/\" <current >check &&\n \tcat >expected <<\\EOF &&\n 100644 blob X\t1.txt\n 100644 blob X\t2.txt\ndiff --git a/t/t3508-cherry-pick-many-commits.sh b/t/t3508-cherry-pick-many-commits.sh\nindex e8375d1c97..1bf867d139 100755\n--- a/t/t3508-cherry-pick-many-commits.sh\n+++ b/t/t3508-cherry-pick-many-commits.sh\n@@ -84,7 +84,7 @@ test_expect_success 'output to keep user entertained during multi-pick' '\n \tgit reset --hard first &&\n \ttest_tick &&\n \tgit cherry-pick first..fourth >actual &&\n-\tsed -e \"s/$_x05[0-9a-f][0-9a-f]/OBJID/\" <actual >actual.fuzzy &&\n+\tsed -e \"s/ [0-9a-f]*\\\\]/ OBJID]/\" <actual >actual.fuzzy &&\n \ttest_line_count -ge 3 actual.fuzzy &&\n \ttest_cmp expected actual.fuzzy\n '\n@@ -122,7 +122,7 @@ test_expect_success 'output during multi-pick indicates merge strategy' '\n \tgit reset --hard first &&\n \ttest_tick &&\n \tgit cherry-pick --strategy resolve first..fourth >actual &&\n-\tsed -e \"s/$_x05[0-9a-f][0-9a-f]/OBJID/\" <actual >actual.fuzzy &&\n+\tsed -e \"s/ [0-9a-f]*\\\\]/ OBJID]/\" <actual >actual.fuzzy &&\n \ttest_cmp expected actual.fuzzy\n '\n \ndiff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh\nindex 35a2f62392..ec65081e17 100755\n--- a/t/t6006-rev-list-format.sh\n+++ b/t/t6006-rev-list-format.sh\n@@ -453,16 +453,18 @@ test_expect_success 'add SP before non-empty (2)' '\n '\n \n test_expect_success '--abbrev' '\n-\techo SHORT SHORT SHORT >expect2 &&\n \techo LONG LONG LONG >expect3 &&\n \tgit log -1 --format=\"%h %h %h\" HEAD >actual1 &&\n \tgit log -1 --abbrev=5 --format=\"%h %h %h\" HEAD >actual2 &&\n \tgit log -1 --abbrev=5 --format=\"%H %H %H\" HEAD >actual3 &&\n-\tsed -e \"s/$OID_REGEX/LONG/g\" -e \"s/$_x05/SHORT/g\" <actual2 >fuzzy2 &&\n-\tsed -e \"s/$OID_REGEX/LONG/g\" -e \"s/$_x05/SHORT/g\" <actual3 >fuzzy3 &&\n-\ttest_cmp expect2 fuzzy2 &&\n+\tsed -e \"s/$OID_REGEX/LONG/g\" <actual3 >fuzzy3 &&\n+\ttest_file_size actual2 >expect &&\n+\t# 3*5 SHAs + 3 separating spaces\n+\techo 18 >actual &&\n+\ttest_cmp expect actual &&\n \ttest_cmp expect3 fuzzy3 &&\n-\t! test_cmp actual1 actual2\n+\t! test_cmp actual1 actual2 &&\n+\t! test_cmp actual2 actual3\n '\n \n test_expect_success '%H is not affected by --abbrev-commit' '\ndiff --git a/t/t7600-merge.sh b/t/t7600-merge.sh\nindex 1cbc9715a8..fec5a7b2dd 100755\n--- a/t/t7600-merge.sh\n+++ b/t/t7600-merge.sh\n@@ -189,7 +189,7 @@ test_expect_success 'merge c0 with c1' '\n \tverify_head \"$c1\" &&\n \n \tgit reflog -1 >reflog.actual &&\n-\tsed \"s/$_x05[0-9a-f]*/OBJID/g\" reflog.actual >reflog.fuzzy &&\n+\tsed \"s/^[0-9a-f]*/OBJID/\" <reflog.actual >reflog.fuzzy &&\n \ttest_cmp reflog.expected reflog.fuzzy\n '\n \n@@ -220,7 +220,7 @@ test_expect_success 'merge from unborn branch' '\n \tverify_head \"$c1\" &&\n \n \tgit reflog -1 >reflog.actual &&\n-\tsed \"s/$_x05[0-9a-f][0-9a-f]/OBJID/g\" reflog.actual >reflog.fuzzy &&\n+\tsed \"s/^[0-9a-f]*/OBJID/g\" reflog.actual >reflog.fuzzy &&\n \ttest_cmp reflog.expected reflog.fuzzy\n '\n \ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex 4d5ba558d3..aeb4b2da1c 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -511,7 +511,7 @@ SQ=\\'\n # when case-folding filenames\n u200c=$(printf '\\342\\200\\214')\n \n-export _x05 LF u200c EMPTY_TREE EMPTY_BLOB ZERO_OID OID_REGEX\n+export LF u200c EMPTY_TREE EMPTY_BLOB ZERO_OID OID_REGEX\n \n # Each test should start with something like this, after copyright notices:\n #\n@@ -1380,10 +1380,6 @@ then\n \tfi\n fi\n \n-# Convenience\n-# A regexp to match 5 hexdigits\n-_x05='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'\n-\n test_oid_init\n \n ZERO_OID=$(test_oid zero)\n-- \n2.31.0.rc1.213.gbfdb770ff55\n\n"},{"id":"418761","messageId":"20210311001447.28254-4-avarab@gmail.com","threadId":"53944","inReplyTo":"YEj82fOf+F4xJC8S@coredump.intra.peff.net","subject":"[PATCH 3/4] shortlog tests: rewrite to get rid of --abbrev=35 hardcoding","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-03-11T00:14:46Z","receivedAt":"2021-03-11T00:16:05Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Rewrite much of the test logic introduced in 600372497c (shortlog:\nDocument and test --format option, 2010-05-03), this allows us to get\nrid of the now-unused $_x35 variable in test-lib.sh\n\nThere was a minimal migration of this test to SHA-256 in\n2ece6ad281 (t: switch $_x40 to $OID_REGEX, 2018-05-13), but actually\nwe can just get rid of all the assumptions about hashing here, and\nmake this easier to understand and maintain while we're at it.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n t/t4201-shortlog.sh | 92 +++++++++++++++++++++++++--------------------\n t/test-lib.sh       |  5 +--\n 2 files changed, 54 insertions(+), 43 deletions(-)\n\ndiff --git a/t/t4201-shortlog.sh b/t/t4201-shortlog.sh\nindex 3095b1b2ff..3ef17c06e4 100755\n--- a/t/t4201-shortlog.sh\n+++ b/t/t4201-shortlog.sh\n@@ -19,82 +19,94 @@ test_expect_success 'setup' '\n \tcommit=$(printf \"%s\\n\" \"Test\" \"\" | git commit-tree \"$tree\") &&\n \tgit update-ref HEAD \"$commit\" &&\n \n+\techo \"This is a very, very long first line for the commit message to see if it is wrapped correctly\" >message &&\n+\n+\tsed \"s/i/1234/g\" <message >tmp &&\n+\ttr 1234 \"\\360\\235\\204\\236\" <tmp >message.2 &&\n+\n+\tsed \"s/i/1234/g\" <message >tmp &&\n+\ttr 1234 \"\\370\\235\\204\\236\" <tmp >message.3 &&\n+\n+\techo \"a\t\t\t\t\t\t\t\t12\t34\t56\t78\" >message.4 &&\n+\techo \"Commit by someone else\" >message.5 &&\n+\n \techo 2 >a1 &&\n-\tgit commit --quiet -m \"This is a very, very long first line for the commit message to see if it is wrapped correctly\" a1 &&\n+\tgit commit --quiet -F message a1 &&\n \n \t# test if the wrapping is still valid\n \t# when replacing all is by treble clefs.\n \techo 3 >a1 &&\n-\tgit commit --quiet -m \"$(\n-\t\techo \"This is a very, very long first line for the commit message to see if it is wrapped correctly\" |\n-\t\tsed \"s/i/1234/g\" |\n-\t\ttr 1234 \"\\360\\235\\204\\236\")\" a1 &&\n+\tgit commit --quiet -F message.2 a1 &&\n \n \t# now fsck up the utf8\n \tgit config i18n.commitencoding non-utf-8 &&\n \techo 4 >a1 &&\n-\tgit commit --quiet -m \"$(\n-\t\techo \"This is a very, very long first line for the commit message to see if it is wrapped correctly\" |\n-\t\tsed \"s/i/1234/g\" |\n-\t\ttr 1234 \"\\370\\235\\204\\236\")\" a1 &&\n+\tgit commit --quiet -F message.3 a1 &&\n \n \techo 5 >a1 &&\n-\tgit commit --quiet -m \"a\t\t\t\t\t\t\t\t12\t34\t56\t78\" a1 &&\n+\tgit commit --quiet -F message.4 a1 &&\n \n \techo 6 >a1 &&\n-\tgit commit --quiet -m \"Commit by someone else\" \\\n+\tgit commit --quiet -F message.5  \\\n \t\t--author=\"Someone else <not!me>\" a1 &&\n \n-\tcat >expect.template <<-\\EOF\n+\tcat >expect.default <<-EOF\n \tA U Thor (5):\n-\t      SUBJECT\n-\t      SUBJECT\n-\t      SUBJECT\n-\t      SUBJECT\n-\t      SUBJECT\n+\t      Test\n+\t      $(cat message)\n+\t      $(cat message.2)\n+\t      $(cat message.3)\n+\t      $(cat message.4)\n \n \tSomeone else (1):\n-\t      SUBJECT\n+\t      $(cat message.5)\n \n \tEOF\n '\n \n-fuzz() {\n-\tfile=$1 &&\n-\tsed \"\n-\t\t\ts/$OID_REGEX/OBJECT_NAME/g\n-\t\t\ts/$_x35/OBJID/g\n-\t\t\ts/^ \\{6\\}[CTa].*/      SUBJECT/g\n-\t\t\ts/^ \\{8\\}[^ ].*/        CONTINUATION/g\n-\t\t\" <\"$file\" >\"$file.fuzzy\" &&\n-\tsed \"/CONTINUATION/ d\" <\"$file.fuzzy\"\n-}\n-\n test_expect_success 'default output format' '\n \tgit shortlog HEAD >log &&\n-\tfuzz log >log.predictable &&\n-\ttest_cmp expect.template log.predictable\n+\ttest_cmp expect.default log\n '\n \n test_expect_success 'pretty format' '\n-\tsed s/SUBJECT/OBJECT_NAME/ expect.template >expect &&\n+\tcat >expect <<-EOF &&\n+\tA U Thor (5):\n+\t      $(git rev-parse HEAD~5)\n+\t      $(git rev-parse HEAD~4)\n+\t      $(git rev-parse HEAD~3)\n+\t      $(git rev-parse HEAD~2)\n+\t      $(git rev-parse HEAD~1)\n+\n+\tSomeone else (1):\n+\t      $(git rev-parse HEAD~0)\n+\n+\tEOF\n \tgit shortlog --format=\"%H\" HEAD >log &&\n-\tfuzz log >log.predictable &&\n-\ttest_cmp expect log.predictable\n+\ttest_cmp expect log\n '\n \n test_expect_success '--abbrev' '\n-\tsed s/SUBJECT/OBJID/ expect.template >expect &&\n+\tcut -c 1-41 <expect >expect.abbrev &&\n \tgit shortlog --format=\"%h\" --abbrev=35 HEAD >log &&\n-\tfuzz log >log.predictable &&\n-\ttest_cmp expect log.predictable\n+\ttest_cmp expect.abbrev log\n '\n \n test_expect_success 'output from user-defined format is re-wrapped' '\n-\tsed \"s/SUBJECT/two lines/\" expect.template >expect &&\n+\tcat >expect <<-EOF &&\n+\tA U Thor (5):\n+\t      two lines\n+\t      two lines\n+\t      two lines\n+\t      two lines\n+\t      two lines\n+\n+\tSomeone else (1):\n+\t      two lines\n+\n+\tEOF\n \tgit shortlog --format=\"two%nlines\" HEAD >log &&\n-\tfuzz log >log.predictable &&\n-\ttest_cmp expect log.predictable\n+\ttest_cmp expect log\n '\n \n test_expect_success !MINGW 'shortlog wrapping' '\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex 5f2ad2fd81..4d5ba558d3 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -511,7 +511,7 @@ SQ=\\'\n # when case-folding filenames\n u200c=$(printf '\\342\\200\\214')\n \n-export _x05 _x35 LF u200c EMPTY_TREE EMPTY_BLOB ZERO_OID OID_REGEX\n+export _x05 LF u200c EMPTY_TREE EMPTY_BLOB ZERO_OID OID_REGEX\n \n # Each test should start with something like this, after copyright notices:\n #\n@@ -1381,9 +1381,8 @@ then\n fi\n \n # Convenience\n-# A regexp to match 5 and 35 hexdigits\n+# A regexp to match 5 hexdigits\n _x05='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'\n-_x35=\"$_x05$_x05$_x05$_x05$_x05$_x05$_x05\"\n \n test_oid_init\n \n-- \n2.31.0.rc1.213.gbfdb770ff55\n\n"},{"id":"418759","messageId":"20210311001447.28254-3-avarab@gmail.com","threadId":"53944","inReplyTo":"YEj82fOf+F4xJC8S@coredump.intra.peff.net","subject":"[PATCH 2/4] test-lib: remove unused $_x40 and $_z40 variables","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-03-11T00:14:45Z","receivedAt":"2021-03-11T00:16:06Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"These two have fallen out of use with the SHA-256 migration.\n\nThe last use of $_x40 was removed in fc7e73d7ef (t4013: improve\ndiff-post-processor logic, 2020-08-21) and\n\nThe last use of $_z40 was removed in 7a868c51c2 (t5562: use $ZERO_OID,\n2019-12-21), but it was then needlessly refactored to be hash-agnostic\nin 192b517589 (t: use hash-specific lookup tables to define test\nconstants, 2020-02-22). We can just remove it.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n t/test-lib.sh | 6 ++----\n 1 file changed, 2 insertions(+), 4 deletions(-)\n\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex d3f6af6a65..5f2ad2fd81 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -511,7 +511,7 @@ SQ=\\'\n # when case-folding filenames\n u200c=$(printf '\\342\\200\\214')\n \n-export _x05 _x35 _x40 _z40 LF u200c EMPTY_TREE EMPTY_BLOB ZERO_OID OID_REGEX\n+export _x05 _x35 LF u200c EMPTY_TREE EMPTY_BLOB ZERO_OID OID_REGEX\n \n # Each test should start with something like this, after copyright notices:\n #\n@@ -1381,10 +1381,9 @@ then\n fi\n \n # Convenience\n-# A regexp to match 5, 35 and 40 hexdigits\n+# A regexp to match 5 and 35 hexdigits\n _x05='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'\n _x35=\"$_x05$_x05$_x05$_x05$_x05$_x05$_x05\"\n-_x40=\"$_x35$_x05\"\n \n test_oid_init\n \n@@ -1393,7 +1392,6 @@ OID_REGEX=$(echo $ZERO_OID | sed -e 's/0/[0-9a-f]/g')\n OIDPATH_REGEX=$(test_oid_to_path $ZERO_OID | sed -e 's/0/[0-9a-f]/g')\n EMPTY_TREE=$(test_oid empty_tree)\n EMPTY_BLOB=$(test_oid empty_blob)\n-_z40=$ZERO_OID\n \n # Provide an implementation of the 'yes' utility; the upper bound\n # limit is there to help Windows that cannot stop this loop from\n-- \n2.31.0.rc1.213.gbfdb770ff55\n\n"},{"id":"418774","messageId":"xmqqh7lih590.fsf@gitster.g","threadId":"53944","inReplyTo":"20210311001447.28254-3-avarab@gmail.com","subject":"Re: [PATCH 2/4] test-lib: remove unused $_x40 and $_z40 variables","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-03-11T01:02:35Z","receivedAt":"2021-03-11T01:03:42Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:\n\n> These two have fallen out of use with the SHA-256 migration.\n>\n> The last use of $_x40 was removed in fc7e73d7ef (t4013: improve\n> diff-post-processor logic, 2020-08-21) and\n>\n> The last use of $_z40 was removed in 7a868c51c2 (t5562: use $ZERO_OID,\n> 2019-12-21), but it was then needlessly refactored to be hash-agnostic\n> in 192b517589 (t: use hash-specific lookup tables to define test\n> constants, 2020-02-22). We can just remove it.\n>\n> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n> ---\n>  t/test-lib.sh | 6 ++----\n>  1 file changed, 2 insertions(+), 4 deletions(-)\n\nNice.  Curious why we still want x5 and x35, but we'll learn soon\nenough in this short series ;-)\n\n\n> diff --git a/t/test-lib.sh b/t/test-lib.sh\n> index d3f6af6a65..5f2ad2fd81 100644\n> --- a/t/test-lib.sh\n> +++ b/t/test-lib.sh\n> @@ -511,7 +511,7 @@ SQ=\\'\n>  # when case-folding filenames\n>  u200c=$(printf '\\342\\200\\214')\n>  \n> -export _x05 _x35 _x40 _z40 LF u200c EMPTY_TREE EMPTY_BLOB ZERO_OID OID_REGEX\n> +export _x05 _x35 LF u200c EMPTY_TREE EMPTY_BLOB ZERO_OID OID_REGEX\n>  \n>  # Each test should start with something like this, after copyright notices:\n>  #\n> @@ -1381,10 +1381,9 @@ then\n>  fi\n>  \n>  # Convenience\n> -# A regexp to match 5, 35 and 40 hexdigits\n> +# A regexp to match 5 and 35 hexdigits\n>  _x05='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'\n>  _x35=\"$_x05$_x05$_x05$_x05$_x05$_x05$_x05\"\n> -_x40=\"$_x35$_x05\"\n>  \n>  test_oid_init\n>  \n> @@ -1393,7 +1392,6 @@ OID_REGEX=$(echo $ZERO_OID | sed -e 's/0/[0-9a-f]/g')\n>  OIDPATH_REGEX=$(test_oid_to_path $ZERO_OID | sed -e 's/0/[0-9a-f]/g')\n>  EMPTY_TREE=$(test_oid empty_tree)\n>  EMPTY_BLOB=$(test_oid empty_blob)\n> -_z40=$ZERO_OID\n>  \n>  # Provide an implementation of the 'yes' utility; the upper bound\n>  # limit is there to help Windows that cannot stop this loop from\n"},{"id":"418775","messageId":"xmqqczw6h4i2.fsf@gitster.g","threadId":"53944","inReplyTo":"20210311001447.28254-4-avarab@gmail.com","subject":"Re: [PATCH 3/4] shortlog tests: rewrite to get rid of --abbrev=35 hardcoding","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-03-11T01:18:45Z","receivedAt":"2021-03-11T01:19:39Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:\n\n> +\tcat >expect <<-EOF &&\n> +\tA U Thor (5):\n> +\t      $(git rev-parse HEAD~5)\n> +\t      $(git rev-parse HEAD~4)\n> +\t      $(git rev-parse HEAD~3)\n> +\t      $(git rev-parse HEAD~2)\n> +\t      $(git rev-parse HEAD~1)\n> +\n> +\tSomeone else (1):\n> +\t      $(git rev-parse HEAD~0)\n> +\n> +\tEOF\n> ...\n>  test_expect_success '--abbrev' '\n> -\tsed s/SUBJECT/OBJID/ expect.template >expect &&\n> +\tcut -c 1-41 <expect >expect.abbrev &&\n>  \tgit shortlog --format=\"%h\" --abbrev=35 HEAD >log &&\n\nThe hardcoded 35 is a bit curious, and 1-41 even more so.\n\nIs the idea that the \"expect\" prepared earlier has full hexdigits\nand indented by 6 columns, the full hexdigits for an object name is\nlonger than 35 chars in any hash algorithm we use, any sample name\nplus (number) plus colon won't be 35 chars long, and 35+6 happens to\nbe 41 so cutting at 41 column we'd get the first 35 hexdigits of the\nobject names without losing anything on the summary line?\n\nThat's a bit too subtle to my taste, but \n\n\ttest_expect_success '--abbrev' '\n\t\tabbrev=35 &&\n\t\tcut -c 1-$(( abbrev + 6 )) expect >expect.abbrev &&\n\t\tgit shortlog --format=\"%h\" --abbrev=$abbrev HEAD >log &&\n\t\t...\n\nmay not make it much easier to follow (without explaining what that\n6 is anyway), so I'll let it pass.\n\nOtherwise the steps so far make quite a lot of sense.\n\nThanks.\n\n\n\n\n\n\n"},{"id":"418776","messageId":"xmqq8s6uh4a2.fsf@gitster.g","threadId":"53944","inReplyTo":"20210311001447.28254-5-avarab@gmail.com","subject":"Re: [PATCH 4/4] tests: get rid of $_x05 from the test suite","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-03-11T01:23:33Z","receivedAt":"2021-03-11T01:24:30Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:\n\n> Remove the last users of the $_x05 variable from the tests. It turns\n> out that all of these tests can be rewritten unambiguously to simply\n> use [0-9a-f]* instead.\n\nI am unsure about the \"unambiguously\" part, e.g.\n\n> -\tsed -e \"s/ $_x05[0-9a-f]*\t/ X\t/\" <current >check &&\n> +\tsed -e \"s/ [0-9a-f]*\t/ X\t/\" <current >check &&\n\ndoes't the preimage say \"we expect at least 5 hexdigits to be shown\nhere\"?  The postimage lets even an empty string to pass. \n\n> In the case of the tree matching we're relying on there being a <TAB>\n> after the SHA (but a space between the modes and type), then in some\n> of the other tests here that an abbreviated SHA is at the start of the\n> line, etc.\n\nSure, but these being tests, I am not sure we should be assuming the\ncorrect input to these transformations.\n\n>  test_expect_success 'ls-tree --abbrev=5' '\n>  \tgit ls-tree --abbrev=5 $tree >current &&\n> -\tsed -e \"s/ $_x05[0-9a-f]*\t/ X\t/\" <current >check &&\n> +\tsed -e \"s/ [0-9a-f]*\t/ X\t/\" <current >check &&\n>  \tcat >expected <<\\EOF &&\n>  100644 blob X\t1.txt\n>  100644 blob X\t2.txt\n\nThis one is particularly iffy.  The --abbrev=5 test is designed to\nensure that the resulting abbreviated object names are at least 5\nhexdigits long, even when the repository is so small that only 4\nhexdigits are sufficient to avoid ambiguity, while allowing the\noutput to be longer than specified 5 (when 5 turns out to be\ninsufficient for disambiguation).\n\nSo, I dunno.\n"},{"id":"418778","messageId":"YEl4eAR+rsayCpfT@camp.crustytoothpaste.net","threadId":"53944","inReplyTo":"87wnueh7nu.fsf@evledraar.gmail.com","subject":"Re: [PATCH 1/3] t7003: test ref rewriting explicitly","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2021-03-11T01:55:04Z","receivedAt":"2021-03-11T01:55:52Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On 2021-03-11 at 00:10:29, Ævar Arnfjörð Bjarmason wrote:\n> \n> On Wed, Mar 10 2021, Jeff King wrote:\n> \n> \n> I've read it all over, looks good to me.\n> \n> > Note these all pass currently, but the latter two will fail when run\n> > with GIT_TEST_DEFAULT_HASH=sha256.\n> \n> I don't know if anyone relies on that. Probably fine to have this as-is.\n\nOur CI runs that way, and I always use that mode.  Are you saying that\nthese will always fail in that mode, or that they will pass at the end\nof the series?\n-- \nbrian m. carlson (he/him or they/them)\nHouston, Texas, US\n"},{"id":"418818","messageId":"YEl/XRnbu5FBV+PE@coredump.intra.peff.net","threadId":"53944","inReplyTo":"YEl4eAR+rsayCpfT@camp.crustytoothpaste.net","subject":"Re: [PATCH 1/3] t7003: test ref rewriting explicitly","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2021-03-11T02:24:29Z","receivedAt":"2021-03-11T02:25:13Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Mar 11, 2021 at 01:55:04AM +0000, brian m. carlson wrote:\n\n> On 2021-03-11 at 00:10:29, Ævar Arnfjörð Bjarmason wrote:\n> > \n> > On Wed, Mar 10 2021, Jeff King wrote:\n> > \n> > \n> > I've read it all over, looks good to me.\n> > \n> > > Note these all pass currently, but the latter two will fail when run\n> > > with GIT_TEST_DEFAULT_HASH=sha256.\n> > \n> > I don't know if anyone relies on that. Probably fine to have this as-is.\n> \n> Our CI runs that way, and I always use that mode.  Are you saying that\n> these will always fail in that mode, or that they will pass at the end\n> of the series?\n\nThe latter; everything passes at the end. The only thing that is hurt is\nif we care about bisecting the tests with GIT_TEST_DEFAULT_HASH set\n\n-Peff\n"},{"id":"418819","messageId":"YEmFKYyV7DriqlY1@camp.crustytoothpaste.net","threadId":"53944","inReplyTo":"YEl/XRnbu5FBV+PE@coredump.intra.peff.net","subject":"Re: [PATCH 1/3] t7003: test ref rewriting explicitly","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2021-03-11T02:49:13Z","receivedAt":"2021-03-11T02:50:09Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On 2021-03-11 at 02:24:29, Jeff King wrote:\n> On Thu, Mar 11, 2021 at 01:55:04AM +0000, brian m. carlson wrote:\n> \n> > On 2021-03-11 at 00:10:29, Ævar Arnfjörð Bjarmason wrote:\n> > > \n> > > On Wed, Mar 10 2021, Jeff King wrote:\n> > > \n> > > > Note these all pass currently, but the latter two will fail when run\n> > > > with GIT_TEST_DEFAULT_HASH=sha256.\n> > > \n> > > I don't know if anyone relies on that. Probably fine to have this as-is.\n> > \n> > Our CI runs that way, and I always use that mode.  Are you saying that\n> > these will always fail in that mode, or that they will pass at the end\n> > of the series?\n> \n> The latter; everything passes at the end. The only thing that is hurt is\n> if we care about bisecting the tests with GIT_TEST_DEFAULT_HASH set\n\nI don't have a strong opinion on this.  I'm unlikely to bisect with the\nfull testsuite in that way; I'd use a git bisect run with a smaller\ntestcase.\n-- \nbrian m. carlson (he/him or they/them)\nHouston, Texas, US\n"},{"id":"418836","messageId":"87tupigf02.fsf@evledraar.gmail.com","threadId":"53944","inReplyTo":"xmqq8s6uh4a2.fsf@gitster.g","subject":"Re: [PATCH 4/4] tests: get rid of $_x05 from the test suite","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-03-11T10:29:33Z","receivedAt":"2021-03-11T10:30:26Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Thu, Mar 11 2021, Junio C Hamano wrote:\n\n> Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:\n>\n>> Remove the last users of the $_x05 variable from the tests. It turns\n>> out that all of these tests can be rewritten unambiguously to simply\n>> use [0-9a-f]* instead.\n>\n> I am unsure about the \"unambiguously\" part, e.g.\n>\n>> -\tsed -e \"s/ $_x05[0-9a-f]*\t/ X\t/\" <current >check &&\n>> +\tsed -e \"s/ [0-9a-f]*\t/ X\t/\" <current >check &&\n>\n> does't the preimage say \"we expect at least 5 hexdigits to be shown\n> here\"?  The postimage lets even an empty string to pass. \n>\n>> In the case of the tree matching we're relying on there being a <TAB>\n>> after the SHA (but a space between the modes and type), then in some\n>> of the other tests here that an abbreviated SHA is at the start of the\n>> line, etc.\n>\n> Sure, but these being tests, I am not sure we should be assuming the\n> correct input to these transformations.\n>\n>>  test_expect_success 'ls-tree --abbrev=5' '\n>>  \tgit ls-tree --abbrev=5 $tree >current &&\n>> -\tsed -e \"s/ $_x05[0-9a-f]*\t/ X\t/\" <current >check &&\n>> +\tsed -e \"s/ [0-9a-f]*\t/ X\t/\" <current >check &&\n>>  \tcat >expected <<\\EOF &&\n>>  100644 blob X\t1.txt\n>>  100644 blob X\t2.txt\n>\n> This one is particularly iffy.  The --abbrev=5 test is designed to\n> ensure that the resulting abbreviated object names are at least 5\n> hexdigits long, even when the repository is so small that only 4\n> hexdigits are sufficient to avoid ambiguity, while allowing the\n> output to be longer than specified 5 (when 5 turns out to be\n> insufficient for disambiguation).\n>\n> So, I dunno.\n\nYes, I think this patch should be dropped. Do you mind just dropping the\n4/4 and having it be a 3-patch series? I can also re-submit a v2 like\nthat if it's easier...\n\nI saw the feedback on 3/4, yeah I also think that \"cut\" is a bit nasty,\nbut probably not worth spending more time on it...\n\nMy assumption in writing this patch was that it was fine because we test\nthe details of abbrev behavior somewhere else, surely...\n\nBut is it turns out we don't, I was misrecalling that some version of my\ntesting for abbreviations in [1] had landed.\n\nBut alas it didn't. From rebasing it now (it's far from submission\nquality yet) I see that the lack of testing on abbreviations in the\ninterim has silently caused some regressions on master.\n\nE.g. we seemingly unintentionally started accepting \"-c core.abbrev=\"\n(empty string) in a9ecaa06a7 (core.abbrev=no disables abbreviations,\n2020-09-01) is a side-effect of starting to accept boolean values. Also\n\"git branch --abbrev=-12345\" became a non-error in the interim (haven't\ndug, but some of the refactoring to parse_options() I assume..).\n\nSo yeah, I think this patch is a bad idea now, our test coverage for\nabbreviations is really hanging on by a thread.\n\n1. https://lore.kernel.org/git/20180608224136.20220-1-avarab@gmail.com/\n"},{"id":"418884","messageId":"xmqqsg51egi4.fsf@gitster.g","threadId":"53944","inReplyTo":"87tupigf02.fsf@evledraar.gmail.com","subject":"Re: [PATCH 4/4] tests: get rid of $_x05 from the test suite","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-03-11T17:40:03Z","receivedAt":"2021-03-11T17:40:51Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:\n\n>>>  test_expect_success 'ls-tree --abbrev=5' '\n>>>  \tgit ls-tree --abbrev=5 $tree >current &&\n>>> -\tsed -e \"s/ $_x05[0-9a-f]*\t/ X\t/\" <current >check &&\n>>> +\tsed -e \"s/ [0-9a-f]*\t/ X\t/\" <current >check &&\n>>>  \tcat >expected <<\\EOF &&\n>>>  100644 blob X\t1.txt\n>>>  100644 blob X\t2.txt\n>>\n>> This one is particularly iffy.  The --abbrev=5 test is designed to\n>> ensure that the resulting abbreviated object names are at least 5\n>> hexdigits long, even when the repository is so small that only 4\n>> hexdigits are sufficient to avoid ambiguity, while allowing the\n>> output to be longer than specified 5 (when 5 turns out to be\n>> insufficient for disambiguation).\n>>\n>> So, I dunno.\n>\n> Yes, I think this patch should be dropped. Do you mind just dropping the\n> 4/4 and having it be a 3-patch series? I can also re-submit a v2 like\n> that if it's easier...\n\nAs long as the earlier three are good to go, I can just cut the tip\nof the branch, or just drop it all now and send a three-patch series\nafter the release.  Either is fine.\n\n> My assumption in writing this patch was that it was fine because we test\n> the details of abbrev behavior somewhere else, surely...\n\nI expected that the test whose title is \"ls-tree --abbrev=5\" is\ntargetted towards testing the details of abbrev behaviour.  Isn't\nthat the case?\n\nIs the same assumption brought silent breakages to the other two\npatches to the tests, by chance?  I only gave cursory look on them\nand don't think anybody else looked at them carefully.\n"},{"id":"418896","messageId":"YEpsaZ9Kr+i0Sbyd@coredump.intra.peff.net","threadId":"53944","inReplyTo":"20210311001447.28254-4-avarab@gmail.com","subject":"Re: [PATCH 3/4] shortlog tests: rewrite to get rid of --abbrev=35 hardcoding","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2021-03-11T19:15:53Z","receivedAt":"2021-03-11T19:16:36Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Mar 11, 2021 at 01:14:46AM +0100, Ævar Arnfjörð Bjarmason wrote:\n\n> Rewrite much of the test logic introduced in 600372497c (shortlog:\n> Document and test --format option, 2010-05-03), this allows us to get\n> rid of the now-unused $_x35 variable in test-lib.sh\n> \n> There was a minimal migration of this test to SHA-256 in\n> 2ece6ad281 (t: switch $_x40 to $OID_REGEX, 2018-05-13), but actually\n> we can just get rid of all the assumptions about hashing here, and\n> make this easier to understand and maintain while we're at it.\n\nSounds like a good goal. I had to spend a few minutes deciphering what\nwas going on in the diff, so I'll follow along loudly...\n\n> diff --git a/t/t4201-shortlog.sh b/t/t4201-shortlog.sh\n> index 3095b1b2ff..3ef17c06e4 100755\n> --- a/t/t4201-shortlog.sh\n> +++ b/t/t4201-shortlog.sh\n> @@ -19,82 +19,94 @@ test_expect_success 'setup' '\n>  \tcommit=$(printf \"%s\\n\" \"Test\" \"\" | git commit-tree \"$tree\") &&\n>  \tgit update-ref HEAD \"$commit\" &&\n>  \n> +\techo \"This is a very, very long first line for the commit message to see if it is wrapped correctly\" >message &&\n> +\n> +\tsed \"s/i/1234/g\" <message >tmp &&\n> +\ttr 1234 \"\\360\\235\\204\\236\" <tmp >message.2 &&\n> +\n> +\tsed \"s/i/1234/g\" <message >tmp &&\n> +\ttr 1234 \"\\370\\235\\204\\236\" <tmp >message.3 &&\n> +\n> +\techo \"a\t\t\t\t\t\t\t\t12\t34\t56\t78\" >message.4 &&\n> +\techo \"Commit by someone else\" >message.5 &&\n> +\n\nThis is all moving the messages into files so that you can pull them\ninto the expected output later. OK (feels weird to use sed and tr\ntogether like this, but maybe it's a portability thing for sed which\ndoesn't understand octal; anyway, it's definitely not new in your\npatch).\n\nThat might have been easier to understand if each message was generated\nnext to its comment. E.g...\n\n>  \t# test if the wrapping is still valid\n>  \t# when replacing all is by treble clefs.\n>  \techo 3 >a1 &&\n> -\tgit commit --quiet -m \"$(\n> -\t\techo \"This is a very, very long first line for the commit message to see if it is wrapped correctly\" |\n> -\t\tsed \"s/i/1234/g\" |\n> -\t\ttr 1234 \"\\360\\235\\204\\236\")\" a1 &&\n> +\tgit commit --quiet -F message.2 a1 &&\n\n...if we made message.2 here, then the comment would be explaining what\nthe opaque bytes are doing (and likewise why they differ in message.3).\n\nAlso, the mismatch between the \"3\" going into the file and \"message.2\"\nis confusing. It's not important, but I wonder if using \"commit\n--allow-empty\" and just skipping a1, etc, would make it easier to read.\n\nSimilarly, --quiet seems pointless here. If the test isn't run with\n--verbose, the user doesn't see it either way. If it is, then they\nprobably want to see the output.\n\n> -\tcat >expect.template <<-\\EOF\n> +\tcat >expect.default <<-EOF\n>  \tA U Thor (5):\n> -\t      SUBJECT\n> -\t      SUBJECT\n> -\t      SUBJECT\n> -\t      SUBJECT\n> -\t      SUBJECT\n> +\t      Test\n> +\t      $(cat message)\n> +\t      $(cat message.2)\n> +\t      $(cat message.3)\n> +\t      $(cat message.4)\n>  \n>  \tSomeone else (1):\n> -\t      SUBJECT\n> +\t      $(cat message.5)\n>  \n>  \tEOF\n\nOK, and here's where we make the actual expected output, rather than a\ntemplate. I think this is an improvement in understanding what's going\non (and also is more robust).\n\nI was slightly confused that we are not looking for the messages to have\nbeen wrapped (just based on the surrounding code), but that is not new\nto your patch.\n\n> -fuzz() {\n> -\tfile=$1 &&\n> -\tsed \"\n> -\t\t\ts/$OID_REGEX/OBJECT_NAME/g\n> -\t\t\ts/$_x35/OBJID/g\n> -\t\t\ts/^ \\{6\\}[CTa].*/      SUBJECT/g\n> -\t\t\ts/^ \\{8\\}[^ ].*/        CONTINUATION/g\n> -\t\t\" <\"$file\" >\"$file.fuzzy\" &&\n> -\tsed \"/CONTINUATION/ d\" <\"$file.fuzzy\"\n> -}\n> [...]\n>  test_expect_success 'pretty format' '\n> -\tsed s/SUBJECT/OBJECT_NAME/ expect.template >expect &&\n> +\tcat >expect <<-EOF &&\n> +\tA U Thor (5):\n> +\t      $(git rev-parse HEAD~5)\n> +\t      $(git rev-parse HEAD~4)\n> +\t      $(git rev-parse HEAD~3)\n> +\t      $(git rev-parse HEAD~2)\n> +\t      $(git rev-parse HEAD~1)\n\nAnd here we expect the real hashes rather than the fuzz() magic, which\nmakes sense.\n\nAside: here and in the others, I cringe a little at the cost of all of\nthe $() calls inside the here-doc. But I don't think there's a better\nway to do it. I'd sometimes use environment variables for this, but the\nprocessing we're doing probably makes it better to keep them in real\nfiles. Or maybe not. TBH, just expanding out the messages in the source\nlike:\n\n  m1=$(printf \"Th\\370\\235\\204\\236s \\370\\235\\204\\236s a very, very long f\\370\\235\\204\\236rst l\\370\\235\\204\\236ne for the comm\\370\\235\\204\\236t message to see \\370\\235\\204\\236f \\370\\235\\204\\236t \\370\\235\\204\\236s wrapped correctly\")\n\nis equally unreadable to the original to me. ;) Possibly it would be\neven more readable if some more meaningful pattern of replacements was\nused. But I am firmly in bikeshedding territory there, so feel free to\nignore.\n\n>  test_expect_success '--abbrev' '\n> -\tsed s/SUBJECT/OBJID/ expect.template >expect &&\n> +\tcut -c 1-41 <expect >expect.abbrev &&\n>  \tgit shortlog --format=\"%h\" --abbrev=35 HEAD >log &&\n> -\tfuzz log >log.predictable &&\n> -\ttest_cmp expect log.predictable\n> +\ttest_cmp expect.abbrev log\n>  '\n\nAnd this is the same thing as %H, but abbreviated.\n\nI agree with Junio that the \"1-41\" seems magical. His suggestion to show\nthe math helps with that (or even just a comment). You could also just\nbuild the \"expect\" file with:\n\n  $(git rev-parse --abbrev=35 HEAD~5)\n\netc (I also have to wonder if there is much value in this beyond\nchecking the first commit, but that certainly predates your patch).\n\n>  test_expect_success 'output from user-defined format is re-wrapped' '\n> -\tsed \"s/SUBJECT/two lines/\" expect.template >expect &&\n> +\tcat >expect <<-EOF &&\n> +\tA U Thor (5):\n> +\t      two lines\n> +\t      two lines\n> +\t      two lines\n> +\t      two lines\n> +\t      two lines\n> +\n> +\tSomeone else (1):\n> +\t      two lines\n> +\n> +\tEOF\n>  \tgit shortlog --format=\"two%nlines\" HEAD >log &&\n> -\tfuzz log >log.predictable &&\n> -\ttest_cmp expect log.predictable\n> +\ttest_cmp expect log\n>  '\n\nAnd this one is IMHO much improved in readability.\n\n>  test_expect_success !MINGW 'shortlog wrapping' '\n> diff --git a/t/test-lib.sh b/t/test-lib.sh\n> index 5f2ad2fd81..4d5ba558d3 100644\n> --- a/t/test-lib.sh\n> +++ b/t/test-lib.sh\n> @@ -511,7 +511,7 @@ SQ=\\'\n>  # when case-folding filenames\n>  u200c=$(printf '\\342\\200\\214')\n>  \n> -export _x05 _x35 LF u200c EMPTY_TREE EMPTY_BLOB ZERO_OID OID_REGEX\n> +export _x05 LF u200c EMPTY_TREE EMPTY_BLOB ZERO_OID OID_REGEX\n\nAnd now we can get rid of _x05. Yay.\n\n-Peff\n"}]}