{"thread":{"id":"49337","subject":"[PATCH v5 00/12] Hash-independent tests (part 3)","startedAt":"2018-09-13T05:18:03Z","lastAt":"2018-09-13T19:07:00Z","messageCount":15,"participants":["brian m. carlson","Derrick Stolee","Ævar Arnfjörð Bjarmason"],"isPatch":true,"patchVersion":5,"patchTotal":12},"messages":[{"id":"358026","messageId":"20180913051742.252276-1-sandals@crustytoothpaste.net","threadId":"49337","inReplyTo":null,"subject":"[PATCH v5 00/12] Hash-independent tests (part 3)","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2018-09-13T05:17:30Z","receivedAt":"2018-09-13T05:18:03Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"This is the next in the series of improvements to make tests\nhash-independent.\n\nA range-diff is below.\n\nChanges from v4:\n* Add local statements to the &&-chain.\n* Fix a typo in the local statement.\n* Add a helpful comment about why test_detect_hash is hard-coded to\n  SHA-1.\n\nChanges from v3:\n* Update t/README to specify new helpers.\n* Escape \"$\" in double quotes.\n* Add documentation comments to test helpers.\n* Use local instead of underscores in variable names.\n* Use expr instead of egrep to match hash algorithm names.\n* Improve clarity of unset variable check in test_oid.\n* Wrap test_oid_init in a test_expect_success.\n* Improved && chain handling in test functions.\n* Add test_detect_hash in test_oid_init.\n* Clean up extra blank line.\n* Add patch from Derrick Stolee for t5318, modified slightly.\n\nChanges from v2:\n* Fix a typo in \"zero_2\".\n* Provide better matching of expected output.\n* Add and use test_oid_init instead of filename-based test_oid_cache.\n* Add test_set_hash.\n* Provide better error checking in newly added test functions.\n* Move t0000 constants into the test, removing the separate file.\n* Switch to using a differently named temporary file in t0027.\n\nChanges from v1:\n* Adopt pure shell approach for helper.\n* Add tests for the helpers.\n* Explicitly refer to SHA-256 now that we know it will be NewHash.\n* Updated t0000 to remove SHA1 prerequisite.\n* Change name of helper from test_translate to test_oid.\n* Add helper to cache information in the shell.\n* Simplified lookup of HEAD in t0002.\n* Switched to using existing helper function in t0027.\n* Simplified handling of IDs in t0064.\n\nDerrick Stolee (1):\n  t5318: use test_oid for HASH_LEN\n\nbrian m. carlson (11):\n  t: add test functions to translate hash-related values\n  t0000: use hash translation table\n  t0000: update tests for SHA-256\n  t0002: abstract away SHA-1 specific constants\n  t0027: make hash size independent\n  t0064: make hash size independent\n  t1006: make hash size independent\n  t1400: switch hard-coded object ID to variable\n  t1405: make hash size independent\n  t1406: make hash-size independent\n  t1407: make hash size independent\n\n t/README                       |  22 ++++\n t/oid-info/README              |  19 +++\n t/oid-info/hash-info           |   8 ++\n t/oid-info/oid                 |  29 +++++\n t/t0000-basic.sh               | 213 ++++++++++++++++++++++-----------\n t/t0002-gitfile.sh             |  27 +++--\n t/t0027-auto-crlf.sh           |   3 +-\n t/t0064-sha1-array.sh          |  49 ++++----\n t/t1006-cat-file.sh            |   6 +-\n t/t1400-update-ref.sh          |   2 +-\n t/t1405-main-ref-store.sh      |   4 +-\n t/t1406-submodule-ref-store.sh |   6 +-\n t/t1407-worktree-ref-store.sh  |   4 +-\n t/t5318-commit-graph.sh        |   5 +-\n t/test-lib-functions.sh        |  69 +++++++++++\n 15 files changed, 352 insertions(+), 114 deletions(-)\n create mode 100644 t/oid-info/README\n create mode 100644 t/oid-info/hash-info\n create mode 100644 t/oid-info/oid\n\nRange-diff against v4:\n 1:  fd13b542e7 !  1:  831a0df666 t: add test functions to translate hash-related values\n    @@ -222,6 +222,8 @@\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     +}\n     +\n    @@ -241,9 +243,9 @@\n     +# rawsz sha1:20\n     +# rawsz sha256:32\n     +test_oid_cache () {\n    -+\tlocal tag reset k v\n    ++\tlocal tag rest k v &&\n     +\n    -+\ttest -n \"$test_hash_algo\" || test_detect_hash &&\n    ++\t{ test -n \"$test_hash_algo\" || test_detect_hash; } &&\n     +\twhile read tag rest\n     +\tdo\n     +\t\tcase $tag in\n    @@ -271,7 +273,7 @@\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 var=\"test_oid_${test_hash_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 2:  335c75e1ec =  2:  75eb36456b t0000: use hash translation table\n 3:  257b458ad9 =  3:  d1cebc5dba t0000: update tests for SHA-256\n 4:  69080d3bfc =  4:  a75f4a049e t0002: abstract away SHA-1 specific constants\n 5:  a4297d7ae8 =  5:  ab8598048e t0027: make hash size independent\n 6:  7cf1221274 =  6:  ed540a08e8 t0064: make hash size independent\n 7:  7e5c857c25 =  7:  e221995a27 t1006: make hash size independent\n 8:  9271787d4b =  8:  3a168746ff t1400: switch hard-coded object ID to variable\n 9:  43bd41156a =  9:  3e55ccdd15 t1405: make hash size independent\n10:  875bbd7fc5 = 10:  df7d4eb112 t1406: make hash-size independent\n11:  a9c2d31089 = 11:  b1a04c1986 t1407: make hash size independent\n12:  10452cc352 = 12:  63d21a1eca t5318: use test_oid for HASH_LEN\n"},{"id":"358027","messageId":"20180913051742.252276-2-sandals@crustytoothpaste.net","threadId":"49337","inReplyTo":"20180913051742.252276-1-sandals@crustytoothpaste.net","subject":"[PATCH v5 01/12] t: add test functions to translate hash-related values","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2018-09-13T05:17:31Z","receivedAt":"2018-09-13T05:18:09Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Add several test functions to make working with various hash-related\nvalues easier.\n\nAdd test_oid_init, which loads common hash-related constants and\nplaceholder object IDs from the newly added files in t/oid-info.\nProvide values for these constants for both SHA-1 and SHA-256.\n\nAdd test_oid_cache, which accepts data on standard input in the form of\nhash-specific key-value pairs that can be looked up later, using the\nsame format as the files in t/oid-info.  Document this format in a\nt/oid-info/README directory so that it's easier to use in the future.\n\nAdd test_oid, which is used to specify look up a per-hash value\n(produced on standard output) based on the key specified as its\nargument.  Usually the data to be looked up will be a hash-related\nconstant (such as the size of the hash in binary or hexadecimal), a\nwell-known or placeholder object ID (such as the all-zeros object ID or\none consisting of \"deadbeef\" repeated), or something similar.  For these\nreasons, test_oid will usually be used within a command substitution.\nConsequently, redirect the error output to standard error, since\notherwise it will not be displayed.\n\nAdd test_detect_hash, which currently only detects SHA-1, and\ntest_set_hash, which can be used to set a different hash algorithm for\ntest purposes.  In the future, test_detect_hash will learn to actually\ndetect the hash depending on how the testsuite is to be run.\n\nUse the local keyword within these functions to avoid overwriting other\nshell variables.  We have had a test balloon in place for a couple of\nreleases to catch shells that don't have this keyword and have not\nreceived any reports of failure.  Note that the varying usages of local\nused here are supported by all common open-source shells supporting the\nlocal keyword.\n\nTest these new functions as part of t0000, which also serves to\ndemonstrate basic usage of them.  In addition, add documentation on how\nto format the lookup data and how to use the test functions.\n\nImplement two basic lookup charts, one for common invalid or synthesized\nobject IDs, and one for various facts about the hash function in use.\nProvide versions of the data for both SHA-1 and SHA-256.\n\nSince we use shell variables for storage, names used for lookup can\ncurrently consist only of shell identifier characters.  If this is a\nproblem in the future, we can hash the names before use.\n\nImproved-by: Eric Sunshine <sunshine@sunshineco.com>\nSigned-off-by: Eric Sunshine <sunshine@sunshineco.com>\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n t/README                | 22 +++++++++++++\n t/oid-info/README       | 19 ++++++++++++\n t/oid-info/hash-info    |  8 +++++\n t/oid-info/oid          | 29 +++++++++++++++++\n t/t0000-basic.sh        | 37 ++++++++++++++++++++++\n t/test-lib-functions.sh | 69 +++++++++++++++++++++++++++++++++++++++++\n 6 files changed, 184 insertions(+)\n create mode 100644 t/oid-info/README\n create mode 100644 t/oid-info/hash-info\n create mode 100644 t/oid-info/oid\n\ndiff --git a/t/README b/t/README\nindex 9028b47d92..eed574dd9b 100644\n--- a/t/README\n+++ b/t/README\n@@ -806,6 +806,28 @@ library for your script to use.\n    the symbolic link in the file system and a part that does; then only\n    the latter part need be protected by a SYMLINKS prerequisite (see below).\n \n+ - test_oid_init\n+\n+   This function loads facts and useful object IDs related to the hash\n+   algorithm(s) in use from the files in t/oid-info.\n+\n+ - test_oid_cache\n+\n+   This function reads per-hash algorithm information from standard\n+   input (usually a heredoc) in the format described in\n+   t/oid-info/README.  This is useful for test-specific values, such as\n+   object IDs, which must vary based on the hash algorithm.\n+\n+   Certain fixed values, such as hash sizes and common placeholder\n+   object IDs, can be loaded with test_oid_init (described above).\n+\n+ - test_oid <key>\n+\n+   This function looks up a value for the hash algorithm in use, based\n+   on the key given.  The value must have been loaded using\n+   test_oid_init or test_oid_cache.  Providing an unknown key is an\n+   error.\n+\n Prerequisites\n -------------\n \ndiff --git a/t/oid-info/README b/t/oid-info/README\nnew file mode 100644\nindex 0000000000..27f843fc00\n--- /dev/null\n+++ b/t/oid-info/README\n@@ -0,0 +1,19 @@\n+This directory contains various per-hash values that are used in the testsuite.\n+\n+Each file contains lines containing a key-value pair; blank lines and lines\n+starting with `#` are ignored.  The key and value are separated by whitespace\n+(specifically, those whitespace in the default `$IFS`).  The key consists only\n+of shell identifier characters, and the value consists of a hash algorithm,\n+colon, and value.  The hash algorithm also consists only of shell identifier\n+characters; it should match the value in sha1-file.c.\n+\n+For example, the following lines map the key \"rawsz\" to \"20\" if SHA-1 is in use\n+and to \"32\" if SHA-256 is in use:\n+\n+----\n+rawsz sha1:20\n+rawsz sha256:32\n+----\n+\n+The keys and values used here are loaded by `test_oid_init` (see the README file\n+in the \"t\" directory) and are used by calling `test_oid`.\ndiff --git a/t/oid-info/hash-info b/t/oid-info/hash-info\nnew file mode 100644\nindex 0000000000..ccdbfdf974\n--- /dev/null\n+++ b/t/oid-info/hash-info\n@@ -0,0 +1,8 @@\n+rawsz sha1:20\n+rawsz sha256:32\n+\n+hexsz sha1:40\n+hexsz sha256:64\n+\n+zero sha1:0000000000000000000000000000000000000000\n+zero sha256:0000000000000000000000000000000000000000000000000000000000000000\ndiff --git a/t/oid-info/oid b/t/oid-info/oid\nnew file mode 100644\nindex 0000000000..a754970523\n--- /dev/null\n+++ b/t/oid-info/oid\n@@ -0,0 +1,29 @@\n+# These are some common invalid and partial object IDs used in tests.\n+001\tsha1:0000000000000000000000000000000000000001\n+001\tsha256:0000000000000000000000000000000000000000000000000000000000000001\n+002\tsha1:0000000000000000000000000000000000000002\n+002\tsha256:0000000000000000000000000000000000000000000000000000000000000002\n+003\tsha1:0000000000000000000000000000000000000003\n+003\tsha256:0000000000000000000000000000000000000000000000000000000000000003\n+004\tsha1:0000000000000000000000000000000000000004\n+004\tsha256:0000000000000000000000000000000000000000000000000000000000000004\n+005\tsha1:0000000000000000000000000000000000000005\n+005\tsha256:0000000000000000000000000000000000000000000000000000000000000005\n+006\tsha1:0000000000000000000000000000000000000006\n+006\tsha256:0000000000000000000000000000000000000000000000000000000000000006\n+007\tsha1:0000000000000000000000000000000000000007\n+007\tsha256:0000000000000000000000000000000000000000000000000000000000000007\n+# All zeros or Fs missing one or two hex segments.\n+zero_1\t\tsha1:000000000000000000000000000000000000000\n+zero_1\t\tsha256:000000000000000000000000000000000000000000000000000000000000000\n+zero_2\t\tsha1:00000000000000000000000000000000000000\n+zero_2\t\tsha256:00000000000000000000000000000000000000000000000000000000000000\n+ff_1\t\tsha1:fffffffffffffffffffffffffffffffffffffff\n+ff_1\t\tsha256:fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\n+ff_2\t\tsha1:ffffffffffffffffffffffffffffffffffffff\n+ff_2\t\tsha256:ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\n+# More various invalid OIDs.\n+numeric\t\tsha1:0123456789012345678901234567890123456789\n+numeric\t\tsha256:0123456789012345678901234567890123456789012345678901234567890123\n+deadbeef\tsha1:deadbeefdeadbeefdeadbeefdeadbeefdeadbeef\n+deadbeef\tsha256:deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef\ndiff --git a/t/t0000-basic.sh b/t/t0000-basic.sh\nindex 850f651e4e..b94221b951 100755\n--- a/t/t0000-basic.sh\n+++ b/t/t0000-basic.sh\n@@ -821,6 +821,43 @@ test_expect_success 'tests clean up even on failures' \"\n \tEOF\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 &&\n+\trawsz=\"$(test_oid rawsz)\" &&\n+\thexsz=\"$(test_oid hexsz)\" &&\n+\ttest \"$hexsz\" -eq $(wc -c <actual) &&\n+\ttest $(( $rawsz * 2)) -eq \"$hexsz\"\n+'\n+\n+test_expect_success 'test_oid can look up data for SHA-1' '\n+\ttest_when_finished \"test_detect_hash\" &&\n+\ttest_set_hash sha1 &&\n+\ttest_oid zero >actual &&\n+\tgrep \"^00*\\$\" actual &&\n+\trawsz=\"$(test_oid rawsz)\" &&\n+\thexsz=\"$(test_oid hexsz)\" &&\n+\ttest $(wc -c <actual) -eq 40 &&\n+\ttest \"$rawsz\" -eq 20 &&\n+\ttest \"$hexsz\" -eq 40\n+'\n+\n+test_expect_success 'test_oid can look up data for SHA-256' '\n+\ttest_when_finished \"test_detect_hash\" &&\n+\ttest_set_hash sha256 &&\n+\ttest_oid zero >actual &&\n+\tgrep \"^00*\\$\" actual &&\n+\trawsz=\"$(test_oid rawsz)\" &&\n+\thexsz=\"$(test_oid hexsz)\" &&\n+\ttest $(wc -c <actual) -eq 64 &&\n+\ttest \"$rawsz\" -eq 32 &&\n+\ttest \"$hexsz\" -eq 64\n+'\n+\n ################################################################\n # Basics of the basics\n \ndiff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh\nindex 4207af4077..7293041b1e 100644\n--- a/t/test-lib-functions.sh\n+++ b/t/test-lib-functions.sh\n@@ -1155,3 +1155,72 @@ depacketize () {\n \t\t}\n \t'\n }\n+\n+# Set the hash algorithm in use to $1.  Only useful when testing the testsuite.\n+test_set_hash () {\n+\ttest_hash_algo=\"$1\"\n+}\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+}\n+\n+# Load common hash metadata and common placeholder object IDs for use with\n+# test_oid.\n+test_oid_init () {\n+\ttest -n \"$test_hash_algo\" || test_detect_hash &&\n+\ttest_oid_cache <\"$TEST_DIRECTORY/oid-info/hash-info\" &&\n+\ttest_oid_cache <\"$TEST_DIRECTORY/oid-info/oid\"\n+}\n+\n+# Load key-value pairs from stdin suitable for use with test_oid.  Blank lines\n+# and lines starting with \"#\" are ignored.  Keys must be shell identifier\n+# characters.\n+#\n+# Examples:\n+# rawsz sha1:20\n+# rawsz sha256:32\n+test_oid_cache () {\n+\tlocal tag rest k v &&\n+\n+\t{ test -n \"$test_hash_algo\" || test_detect_hash; } &&\n+\twhile read tag rest\n+\tdo\n+\t\tcase $tag in\n+\t\t\\#*)\n+\t\t\tcontinue;;\n+\t\t?*)\n+\t\t\t# non-empty\n+\t\t\t;;\n+\t\t*)\n+\t\t\t# blank line\n+\t\t\tcontinue;;\n+\t\tesac &&\n+\n+\t\tk=\"${rest%:*}\" &&\n+\t\tv=\"${rest#*:}\" &&\n+\n+\t\tif ! expr \"$k\" : '[a-z0-9][a-z0-9]*$' >/dev/null\n+\t\tthen\n+\t\t\terror 'bug in the test script: bad hash algorithm'\n+\t\tfi &&\n+\t\teval \"test_oid_${k}_$tag=\\\"\\$v\\\"\"\n+\tdone\n+}\n+\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+\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+\tif eval \"test -z \\\"\\${$var+set}\\\"\"\n+\tthen\n+\t\terror \"bug in the test script: undefined key '$1'\" >&2\n+\tfi &&\n+\teval \"printf '%s' \\\"\\${$var}\\\"\"\n+}\n"},{"id":"358028","messageId":"20180913051742.252276-3-sandals@crustytoothpaste.net","threadId":"49337","inReplyTo":"20180913051742.252276-1-sandals@crustytoothpaste.net","subject":"[PATCH v5 02/12] t0000: use hash translation table","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2018-09-13T05:17:32Z","receivedAt":"2018-09-13T05:18:10Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"If the hash we're using is 32 bytes in size, attempting to insert a\n20-byte object name won't work.  Since these are synthesized objects\nthat are almost all zeros, look them up in a translation table.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n t/t0000-basic.sh | 13 +++++++------\n 1 file changed, 7 insertions(+), 6 deletions(-)\n\ndiff --git a/t/t0000-basic.sh b/t/t0000-basic.sh\nindex b94221b951..a9dc534048 100755\n--- a/t/t0000-basic.sh\n+++ b/t/t0000-basic.sh\n@@ -1015,12 +1015,13 @@ test_expect_success SHA1 'validate object ID for a known tree' '\n \n test_expect_success 'put invalid objects into the index' '\n \trm -f .git/index &&\n-\tcat >badobjects <<-\\EOF &&\n-\t100644 blob 1000000000000000000000000000000000000000\tdir/file1\n-\t100644 blob 2000000000000000000000000000000000000000\tdir/file2\n-\t100644 blob 3000000000000000000000000000000000000000\tdir/file3\n-\t100644 blob 4000000000000000000000000000000000000000\tdir/file4\n-\t100644 blob 5000000000000000000000000000000000000000\tdir/file5\n+\tsuffix=$(echo $ZERO_OID | sed -e \"s/^.//\") &&\n+\tcat >badobjects <<-EOF &&\n+\t100644 blob $(test_oid 001)\tdir/file1\n+\t100644 blob $(test_oid 002)\tdir/file2\n+\t100644 blob $(test_oid 003)\tdir/file3\n+\t100644 blob $(test_oid 004)\tdir/file4\n+\t100644 blob $(test_oid 005)\tdir/file5\n \tEOF\n \tgit update-index --index-info <badobjects\n '\n"},{"id":"358029","messageId":"20180913051742.252276-4-sandals@crustytoothpaste.net","threadId":"49337","inReplyTo":"20180913051742.252276-1-sandals@crustytoothpaste.net","subject":"[PATCH v5 03/12] t0000: update tests for SHA-256","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2018-09-13T05:17:33Z","receivedAt":"2018-09-13T05:18:15Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Test t0000 tests the \"basics of the basics\" and as such, checks that we\nhave various fixed hard-coded object IDs.  The tests relying on these\nassertions have been marked with the SHA1 prerequisite, as they will\nobviously not function in their current form with SHA-256.\n\nUse the test_oid helper to update these assertions and provide values\nfor both SHA-1 and SHA-256.\n\nThese object IDs were synthesized using a set of scripts that created\nthe objects for both SHA-1 and SHA-256 using the same method to ensure\nthat they are indeed the correct values.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n t/t0000-basic.sh | 163 +++++++++++++++++++++++++++++------------------\n 1 file changed, 102 insertions(+), 61 deletions(-)\n\ndiff --git a/t/t0000-basic.sh b/t/t0000-basic.sh\nindex a9dc534048..391f910c6a 100755\n--- a/t/t0000-basic.sh\n+++ b/t/t0000-basic.sh\n@@ -861,6 +861,47 @@ test_expect_success 'test_oid can look up data for SHA-256' '\n ################################################################\n # Basics of the basics\n \n+test_oid_cache <<\\EOF\n+path0f sha1:f87290f8eb2cbbea7857214459a0739927eab154\n+path0f sha256:638106af7c38be056f3212cbd7ac65bc1bac74f420ca5a436ff006a9d025d17d\n+\n+path0s sha1:15a98433ae33114b085f3eb3bb03b832b3180a01\n+path0s sha256:3a24cc53cf68edddac490bbf94a418a52932130541361f685df685e41dd6c363\n+\n+path2f sha1:3feff949ed00a62d9f7af97c15cd8a30595e7ac7\n+path2f sha256:2a7f36571c6fdbaf0e3f62751a0b25a3f4c54d2d1137b3f4af9cb794bb498e5f\n+\n+path2s sha1:d8ce161addc5173867a3c3c730924388daedbc38\n+path2s sha256:18fd611b787c2e938ddcc248fabe4d66a150f9364763e9ec133dd01d5bb7c65a\n+\n+path2d sha1:58a09c23e2ca152193f2786e06986b7b6712bdbe\n+path2d sha256:00e4b32b96e7e3d65d79112dcbea53238a22715f896933a62b811377e2650c17\n+\n+path3f sha1:0aa34cae68d0878578ad119c86ca2b5ed5b28376\n+path3f sha256:09f58616b951bd571b8cb9dc76d372fbb09ab99db2393f5ab3189d26c45099ad\n+\n+path3s sha1:8599103969b43aff7e430efea79ca4636466794f\n+path3s sha256:fce1aed087c053306f3f74c32c1a838c662bbc4551a7ac2420f5d6eb061374d0\n+\n+path3d sha1:21ae8269cacbe57ae09138dcc3a2887f904d02b3\n+path3d sha256:9b60497be959cb830bf3f0dc82bcc9ad9e925a24e480837ade46b2295e47efe1\n+\n+subp3f sha1:00fb5908cb97c2564a9783c0c64087333b3b464f\n+subp3f sha256:a1a9e16998c988453f18313d10375ee1d0ddefe757e710dcae0d66aa1e0c58b3\n+\n+subp3s sha1:6649a1ebe9e9f1c553b66f5a6e74136a07ccc57c\n+subp3s sha256:81759d9f5e93c6546ecfcadb560c1ff057314b09f93fe8ec06e2d8610d34ef10\n+\n+subp3d sha1:3c5e5399f3a333eddecce7a9b9465b63f65f51e2\n+subp3d sha256:76b4ef482d4fa1c754390344cf3851c7f883b27cf9bc999c6547928c46aeafb7\n+\n+root sha1:087704a96baf1c2d1c869a8b084481e121c88b5b\n+root sha256:9481b52abab1b2ffeedbf9de63ce422b929f179c1b98ff7bee5f8f1bc0710751\n+\n+simpletree sha1:7bb943559a305bdd6bdee2cef6e5df2413c3d30a\n+simpletree sha256:1710c07a6c86f9a3c7376364df04c47ee39e5a5e221fcdd84b743bc9bb7e2bc5\n+EOF\n+\n # updating a new file without --add should fail.\n test_expect_success 'git update-index without --add should fail adding' '\n \ttest_must_fail git update-index should-be-empty\n@@ -876,8 +917,8 @@ test_expect_success 'writing tree out with git write-tree' '\n '\n \n # we know the shape and contents of the tree and know the object ID for it.\n-test_expect_success SHA1 'validate object ID of a known tree' '\n-\ttest \"$tree\" = 7bb943559a305bdd6bdee2cef6e5df2413c3d30a\n+test_expect_success 'validate object ID of a known tree' '\n+\ttest \"$tree\" = \"$(test_oid simpletree)\"\n     '\n \n # Removing paths.\n@@ -919,16 +960,16 @@ test_expect_success 'showing stage with git ls-files --stage' '\n \tgit ls-files --stage >current\n '\n \n-test_expect_success SHA1 'validate git ls-files output for a known tree' '\n-\tcat >expected <<-\\EOF &&\n-\t100644 f87290f8eb2cbbea7857214459a0739927eab154 0\tpath0\n-\t120000 15a98433ae33114b085f3eb3bb03b832b3180a01 0\tpath0sym\n-\t100644 3feff949ed00a62d9f7af97c15cd8a30595e7ac7 0\tpath2/file2\n-\t120000 d8ce161addc5173867a3c3c730924388daedbc38 0\tpath2/file2sym\n-\t100644 0aa34cae68d0878578ad119c86ca2b5ed5b28376 0\tpath3/file3\n-\t120000 8599103969b43aff7e430efea79ca4636466794f 0\tpath3/file3sym\n-\t100644 00fb5908cb97c2564a9783c0c64087333b3b464f 0\tpath3/subp3/file3\n-\t120000 6649a1ebe9e9f1c553b66f5a6e74136a07ccc57c 0\tpath3/subp3/file3sym\n+test_expect_success 'validate git ls-files output for a known tree' '\n+\tcat >expected <<-EOF &&\n+\t100644 $(test_oid path0f) 0\tpath0\n+\t120000 $(test_oid path0s) 0\tpath0sym\n+\t100644 $(test_oid path2f) 0\tpath2/file2\n+\t120000 $(test_oid path2s) 0\tpath2/file2sym\n+\t100644 $(test_oid path3f) 0\tpath3/file3\n+\t120000 $(test_oid path3s) 0\tpath3/file3sym\n+\t100644 $(test_oid subp3f) 0\tpath3/subp3/file3\n+\t120000 $(test_oid subp3s) 0\tpath3/subp3/file3sym\n \tEOF\n \ttest_cmp expected current\n '\n@@ -937,20 +978,20 @@ test_expect_success 'writing tree out with git write-tree' '\n \ttree=$(git write-tree)\n '\n \n-test_expect_success SHA1 'validate object ID for a known tree' '\n-\ttest \"$tree\" = 087704a96baf1c2d1c869a8b084481e121c88b5b\n+test_expect_success 'validate object ID for a known tree' '\n+\ttest \"$tree\" = \"$(test_oid root)\"\n '\n \n test_expect_success 'showing tree with git ls-tree' '\n     git ls-tree $tree >current\n '\n \n-test_expect_success SHA1 'git ls-tree output for a known tree' '\n-\tcat >expected <<-\\EOF &&\n-\t100644 blob f87290f8eb2cbbea7857214459a0739927eab154\tpath0\n-\t120000 blob 15a98433ae33114b085f3eb3bb03b832b3180a01\tpath0sym\n-\t040000 tree 58a09c23e2ca152193f2786e06986b7b6712bdbe\tpath2\n-\t040000 tree 21ae8269cacbe57ae09138dcc3a2887f904d02b3\tpath3\n+test_expect_success 'git ls-tree output for a known tree' '\n+\tcat >expected <<-EOF &&\n+\t100644 blob $(test_oid path0f)\tpath0\n+\t120000 blob $(test_oid path0s)\tpath0sym\n+\t040000 tree $(test_oid path2d)\tpath2\n+\t040000 tree $(test_oid path3d)\tpath3\n \tEOF\n \ttest_cmp expected current\n '\n@@ -961,16 +1002,16 @@ test_expect_success 'showing tree with git ls-tree -r' '\n \tgit ls-tree -r $tree >current\n '\n \n-test_expect_success SHA1 'git ls-tree -r output for a known tree' '\n-\tcat >expected <<-\\EOF &&\n-\t100644 blob f87290f8eb2cbbea7857214459a0739927eab154\tpath0\n-\t120000 blob 15a98433ae33114b085f3eb3bb03b832b3180a01\tpath0sym\n-\t100644 blob 3feff949ed00a62d9f7af97c15cd8a30595e7ac7\tpath2/file2\n-\t120000 blob d8ce161addc5173867a3c3c730924388daedbc38\tpath2/file2sym\n-\t100644 blob 0aa34cae68d0878578ad119c86ca2b5ed5b28376\tpath3/file3\n-\t120000 blob 8599103969b43aff7e430efea79ca4636466794f\tpath3/file3sym\n-\t100644 blob 00fb5908cb97c2564a9783c0c64087333b3b464f\tpath3/subp3/file3\n-\t120000 blob 6649a1ebe9e9f1c553b66f5a6e74136a07ccc57c\tpath3/subp3/file3sym\n+test_expect_success 'git ls-tree -r output for a known tree' '\n+\tcat >expected <<-EOF &&\n+\t100644 blob $(test_oid path0f)\tpath0\n+\t120000 blob $(test_oid path0s)\tpath0sym\n+\t100644 blob $(test_oid path2f)\tpath2/file2\n+\t120000 blob $(test_oid path2s)\tpath2/file2sym\n+\t100644 blob $(test_oid path3f)\tpath3/file3\n+\t120000 blob $(test_oid path3s)\tpath3/file3sym\n+\t100644 blob $(test_oid subp3f)\tpath3/subp3/file3\n+\t120000 blob $(test_oid subp3s)\tpath3/subp3/file3sym\n \tEOF\n \ttest_cmp expected current\n '\n@@ -980,19 +1021,19 @@ test_expect_success 'showing tree with git ls-tree -r -t' '\n \tgit ls-tree -r -t $tree >current\n '\n \n-test_expect_success SHA1 'git ls-tree -r output for a known tree' '\n-\tcat >expected <<-\\EOF &&\n-\t100644 blob f87290f8eb2cbbea7857214459a0739927eab154\tpath0\n-\t120000 blob 15a98433ae33114b085f3eb3bb03b832b3180a01\tpath0sym\n-\t040000 tree 58a09c23e2ca152193f2786e06986b7b6712bdbe\tpath2\n-\t100644 blob 3feff949ed00a62d9f7af97c15cd8a30595e7ac7\tpath2/file2\n-\t120000 blob d8ce161addc5173867a3c3c730924388daedbc38\tpath2/file2sym\n-\t040000 tree 21ae8269cacbe57ae09138dcc3a2887f904d02b3\tpath3\n-\t100644 blob 0aa34cae68d0878578ad119c86ca2b5ed5b28376\tpath3/file3\n-\t120000 blob 8599103969b43aff7e430efea79ca4636466794f\tpath3/file3sym\n-\t040000 tree 3c5e5399f3a333eddecce7a9b9465b63f65f51e2\tpath3/subp3\n-\t100644 blob 00fb5908cb97c2564a9783c0c64087333b3b464f\tpath3/subp3/file3\n-\t120000 blob 6649a1ebe9e9f1c553b66f5a6e74136a07ccc57c\tpath3/subp3/file3sym\n+test_expect_success 'git ls-tree -r output for a known tree' '\n+\tcat >expected <<-EOF &&\n+\t100644 blob $(test_oid path0f)\tpath0\n+\t120000 blob $(test_oid path0s)\tpath0sym\n+\t040000 tree $(test_oid path2d)\tpath2\n+\t100644 blob $(test_oid path2f)\tpath2/file2\n+\t120000 blob $(test_oid path2s)\tpath2/file2sym\n+\t040000 tree $(test_oid path3d)\tpath3\n+\t100644 blob $(test_oid path3f)\tpath3/file3\n+\t120000 blob $(test_oid path3s)\tpath3/file3sym\n+\t040000 tree $(test_oid subp3d)\tpath3/subp3\n+\t100644 blob $(test_oid subp3f)\tpath3/subp3/file3\n+\t120000 blob $(test_oid subp3s)\tpath3/subp3/file3sym\n \tEOF\n \ttest_cmp expected current\n '\n@@ -1001,16 +1042,16 @@ test_expect_success 'writing partial tree out with git write-tree --prefix' '\n \tptree=$(git write-tree --prefix=path3)\n '\n \n-test_expect_success SHA1 'validate object ID for a known tree' '\n-\ttest \"$ptree\" = 21ae8269cacbe57ae09138dcc3a2887f904d02b3\n+test_expect_success 'validate object ID for a known tree' '\n+\ttest \"$ptree\" = $(test_oid path3d)\n '\n \n test_expect_success 'writing partial tree out with git write-tree --prefix' '\n \tptree=$(git write-tree --prefix=path3/subp3)\n '\n \n-test_expect_success SHA1 'validate object ID for a known tree' '\n-\ttest \"$ptree\" = 3c5e5399f3a333eddecce7a9b9465b63f65f51e2\n+test_expect_success 'validate object ID for a known tree' '\n+\ttest \"$ptree\" = $(test_oid subp3d)\n '\n \n test_expect_success 'put invalid objects into the index' '\n@@ -1044,16 +1085,16 @@ test_expect_success 'git read-tree followed by write-tree should be idempotent'\n \ttest \"$newtree\" = \"$tree\"\n '\n \n-test_expect_success SHA1 'validate git diff-files output for a know cache/work tree state' '\n-\tcat >expected <<\\EOF &&\n-:100644 100644 f87290f8eb2cbbea7857214459a0739927eab154 0000000000000000000000000000000000000000 M\tpath0\n-:120000 120000 15a98433ae33114b085f3eb3bb03b832b3180a01 0000000000000000000000000000000000000000 M\tpath0sym\n-:100644 100644 3feff949ed00a62d9f7af97c15cd8a30595e7ac7 0000000000000000000000000000000000000000 M\tpath2/file2\n-:120000 120000 d8ce161addc5173867a3c3c730924388daedbc38 0000000000000000000000000000000000000000 M\tpath2/file2sym\n-:100644 100644 0aa34cae68d0878578ad119c86ca2b5ed5b28376 0000000000000000000000000000000000000000 M\tpath3/file3\n-:120000 120000 8599103969b43aff7e430efea79ca4636466794f 0000000000000000000000000000000000000000 M\tpath3/file3sym\n-:100644 100644 00fb5908cb97c2564a9783c0c64087333b3b464f 0000000000000000000000000000000000000000 M\tpath3/subp3/file3\n-:120000 120000 6649a1ebe9e9f1c553b66f5a6e74136a07ccc57c 0000000000000000000000000000000000000000 M\tpath3/subp3/file3sym\n+test_expect_success 'validate git diff-files output for a know cache/work tree state' '\n+\tcat >expected <<EOF &&\n+:100644 100644 $(test_oid path0f) $ZERO_OID M\tpath0\n+:120000 120000 $(test_oid path0s) $ZERO_OID M\tpath0sym\n+:100644 100644 $(test_oid path2f) $ZERO_OID M\tpath2/file2\n+:120000 120000 $(test_oid path2s) $ZERO_OID M\tpath2/file2sym\n+:100644 100644 $(test_oid path3f) $ZERO_OID M\tpath3/file3\n+:120000 120000 $(test_oid path3s) $ZERO_OID M\tpath3/file3sym\n+:100644 100644 $(test_oid subp3f) $ZERO_OID M\tpath3/subp3/file3\n+:120000 120000 $(test_oid subp3s) $ZERO_OID M\tpath3/subp3/file3sym\n EOF\n \tgit diff-files >current &&\n \ttest_cmp current expected\n@@ -1069,23 +1110,23 @@ test_expect_success 'no diff after checkout and git update-index --refresh' '\n '\n \n ################################################################\n-P=087704a96baf1c2d1c869a8b084481e121c88b5b\n+P=$(test_oid root)\n \n-test_expect_success SHA1 'git commit-tree records the correct tree in a commit' '\n+test_expect_success 'git commit-tree records the correct tree in a commit' '\n \tcommit0=$(echo NO | git commit-tree $P) &&\n \ttree=$(git show --pretty=raw $commit0 |\n \t\t sed -n -e \"s/^tree //p\" -e \"/^author /q\") &&\n \ttest \"z$tree\" = \"z$P\"\n '\n \n-test_expect_success SHA1 'git commit-tree records the correct parent in a commit' '\n+test_expect_success 'git commit-tree records the correct parent in a commit' '\n \tcommit1=$(echo NO | git commit-tree $P -p $commit0) &&\n \tparent=$(git show --pretty=raw $commit1 |\n \t\tsed -n -e \"s/^parent //p\" -e \"/^author /q\") &&\n \ttest \"z$commit0\" = \"z$parent\"\n '\n \n-test_expect_success SHA1 'git commit-tree omits duplicated parent in a commit' '\n+test_expect_success 'git commit-tree omits duplicated parent in a commit' '\n \tcommit2=$(echo NO | git commit-tree $P -p $commit0 -p $commit0) &&\n \t     parent=$(git show --pretty=raw $commit2 |\n \t\tsed -n -e \"s/^parent //p\" -e \"/^author /q\" |\n"},{"id":"358030","messageId":"20180913051742.252276-5-sandals@crustytoothpaste.net","threadId":"49337","inReplyTo":"20180913051742.252276-1-sandals@crustytoothpaste.net","subject":"[PATCH v5 04/12] t0002: abstract away SHA-1 specific constants","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2018-09-13T05:17:34Z","receivedAt":"2018-09-13T05:18:17Z","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/t0002-gitfile.sh | 27 +++++++++++++++------------\n 1 file changed, 15 insertions(+), 12 deletions(-)\n\ndiff --git a/t/t0002-gitfile.sh b/t/t0002-gitfile.sh\nindex 3691023d51..0aa9908ea1 100755\n--- a/t/t0002-gitfile.sh\n+++ b/t/t0002-gitfile.sh\n@@ -92,11 +92,12 @@ test_expect_success 'enter_repo non-strict mode' '\n \t\tmv .git .realgit &&\n \t\techo \"gitdir: .realgit\" >.git\n \t) &&\n+\thead=$(git -C enter_repo rev-parse HEAD) &&\n \tgit ls-remote enter_repo >actual &&\n-\tcat >expected <<-\\EOF &&\n-\t946e985ab20de757ca5b872b16d64e92ff3803a9\tHEAD\n-\t946e985ab20de757ca5b872b16d64e92ff3803a9\trefs/heads/master\n-\t946e985ab20de757ca5b872b16d64e92ff3803a9\trefs/tags/foo\n+\tcat >expected <<-EOF &&\n+\t$head\tHEAD\n+\t$head\trefs/heads/master\n+\t$head\trefs/tags/foo\n \tEOF\n \ttest_cmp expected actual\n '\n@@ -106,21 +107,23 @@ test_expect_success 'enter_repo linked checkout' '\n \t\tcd enter_repo &&\n \t\tgit worktree add  ../foo refs/tags/foo\n \t) &&\n+\thead=$(git -C enter_repo rev-parse HEAD) &&\n \tgit ls-remote foo >actual &&\n-\tcat >expected <<-\\EOF &&\n-\t946e985ab20de757ca5b872b16d64e92ff3803a9\tHEAD\n-\t946e985ab20de757ca5b872b16d64e92ff3803a9\trefs/heads/master\n-\t946e985ab20de757ca5b872b16d64e92ff3803a9\trefs/tags/foo\n+\tcat >expected <<-EOF &&\n+\t$head\tHEAD\n+\t$head\trefs/heads/master\n+\t$head\trefs/tags/foo\n \tEOF\n \ttest_cmp expected actual\n '\n \n test_expect_success 'enter_repo strict mode' '\n+\thead=$(git -C enter_repo rev-parse HEAD) &&\n \tgit ls-remote --upload-pack=\"git upload-pack --strict\" foo/.git >actual &&\n-\tcat >expected <<-\\EOF &&\n-\t946e985ab20de757ca5b872b16d64e92ff3803a9\tHEAD\n-\t946e985ab20de757ca5b872b16d64e92ff3803a9\trefs/heads/master\n-\t946e985ab20de757ca5b872b16d64e92ff3803a9\trefs/tags/foo\n+\tcat >expected <<-EOF &&\n+\t$head\tHEAD\n+\t$head\trefs/heads/master\n+\t$head\trefs/tags/foo\n \tEOF\n \ttest_cmp expected actual\n '\n"},{"id":"358031","messageId":"20180913051742.252276-6-sandals@crustytoothpaste.net","threadId":"49337","inReplyTo":"20180913051742.252276-1-sandals@crustytoothpaste.net","subject":"[PATCH v5 05/12] t0027: make hash size independent","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2018-09-13T05:17:35Z","receivedAt":"2018-09-13T05:18:19Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"We transform various object IDs into all-zero object IDs for comparison.\nAdjust the length as well so that this works for all hash algorithms.\n\nWhile it would be slightly more efficient to use a sed y/// expression\ninstead of both the tr and sed, retain the tr in both cases for\nparallelism and compactness.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n t/t0027-auto-crlf.sh | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git a/t/t0027-auto-crlf.sh b/t/t0027-auto-crlf.sh\nindex beb5927f77..dfb46bbe86 100755\n--- a/t/t0027-auto-crlf.sh\n+++ b/t/t0027-auto-crlf.sh\n@@ -15,7 +15,8 @@ compare_ws_file () {\n \tpfx=$1\n \texp=$2.expect\n \tact=$pfx.actual.$3\n-\ttr '\\015\\000abcdef0123456789' QN00000000000000000 <\"$2\" >\"$exp\" &&\n+\ttr '\\015\\000abcdef0123456789' QN00000000000000000 <\"$2\" |\n+\t\tsed -e \"s/0000*/$ZERO_OID/\" >\"$exp\" &&\n \ttr '\\015\\000abcdef0123456789' QN00000000000000000 <\"$3\" >\"$act\" &&\n \ttest_cmp \"$exp\" \"$act\" &&\n \trm \"$exp\" \"$act\"\n"},{"id":"358032","messageId":"20180913051742.252276-7-sandals@crustytoothpaste.net","threadId":"49337","inReplyTo":"20180913051742.252276-1-sandals@crustytoothpaste.net","subject":"[PATCH v5 06/12] t0064: make hash size independent","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2018-09-13T05:17:36Z","receivedAt":"2018-09-13T05:18:22Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Compute test values of the appropriate size instead of hard-coding\n40-character values.  Rename the echo20 function to echoid, since the\nvalues may be of varying sizes.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n t/t0064-sha1-array.sh | 49 ++++++++++++++++++++++++-------------------\n 1 file changed, 27 insertions(+), 22 deletions(-)\n\ndiff --git a/t/t0064-sha1-array.sh b/t/t0064-sha1-array.sh\nindex 67484502a0..5dda570b9a 100755\n--- a/t/t0064-sha1-array.sh\n+++ b/t/t0064-sha1-array.sh\n@@ -3,30 +3,30 @@\n test_description='basic tests for the SHA1 array implementation'\n . ./test-lib.sh\n \n-echo20 () {\n+echoid () {\n \tprefix=\"${1:+$1 }\"\n \tshift\n \twhile test $# -gt 0\n \tdo\n-\t\techo \"$prefix$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1\"\n+\t\techo \"$prefix$ZERO_OID\" | sed -e \"s/00/$1/g\"\n \t\tshift\n \tdone\n }\n \n test_expect_success 'ordered enumeration' '\n-\techo20 \"\" 44 55 88 aa >expect &&\n+\techoid \"\" 44 55 88 aa >expect &&\n \t{\n-\t\techo20 append 88 44 aa 55 &&\n+\t\techoid append 88 44 aa 55 &&\n \t\techo for_each_unique\n \t} | test-tool sha1-array >actual &&\n \ttest_cmp expect actual\n '\n \n test_expect_success 'ordered enumeration with duplicate suppression' '\n-\techo20 \"\" 44 55 88 aa >expect &&\n+\techoid \"\" 44 55 88 aa >expect &&\n \t{\n-\t\techo20 append 88 44 aa 55 &&\n-\t\techo20 append 88 44 aa 55 &&\n+\t\techoid append 88 44 aa 55 &&\n+\t\techoid append 88 44 aa 55 &&\n \t\techo for_each_unique\n \t} | test-tool sha1-array >actual &&\n \ttest_cmp expect actual\n@@ -34,8 +34,8 @@ test_expect_success 'ordered enumeration with duplicate suppression' '\n \n test_expect_success 'lookup' '\n \t{\n-\t\techo20 append 88 44 aa 55 &&\n-\t\techo20 lookup 55\n+\t\techoid append 88 44 aa 55 &&\n+\t\techoid lookup 55\n \t} | test-tool sha1-array >actual &&\n \tn=$(cat actual) &&\n \ttest \"$n\" -eq 1\n@@ -43,8 +43,8 @@ test_expect_success 'lookup' '\n \n test_expect_success 'lookup non-existing entry' '\n \t{\n-\t\techo20 append 88 44 aa 55 &&\n-\t\techo20 lookup 33\n+\t\techoid append 88 44 aa 55 &&\n+\t\techoid lookup 33\n \t} | test-tool sha1-array >actual &&\n \tn=$(cat actual) &&\n \ttest \"$n\" -lt 0\n@@ -52,9 +52,9 @@ test_expect_success 'lookup non-existing entry' '\n \n test_expect_success 'lookup with duplicates' '\n \t{\n-\t\techo20 append 88 44 aa 55 &&\n-\t\techo20 append 88 44 aa 55 &&\n-\t\techo20 lookup 55\n+\t\techoid append 88 44 aa 55 &&\n+\t\techoid append 88 44 aa 55 &&\n+\t\techoid lookup 55\n \t} | test-tool sha1-array >actual &&\n \tn=$(cat actual) &&\n \ttest \"$n\" -ge 2 &&\n@@ -63,19 +63,24 @@ test_expect_success 'lookup with duplicates' '\n \n test_expect_success 'lookup non-existing entry with duplicates' '\n \t{\n-\t\techo20 append 88 44 aa 55 &&\n-\t\techo20 append 88 44 aa 55 &&\n-\t\techo20 lookup 66\n+\t\techoid append 88 44 aa 55 &&\n+\t\techoid append 88 44 aa 55 &&\n+\t\techoid lookup 66\n \t} | test-tool sha1-array >actual &&\n \tn=$(cat actual) &&\n \ttest \"$n\" -lt 0\n '\n \n test_expect_success 'lookup with almost duplicate values' '\n+\t# n-1 5s\n+\troot=$(echoid \"\" 55) &&\n+\troot=${root%5} &&\n \t{\n-\t\techo \"append 5555555555555555555555555555555555555555\" &&\n-\t\techo \"append 555555555555555555555555555555555555555f\" &&\n-\t\techo20 lookup 55\n+\t\tid1=\"${root}5\" &&\n+\t\tid2=\"${root}f\" &&\n+\t\techo \"append $id1\" &&\n+\t\techo \"append $id2\" &&\n+\t\techoid lookup 55\n \t} | test-tool sha1-array >actual &&\n \tn=$(cat actual) &&\n \ttest \"$n\" -eq 0\n@@ -83,8 +88,8 @@ test_expect_success 'lookup with almost duplicate values' '\n \n test_expect_success 'lookup with single duplicate value' '\n \t{\n-\t\techo20 append 55 55 &&\n-\t\techo20 lookup 55\n+\t\techoid append 55 55 &&\n+\t\techoid lookup 55\n \t} | test-tool sha1-array >actual &&\n \tn=$(cat actual) &&\n \ttest \"$n\" -ge 0 &&\n"},{"id":"358033","messageId":"20180913051742.252276-8-sandals@crustytoothpaste.net","threadId":"49337","inReplyTo":"20180913051742.252276-1-sandals@crustytoothpaste.net","subject":"[PATCH v5 07/12] t1006: make hash size independent","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2018-09-13T05:17:37Z","receivedAt":"2018-09-13T05:18:25Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Compute the size of the tree and commit objects we're creating by\nchecking for the size of an object ID and computing the resulting sizes\naccordingly.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n t/t1006-cat-file.sh | 6 ++++--\n 1 file changed, 4 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t1006-cat-file.sh b/t/t1006-cat-file.sh\nindex 7f19d591f2..a7c95bb785 100755\n--- a/t/t1006-cat-file.sh\n+++ b/t/t1006-cat-file.sh\n@@ -140,15 +140,17 @@ 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=33\n+tree_size=$(($(test_oid rawsz) + 13))\n tree_pretty_content=\"100644 blob $hello_sha1\thello\"\n \n run_tests 'tree' $tree_sha1 $tree_size \"\" \"$tree_pretty_content\"\n \n commit_message=\"Initial commit\"\n commit_sha1=$(echo_without_newline \"$commit_message\" | git commit-tree $tree_sha1)\n-commit_size=177\n+commit_size=$(($(test_oid hexsz) + 137))\n commit_content=\"tree $tree_sha1\n author $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> 0000000000 +0000\n committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 0000000000 +0000\n"},{"id":"358034","messageId":"20180913051742.252276-9-sandals@crustytoothpaste.net","threadId":"49337","inReplyTo":"20180913051742.252276-1-sandals@crustytoothpaste.net","subject":"[PATCH v5 08/12] t1400: switch hard-coded object ID to variable","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2018-09-13T05:17:38Z","receivedAt":"2018-09-13T05:18:28Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Switch a hard-coded all-zeros object ID to use a variable instead.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n t/t1400-update-ref.sh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh\nindex 7c8df20955..6072650686 100755\n--- a/t/t1400-update-ref.sh\n+++ b/t/t1400-update-ref.sh\n@@ -346,7 +346,7 @@ test_expect_success \"verifying $m's log (logged by config)\" '\n \n git update-ref $m $D\n cat >.git/logs/$m <<EOF\n-0000000000000000000000000000000000000000 $C $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150320 -0500\n+$Z $C $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150320 -0500\n $C $A $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150350 -0500\n $A $B $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150380 -0500\n $F $Z $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150680 -0500\n"},{"id":"358035","messageId":"20180913051742.252276-10-sandals@crustytoothpaste.net","threadId":"49337","inReplyTo":"20180913051742.252276-1-sandals@crustytoothpaste.net","subject":"[PATCH v5 09/12] t1405: make hash size independent","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2018-09-13T05:17:39Z","receivedAt":"2018-09-13T05:18:29Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Instead of hard-coding a 40-based constant, split the output of\nfor-each-ref and for-each-reflog by field.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n t/t1405-main-ref-store.sh | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t1405-main-ref-store.sh b/t/t1405-main-ref-store.sh\nindex a74c38b5fb..331899ddc4 100755\n--- a/t/t1405-main-ref-store.sh\n+++ b/t/t1405-main-ref-store.sh\n@@ -54,7 +54,7 @@ test_expect_success 'for_each_ref(refs/heads/)' '\n '\n \n test_expect_success 'for_each_ref() is sorted' '\n-\t$RUN for-each-ref refs/heads/ | cut -c 42- >actual &&\n+\t$RUN for-each-ref refs/heads/ | cut -d\" \" -f 2- >actual &&\n \tsort actual > expected &&\n \ttest_cmp expected actual\n '\n@@ -71,7 +71,7 @@ test_expect_success 'verify_ref(new-master)' '\n '\n \n test_expect_success 'for_each_reflog()' '\n-\t$RUN for-each-reflog | sort -k2 | cut -c 42- >actual &&\n+\t$RUN for-each-reflog | sort -k2 | cut -d\" \" -f 2- >actual &&\n \tcat >expected <<-\\EOF &&\n \tHEAD 0x1\n \trefs/heads/master 0x0\n"},{"id":"358036","messageId":"20180913051742.252276-11-sandals@crustytoothpaste.net","threadId":"49337","inReplyTo":"20180913051742.252276-1-sandals@crustytoothpaste.net","subject":"[PATCH v5 10/12] t1406: make hash-size independent","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2018-09-13T05:17:40Z","receivedAt":"2018-09-13T05:18:31Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Instead of hard-coding a 40-based constant, split the output of\nfor-each-ref and for-each-reflog by field.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n t/t1406-submodule-ref-store.sh | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/t/t1406-submodule-ref-store.sh b/t/t1406-submodule-ref-store.sh\nindex e093782cc3..d199d872fb 100755\n--- a/t/t1406-submodule-ref-store.sh\n+++ b/t/t1406-submodule-ref-store.sh\n@@ -39,7 +39,7 @@ test_expect_success 'rename_refs() not allowed' '\n '\n \n test_expect_success 'for_each_ref(refs/heads/)' '\n-\t$RUN for-each-ref refs/heads/ | cut -c 42- >actual &&\n+\t$RUN for-each-ref refs/heads/ | cut -d\" \" -f 2- >actual &&\n \tcat >expected <<-\\EOF &&\n \tmaster 0x0\n \tnew-master 0x0\n@@ -48,7 +48,7 @@ test_expect_success 'for_each_ref(refs/heads/)' '\n '\n \n test_expect_success 'for_each_ref() is sorted' '\n-\t$RUN for-each-ref refs/heads/ | cut -c 42- >actual &&\n+\t$RUN for-each-ref refs/heads/ | cut -d\" \" -f 2- >actual &&\n \tsort actual > expected &&\n \ttest_cmp expected actual\n '\n@@ -65,7 +65,7 @@ test_expect_success 'verify_ref(new-master)' '\n '\n \n test_expect_success 'for_each_reflog()' '\n-\t$RUN for-each-reflog | sort | cut -c 42- >actual &&\n+\t$RUN for-each-reflog | sort | cut -d\" \" -f 2- >actual &&\n \tcat >expected <<-\\EOF &&\n \tHEAD 0x1\n \trefs/heads/master 0x0\n"},{"id":"358037","messageId":"20180913051742.252276-12-sandals@crustytoothpaste.net","threadId":"49337","inReplyTo":"20180913051742.252276-1-sandals@crustytoothpaste.net","subject":"[PATCH v5 11/12] t1407: make hash size independent","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2018-09-13T05:17:41Z","receivedAt":"2018-09-13T05:18:32Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Instead of hard-coding a 40-based constant, split the output of\nfor-each-ref and for-each-reflog by field.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n t/t1407-worktree-ref-store.sh | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t1407-worktree-ref-store.sh b/t/t1407-worktree-ref-store.sh\nindex 4623ae15c4..9a84858118 100755\n--- a/t/t1407-worktree-ref-store.sh\n+++ b/t/t1407-worktree-ref-store.sh\n@@ -58,7 +58,7 @@ test_expect_success 'for_each_reflog()' '\n \tmkdir -p     .git/worktrees/wt/logs/refs/bisect &&\n \techo $ZERO_OID > .git/worktrees/wt/logs/refs/bisect/wt-random &&\n \n-\t$RWT for-each-reflog | cut -c 42- | sort >actual &&\n+\t$RWT for-each-reflog | cut -d\" \" -f 2- | sort >actual &&\n \tcat >expected <<-\\EOF &&\n \tHEAD 0x1\n \tPSEUDO-WT 0x0\n@@ -68,7 +68,7 @@ test_expect_success 'for_each_reflog()' '\n \tEOF\n \ttest_cmp expected actual &&\n \n-\t$RMAIN for-each-reflog | cut -c 42- | sort >actual &&\n+\t$RMAIN for-each-reflog | cut -d\" \" -f 2- | sort >actual &&\n \tcat >expected <<-\\EOF &&\n \tHEAD 0x1\n \tPSEUDO-MAIN 0x0\n"},{"id":"358038","messageId":"20180913051742.252276-13-sandals@crustytoothpaste.net","threadId":"49337","inReplyTo":"20180913051742.252276-1-sandals@crustytoothpaste.net","subject":"[PATCH v5 12/12] t5318: use test_oid for HASH_LEN","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2018-09-13T05:17:42Z","receivedAt":"2018-09-13T05:18:33Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"From: Derrick Stolee <stolee@gmail.com>\n\nSigned-off-by: Derrick Stolee <dstolee@microsoft.com>\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n t/t5318-commit-graph.sh | 5 +++--\n 1 file changed, 3 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t5318-commit-graph.sh b/t/t5318-commit-graph.sh\nindex 0c500f7ca2..75fe09521f 100755\n--- a/t/t5318-commit-graph.sh\n+++ b/t/t5318-commit-graph.sh\n@@ -8,7 +8,8 @@ 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+\tobjdir=\".git/objects\" &&\n+\ttest_oid_init\n '\n \n test_expect_success 'verify graph with no graph file' '\n@@ -273,7 +274,7 @@ test_expect_success 'git commit-graph verify' '\n \n NUM_COMMITS=9\n NUM_OCTOPUS_EDGES=2\n-HASH_LEN=20\n+HASH_LEN=\"$(test_oid rawsz)\"\n GRAPH_BYTE_VERSION=4\n GRAPH_BYTE_HASH=5\n GRAPH_BYTE_CHUNK_COUNT=6\n"},{"id":"358060","messageId":"abd21e68-ac72-3111-5813-7d47af3d6aa6@gmail.com","threadId":"49337","inReplyTo":"20180913051742.252276-1-sandals@crustytoothpaste.net","subject":"Re: [PATCH v5 00/12] Hash-independent tests (part 3)","fromName":"Derrick Stolee","fromEmail":"stolee@gmail.com","sentAt":"2018-09-13T17:00:34Z","receivedAt":"2018-09-13T17:00:38Z","isPatch":true,"sender":{"key":"stolee@gmail.com","avatar":"https://avatars.githubusercontent.com/u/570044?v=4"},"body":"On 9/13/2018 1:17 AM, brian m. carlson wrote:\n> This is the next in the series of improvements to make tests\n> hash-independent.\n>\n> A range-diff is below.\n>\n> Changes from v4:\n> * Add local statements to the &&-chain.\n> * Fix a typo in the local statement.\n> * Add a helpful comment about why test_detect_hash is hard-coded to\n>    SHA-1.\n\nThe range-diff and these changes since v4 are reasonable. I'm happy with \nthe current version.\n\nI'm looking forward to this change getting merged down, as I also want \nto use 'test_oid rawsz' for the 'git multi-pack-index verify' tests that \nare currently under review (v2 imminent).\n\nThanks,\n\n-Stolee\n\n"},{"id":"358087","messageId":"87efdxkyi8.fsf@evledraar.gmail.com","threadId":"49337","inReplyTo":"20180913051742.252276-12-sandals@crustytoothpaste.net","subject":"Re: [PATCH v5 11/12] t1407: make hash size independent","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2018-09-13T19:06:55Z","receivedAt":"2018-09-13T19:07:00Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Thu, Sep 13 2018, brian m. carlson wrote:\n\n> -\t$RWT for-each-reflog | cut -c 42- | sort >actual &&\n> +\t$RWT for-each-reflog | cut -d\" \" -f 2- | sort >actual &&\n\nAside from hash size issues, this just makes the tests easier to\nread. Thanks!\n"}]}