{"thread":{"id":"48143","subject":"[PATCH 00/10] Hash-independent tests (part 1)","startedAt":"2018-03-25T19:21:15Z","lastAt":"2018-03-29T14:02:05Z","messageCount":20,"participants":["brian m. carlson","Eric Sunshine","Junio C Hamano","Johannes Schindelin"],"isPatch":true,"patchVersion":1,"patchTotal":10},"messages":[{"id":"342925","messageId":"20180325192055.841459-1-sandals@crustytoothpaste.net","threadId":"48143","inReplyTo":null,"subject":"[PATCH 00/10] Hash-independent tests (part 1)","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2018-03-25T19:20:45Z","receivedAt":"2018-03-25T19:21:15Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"This is a series to make our tests hash-independent.  Many tests have\nhard-coded SHA-1 values in them, and it would be valuable to express\nthese items in a hash-independent way for our hash transitions.\n\nThe approach in this series relies on only three components for hash\nindependence: git rev-parse, git hash-object, and EMPTY_BLOB and\nEMPTY_TREE.  Because many of our shell scripts and test components\nalready rely on the first two, this seems like a safe assumption.\n\nFor the same reason, this series avoids modifying tests that test these\ncomponents or their expected SHA-1 values.  I expect that when we add\nanother hash function, we'll copy these tests to expose both SHA-1 and\nNewHash versions.\n\nMany of our tests use heredocs for defining expected values.  My\napproach has been to interpolate values into the heredocs, as that\nproduces the best readability in my view.\n\nThese tests have been tested using my \"short BLAKE2b\" series (branch\nblake2b-test-hash) and have also been tested based off master.\n\nComments on any aspect of this series are welcome, but opinions on the\napproach or style are especially so.\n\nbrian m. carlson (10):\n  t1011: abstract away SHA-1-specific constants\n  t1304: abstract away SHA-1-specific constants\n  t1300: abstract away SHA-1-specific constants\n  t1405: sort reflog entries in a hash-independent way\n  t1411: abstract away SHA-1-specific constants\n  t1507: abstract away SHA-1-specific constants\n  t2020: abstract away SHA-1 specific constants\n  t2101: modernize test style\n  t2101: abstract away SHA-1-specific constants\n  t2107: abstract away SHA-1-specific constants\n\n t/t1011-read-tree-sparse-checkout.sh |  7 ++-\n t/t1300-repo-config.sh               |  6 +-\n t/t1304-default-acl.sh               |  2 +-\n t/t1405-main-ref-store.sh            |  4 +-\n t/t1411-reflog-show.sh               | 21 ++++---\n t/t1507-rev-parse-upstream.sh        |  5 +-\n t/t2020-checkout-detach.sh           | 40 +++++++-----\n t/t2101-update-index-reupdate.sh     | 91 +++++++++++++++-------------\n t/t2107-update-index-basic.sh        |  6 +-\n 9 files changed, 100 insertions(+), 82 deletions(-)\n\n"},{"id":"342926","messageId":"20180325192055.841459-2-sandals@crustytoothpaste.net","threadId":"48143","inReplyTo":"20180325192055.841459-1-sandals@crustytoothpaste.net","subject":"[PATCH 01/10] t1011: abstract away SHA-1-specific constants","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2018-03-25T19:20:46Z","receivedAt":"2018-03-25T19:21: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 the expected hash value dynamically\ninstead of relying on a hard-coded hash.  Hoist some code earlier in the\ntest to make this possible.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n t/t1011-read-tree-sparse-checkout.sh | 7 ++++---\n 1 file changed, 4 insertions(+), 3 deletions(-)\n\ndiff --git a/t/t1011-read-tree-sparse-checkout.sh b/t/t1011-read-tree-sparse-checkout.sh\nindex c167f606ca..0c6f48f302 100755\n--- a/t/t1011-read-tree-sparse-checkout.sh\n+++ b/t/t1011-read-tree-sparse-checkout.sh\n@@ -15,8 +15,11 @@ test_description='sparse checkout tests\n . \"$TEST_DIRECTORY\"/lib-read-tree.sh\n \n test_expect_success 'setup' '\n+\ttest_commit init &&\n+\techo modified >>init.t &&\n+\n \tcat >expected <<-EOF &&\n-\t100644 77f0ba1734ed79d12881f81b36ee134de6a3327b 0\tinit.t\n+\t100644 $(git hash-object init.t) 0\tinit.t\n \t100644 $EMPTY_BLOB 0\tsub/added\n \t100644 $EMPTY_BLOB 0\tsub/addedtoo\n \t100644 $EMPTY_BLOB 0\tsubsub/added\n@@ -28,8 +31,6 @@ test_expect_success 'setup' '\n \tH subsub/added\n \tEOF\n \n-\ttest_commit init &&\n-\techo modified >>init.t &&\n \tmkdir sub subsub &&\n \ttouch sub/added sub/addedtoo subsub/added &&\n \tgit add init.t sub/added sub/addedtoo subsub/added &&\n"},{"id":"342927","messageId":"20180325192055.841459-3-sandals@crustytoothpaste.net","threadId":"48143","inReplyTo":"20180325192055.841459-1-sandals@crustytoothpaste.net","subject":"[PATCH 02/10] t1304: abstract away SHA-1-specific constants","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2018-03-25T19:20:47Z","receivedAt":"2018-03-25T19:21:19Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Adjust the test so that it uses the $EMPTY_BLOB value instead of\nhard-coding the hash.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n t/t1304-default-acl.sh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/t/t1304-default-acl.sh b/t/t1304-default-acl.sh\nindex f5422f1d33..335d3f3211 100755\n--- a/t/t1304-default-acl.sh\n+++ b/t/t1304-default-acl.sh\n@@ -54,7 +54,7 @@ test_expect_success SETFACL 'Setup test repo' '\n \n test_expect_success SETFACL 'Objects creation does not break ACLs with restrictive umask' '\n \t# SHA1 for empty blob\n-\tcheck_perms_and_acl .git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391\n+\tcheck_perms_and_acl .git/objects/$(echo $EMPTY_BLOB | sed -e \"s,^\\(..\\),\\1/,\")\n '\n \n test_expect_success SETFACL 'git gc does not break ACLs with restrictive umask' '\n"},{"id":"342928","messageId":"20180325192055.841459-4-sandals@crustytoothpaste.net","threadId":"48143","inReplyTo":"20180325192055.841459-1-sandals@crustytoothpaste.net","subject":"[PATCH 03/10] t1300: abstract away SHA-1-specific constants","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2018-03-25T19:20:48Z","receivedAt":"2018-03-25T19:21:20Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Adjust the test so that it uses the computed blob value instead of\nhard-coding a hash.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n t/t1300-repo-config.sh | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh\nindex 4f8e6f5fde..dc7e6c2e77 100755\n--- a/t/t1300-repo-config.sh\n+++ b/t/t1300-repo-config.sh\n@@ -1587,10 +1587,10 @@ test_expect_success '--show-origin stdin with file include' '\n '\n \n test_expect_success !MINGW '--show-origin blob' '\n-\tcat >expect <<-\\EOF &&\n-\t\tblob:a9d9f9e555b5c6f07cbe09d3f06fe3df11e09c08\tuser.custom=true\n-\tEOF\n \tblob=$(git hash-object -w \"$CUSTOM_CONFIG_FILE\") &&\n+\tcat >expect <<-EOF &&\n+\t\tblob:$blob\tuser.custom=true\n+\tEOF\n \tgit config --blob=$blob --show-origin --list >output &&\n \ttest_cmp expect output\n '\n"},{"id":"342929","messageId":"20180325192055.841459-6-sandals@crustytoothpaste.net","threadId":"48143","inReplyTo":"20180325192055.841459-1-sandals@crustytoothpaste.net","subject":"[PATCH 05/10] t1411: abstract away SHA-1-specific constants","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2018-03-25T19:20:50Z","receivedAt":"2018-03-25T19:21:25Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Adjust the test so that it uses a variable consisting of the current\nHEAD instead of a hard-coded hash.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n t/t1411-reflog-show.sh | 21 +++++++++++----------\n 1 file changed, 11 insertions(+), 10 deletions(-)\n\ndiff --git a/t/t1411-reflog-show.sh b/t/t1411-reflog-show.sh\nindex 6ac7734d79..596907758d 100755\n--- a/t/t1411-reflog-show.sh\n+++ b/t/t1411-reflog-show.sh\n@@ -10,6 +10,7 @@ test_expect_success 'setup' '\n \tgit commit -m one\n '\n \n+commit=$(git rev-parse --short HEAD)\n cat >expect <<'EOF'\n Reflog: HEAD@{0} (C O Mitter <committer@example.com>)\n Reflog message: commit (initial): one\n@@ -20,8 +21,8 @@ test_expect_success 'log -g shows reflog headers' '\n \ttest_cmp expect actual\n '\n \n-cat >expect <<'EOF'\n-e46513e HEAD@{0}: commit (initial): one\n+cat >expect <<EOF\n+$commit HEAD@{0}: commit (initial): one\n EOF\n test_expect_success 'oneline reflog format' '\n \tgit log -g -1 --oneline >actual &&\n@@ -33,8 +34,8 @@ test_expect_success 'reflog default format' '\n \ttest_cmp expect actual\n '\n \n-cat >expect <<'EOF'\n-commit e46513e\n+cat >expect <<EOF\n+commit $commit\n Reflog: HEAD@{0} (C O Mitter <committer@example.com>)\n Reflog message: commit (initial): one\n Author: A U Thor <author@example.com>\n@@ -56,8 +57,8 @@ test_expect_success 'using @{now} syntax shows reflog date (multiline)' '\n \ttest_cmp expect actual\n '\n \n-cat >expect <<'EOF'\n-e46513e HEAD@{Thu Apr 7 15:13:13 2005 -0700}: commit (initial): one\n+cat >expect <<EOF\n+$commit HEAD@{Thu Apr 7 15:13:13 2005 -0700}: commit (initial): one\n EOF\n test_expect_success 'using @{now} syntax shows reflog date (oneline)' '\n \tgit log -g -1 --oneline HEAD@{now} >actual &&\n@@ -82,8 +83,8 @@ test_expect_success 'using --date= shows reflog date (multiline)' '\n \ttest_cmp expect actual\n '\n \n-cat >expect <<'EOF'\n-e46513e HEAD@{Thu Apr 7 15:13:13 2005 -0700}: commit (initial): one\n+cat >expect <<EOF\n+$commit HEAD@{Thu Apr 7 15:13:13 2005 -0700}: commit (initial): one\n EOF\n test_expect_success 'using --date= shows reflog date (oneline)' '\n \tgit log -g -1 --oneline --date=default >actual &&\n@@ -109,8 +110,8 @@ test_expect_success 'log.date does not invoke \"--date\" magic (multiline)' '\n \ttest_cmp expect actual\n '\n \n-cat >expect <<'EOF'\n-e46513e HEAD@{0}: commit (initial): one\n+cat >expect <<EOF\n+$commit HEAD@{0}: commit (initial): one\n EOF\n test_expect_success 'log.date does not invoke \"--date\" magic (oneline)' '\n \ttest_config log.date raw &&\n"},{"id":"342930","messageId":"20180325192055.841459-5-sandals@crustytoothpaste.net","threadId":"48143","inReplyTo":"20180325192055.841459-1-sandals@crustytoothpaste.net","subject":"[PATCH 04/10] t1405: sort reflog entries in a hash-independent way","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2018-03-25T19:20:49Z","receivedAt":"2018-03-25T19:21:27Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"The test enumerates reflog entries in an arbitrary order and then sorts\nthem.  For SHA-1, this produces results that happen to sort in\nalphabetical order, but for other hash algorithms they sort differently.\nEnsure we sort the reflog entries in a hash-independent way by sorting\non the ref name instead of the object ID.  Remove an assumption about\nthe length of a hash by using cut with the delimiter and field options\ninstead of the character range option.\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 e8115df5ba..a1e243a05c 100755\n--- a/t/t1405-main-ref-store.sh\n+++ b/t/t1405-main-ref-store.sh\n@@ -45,7 +45,7 @@ test_expect_success 'rename_refs(master, new-master)' '\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@@ -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 | cut -c 42- >actual &&\n+\t$RUN for-each-reflog | sort -k2 | cut -c 42- >actual &&\n \tcat >expected <<-\\EOF &&\n \tHEAD 0x1\n \trefs/heads/master 0x0\n"},{"id":"342931","messageId":"20180325192055.841459-8-sandals@crustytoothpaste.net","threadId":"48143","inReplyTo":"20180325192055.841459-1-sandals@crustytoothpaste.net","subject":"[PATCH 07/10] t2020: abstract away SHA-1 specific constants","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2018-03-25T19:20:52Z","receivedAt":"2018-03-25T19:21:29Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Adjust the test so that it uses variables for the revisions we're\nchecking out instead of hard-coded hashes.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n t/t2020-checkout-detach.sh | 40 +++++++++++++++++++++++---------------\n 1 file changed, 24 insertions(+), 16 deletions(-)\n\ndiff --git a/t/t2020-checkout-detach.sh b/t/t2020-checkout-detach.sh\nindex bb4f2e0c63..1fa670625c 100755\n--- a/t/t2020-checkout-detach.sh\n+++ b/t/t2020-checkout-detach.sh\n@@ -189,8 +189,12 @@ test_expect_success 'no advice given for explicit detached head state' '\n # Detached HEAD tests for GIT_PRINT_SHA1_ELLIPSIS (new format)\n test_expect_success 'describe_detached_head prints no SHA-1 ellipsis when not asked to' \"\n \n+\tcommit=$(git rev-parse --short=12 master^) &&\n+\tcommit2=$(git rev-parse --short=12 master~2) &&\n+\tcommit3=$(git rev-parse --short=12 master~3) &&\n+\n \t# The first detach operation is more chatty than the following ones.\n-\tcat >1st_detach <<-'EOF' &&\n+\tcat >1st_detach <<-EOF &&\n \tNote: checking out 'HEAD^'.\n \n \tYou are in 'detached HEAD' state. You can look around, make experimental\n@@ -202,18 +206,18 @@ test_expect_success 'describe_detached_head prints no SHA-1 ellipsis when not as\n \n \t  git checkout -b <new-branch-name>\n \n-\tHEAD is now at 7c7cd714e262 three\n+\tHEAD is now at \\$commit three\n \tEOF\n \n \t# The remaining ones just show info about previous and current HEADs.\n-\tcat >2nd_detach <<-'EOF' &&\n-\tPrevious HEAD position was 7c7cd714e262 three\n-\tHEAD is now at 139b20d8e6c5 two\n+\tcat >2nd_detach <<-EOF &&\n+\tPrevious HEAD position was \\$commit three\n+\tHEAD is now at \\$commit2 two\n \tEOF\n \n-\tcat >3rd_detach <<-'EOF' &&\n-\tPrevious HEAD position was 139b20d8e6c5 two\n-\tHEAD is now at d79ce1670bdc one\n+\tcat >3rd_detach <<-EOF &&\n+\tPrevious HEAD position was \\$commit2 two\n+\tHEAD is now at \\$commit3 one\n \tEOF\n \n \treset &&\n@@ -261,8 +265,12 @@ test_expect_success 'describe_detached_head prints no SHA-1 ellipsis when not as\n # Detached HEAD tests for GIT_PRINT_SHA1_ELLIPSIS (old format)\n test_expect_success 'describe_detached_head does print SHA-1 ellipsis when asked to' \"\n \n+\tcommit=$(git rev-parse --short=12 master^) &&\n+\tcommit2=$(git rev-parse --short=12 master~2) &&\n+\tcommit3=$(git rev-parse --short=12 master~3) &&\n+\n \t# The first detach operation is more chatty than the following ones.\n-\tcat >1st_detach <<-'EOF' &&\n+\tcat >1st_detach <<-EOF &&\n \tNote: checking out 'HEAD^'.\n \n \tYou are in 'detached HEAD' state. You can look around, make experimental\n@@ -274,18 +282,18 @@ test_expect_success 'describe_detached_head does print SHA-1 ellipsis when asked\n \n \t  git checkout -b <new-branch-name>\n \n-\tHEAD is now at 7c7cd714e262... three\n+\tHEAD is now at \\$commit... three\n \tEOF\n \n \t# The remaining ones just show info about previous and current HEADs.\n-\tcat >2nd_detach <<-'EOF' &&\n-\tPrevious HEAD position was 7c7cd714e262... three\n-\tHEAD is now at 139b20d8e6c5... two\n+\tcat >2nd_detach <<-EOF &&\n+\tPrevious HEAD position was \\$commit... three\n+\tHEAD is now at \\$commit2... two\n \tEOF\n \n-\tcat >3rd_detach <<-'EOF' &&\n-\tPrevious HEAD position was 139b20d8e6c5... two\n-\tHEAD is now at d79ce1670bdc... one\n+\tcat >3rd_detach <<-EOF &&\n+\tPrevious HEAD position was \\$commit2... two\n+\tHEAD is now at \\$commit3... one\n \tEOF\n \n \treset &&\n"},{"id":"342932","messageId":"20180325192055.841459-7-sandals@crustytoothpaste.net","threadId":"48143","inReplyTo":"20180325192055.841459-1-sandals@crustytoothpaste.net","subject":"[PATCH 06/10] t1507: abstract away SHA-1-specific constants","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2018-03-25T19:20:51Z","receivedAt":"2018-03-25T19:21:31Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Adjust the test so that it uses a variable consisting of the current\nHEAD instead of a hard-coded hash.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n t/t1507-rev-parse-upstream.sh | 5 +++--\n 1 file changed, 3 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t1507-rev-parse-upstream.sh b/t/t1507-rev-parse-upstream.sh\nindex 2ce68cc277..93c77eac45 100755\n--- a/t/t1507-rev-parse-upstream.sh\n+++ b/t/t1507-rev-parse-upstream.sh\n@@ -209,8 +209,9 @@ test_expect_success '@{u} works when tracking a local branch' '\n \ttest refs/heads/master = \"$(full_name @{u})\"\n '\n \n+commit=$(git rev-parse HEAD)\n cat >expect <<EOF\n-commit 8f489d01d0cc65c3b0f09504ec50b5ed02a70bd5\n+commit $commit\n Reflog: master@{0} (C O Mitter <committer@example.com>)\n Reflog message: branch: Created from HEAD\n Author: A U Thor <author@example.com>\n@@ -224,7 +225,7 @@ test_expect_success 'log -g other@{u}' '\n '\n \n cat >expect <<EOF\n-commit 8f489d01d0cc65c3b0f09504ec50b5ed02a70bd5\n+commit $commit\n Reflog: master@{Thu Apr 7 15:17:13 2005 -0700} (C O Mitter <committer@example.com>)\n Reflog message: branch: Created from HEAD\n Author: A U Thor <author@example.com>\n"},{"id":"342933","messageId":"20180325192055.841459-9-sandals@crustytoothpaste.net","threadId":"48143","inReplyTo":"20180325192055.841459-1-sandals@crustytoothpaste.net","subject":"[PATCH 08/10] t2101: modernize test style","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2018-03-25T19:20:53Z","receivedAt":"2018-03-25T19:21:33Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Most of our tests start with the opening quote of the test body on the\nsame line as the test_expect_success call.  Additionally, our tests are\nusually indented with a single tab.  Update this test to be the same as\nmost others, which will make it easier to use inline heredocs in the\nfuture.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n t/t2101-update-index-reupdate.sh | 52 ++++++++++++++++++--------------\n 1 file changed, 29 insertions(+), 23 deletions(-)\n\ndiff --git a/t/t2101-update-index-reupdate.sh b/t/t2101-update-index-reupdate.sh\nindex c8bce8c2e4..168733a3c7 100755\n--- a/t/t2101-update-index-reupdate.sh\n+++ b/t/t2101-update-index-reupdate.sh\n@@ -12,15 +12,16 @@ cat > expected <<\\EOF\n 100644 3b18e512dba79e4c8300dd08aeb37f8e728b8dad 0\tfile1\n 100644 9db8893856a8a02eaa73470054b7c1c5a7c82e47 0\tfile2\n EOF\n-test_expect_success 'update-index --add' \\\n-\t'echo hello world >file1 &&\n-\t echo goodbye people >file2 &&\n-\t git update-index --add file1 file2 &&\n-\t git ls-files -s >current &&\n-\t cmp current expected'\n+test_expect_success 'update-index --add' '\n+\techo hello world >file1 &&\n+\techo goodbye people >file2 &&\n+\tgit update-index --add file1 file2 &&\n+\tgit ls-files -s >current &&\n+\tcmp current expected\n+'\n \n-test_expect_success 'update-index --again' \\\n-\t'rm -f file1 &&\n+test_expect_success 'update-index --again' '\n+\trm -f file1 &&\n \techo hello everybody >file2 &&\n \tif git update-index --again\n \tthen\n@@ -29,16 +30,18 @@ test_expect_success 'update-index --again' \\\n \telse\n \t\techo happy - failed as expected\n \tfi &&\n-\t git ls-files -s >current &&\n-\t cmp current expected'\n+\tgit ls-files -s >current &&\n+\tcmp current expected\n+'\n \n cat > expected <<\\EOF\n 100644 0f1ae1422c2bf43f117d3dbd715c988a9ed2103f 0\tfile2\n EOF\n-test_expect_success 'update-index --remove --again' \\\n-\t'git update-index --remove --again &&\n-\t git ls-files -s >current &&\n-\t cmp current expected'\n+test_expect_success 'update-index --remove --again' '\n+\tgit update-index --remove --again &&\n+\tgit ls-files -s >current &&\n+\tcmp current expected\n+'\n \n test_expect_success 'first commit' 'git commit -m initial'\n \n@@ -46,8 +49,8 @@ cat > expected <<\\EOF\n 100644 53ab446c3f4e42ce9bb728a0ccb283a101be4979 0\tdir1/file3\n 100644 0f1ae1422c2bf43f117d3dbd715c988a9ed2103f 0\tfile2\n EOF\n-test_expect_success 'update-index again' \\\n-\t'mkdir -p dir1 &&\n+test_expect_success 'update-index again' '\n+\tmkdir -p dir1 &&\n \techo hello world >dir1/file3 &&\n \techo goodbye people >file2 &&\n \tgit update-index --add file2 dir1/file3 &&\n@@ -55,30 +58,33 @@ test_expect_success 'update-index again' \\\n \techo happy >dir1/file3 &&\n \tgit update-index --again &&\n \tgit ls-files -s >current &&\n-\tcmp current expected'\n+\tcmp current expected\n+'\n \n cat > expected <<\\EOF\n 100644 d7fb3f695f06c759dbf3ab00046e7cc2da22d10f 0\tdir1/file3\n 100644 0f1ae1422c2bf43f117d3dbd715c988a9ed2103f 0\tfile2\n EOF\n-test_expect_success 'update-index --update from subdir' \\\n-\t'echo not so happy >file2 &&\n+test_expect_success 'update-index --update from subdir' '\n+\techo not so happy >file2 &&\n \t(cd dir1 &&\n \tcat ../file2 >file3 &&\n \tgit update-index --again\n \t) &&\n \tgit ls-files -s >current &&\n-\tcmp current expected'\n+\tcmp current expected\n+'\n \n cat > expected <<\\EOF\n 100644 594fb5bb1759d90998e2bf2a38261ae8e243c760 0\tdir1/file3\n 100644 0f1ae1422c2bf43f117d3dbd715c988a9ed2103f 0\tfile2\n EOF\n-test_expect_success 'update-index --update with pathspec' \\\n-\t'echo very happy >file2 &&\n+test_expect_success 'update-index --update with pathspec' '\n+\techo very happy >file2 &&\n \tcat file2 >dir1/file3 &&\n \tgit update-index --again dir1/ &&\n \tgit ls-files -s >current &&\n-\tcmp current expected'\n+\tcmp current expected\n+'\n \n test_done\n"},{"id":"342934","messageId":"20180325192055.841459-10-sandals@crustytoothpaste.net","threadId":"48143","inReplyTo":"20180325192055.841459-1-sandals@crustytoothpaste.net","subject":"[PATCH 09/10] t2101: abstract away SHA-1-specific constants","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2018-03-25T19:20:54Z","receivedAt":"2018-03-25T19:21:35Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Adjust the test so that it uses variables and command substitution for\nblobs instead of hard-coded hashes.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n t/t2101-update-index-reupdate.sh | 41 ++++++++++++++++----------------\n 1 file changed, 21 insertions(+), 20 deletions(-)\n\ndiff --git a/t/t2101-update-index-reupdate.sh b/t/t2101-update-index-reupdate.sh\nindex 168733a3c7..685ec45639 100755\n--- a/t/t2101-update-index-reupdate.sh\n+++ b/t/t2101-update-index-reupdate.sh\n@@ -8,15 +8,15 @@ test_description='git update-index --again test.\n \n . ./test-lib.sh\n \n-cat > expected <<\\EOF\n-100644 3b18e512dba79e4c8300dd08aeb37f8e728b8dad 0\tfile1\n-100644 9db8893856a8a02eaa73470054b7c1c5a7c82e47 0\tfile2\n-EOF\n test_expect_success 'update-index --add' '\n \techo hello world >file1 &&\n \techo goodbye people >file2 &&\n \tgit update-index --add file1 file2 &&\n \tgit ls-files -s >current &&\n+\tcat >expected <<-EOF &&\n+\t100644 $(git hash-object file1) 0\tfile1\n+\t100644 $(git hash-object file2) 0\tfile2\n+\tEOF\n \tcmp current expected\n '\n \n@@ -34,21 +34,17 @@ test_expect_success 'update-index --again' '\n \tcmp current expected\n '\n \n-cat > expected <<\\EOF\n-100644 0f1ae1422c2bf43f117d3dbd715c988a9ed2103f 0\tfile2\n-EOF\n test_expect_success 'update-index --remove --again' '\n \tgit update-index --remove --again &&\n \tgit ls-files -s >current &&\n+\tcat >expected <<-EOF &&\n+\t100644 $(git hash-object file2) 0\tfile2\n+\tEOF\n \tcmp current expected\n '\n \n test_expect_success 'first commit' 'git commit -m initial'\n \n-cat > expected <<\\EOF\n-100644 53ab446c3f4e42ce9bb728a0ccb283a101be4979 0\tdir1/file3\n-100644 0f1ae1422c2bf43f117d3dbd715c988a9ed2103f 0\tfile2\n-EOF\n test_expect_success 'update-index again' '\n \tmkdir -p dir1 &&\n \techo hello world >dir1/file3 &&\n@@ -58,13 +54,14 @@ test_expect_success 'update-index again' '\n \techo happy >dir1/file3 &&\n \tgit update-index --again &&\n \tgit ls-files -s >current &&\n+\tcat >expected <<-EOF &&\n+\t100644 $(git hash-object dir1/file3) 0\tdir1/file3\n+\t100644 $(git hash-object file2) 0\tfile2\n+\tEOF\n \tcmp current expected\n '\n \n-cat > expected <<\\EOF\n-100644 d7fb3f695f06c759dbf3ab00046e7cc2da22d10f 0\tdir1/file3\n-100644 0f1ae1422c2bf43f117d3dbd715c988a9ed2103f 0\tfile2\n-EOF\n+file2=$(git hash-object file2)\n test_expect_success 'update-index --update from subdir' '\n \techo not so happy >file2 &&\n \t(cd dir1 &&\n@@ -72,18 +69,22 @@ test_expect_success 'update-index --update from subdir' '\n \tgit update-index --again\n \t) &&\n \tgit ls-files -s >current &&\n-\tcmp current expected\n+\tcat >expected <<-EOF &&\n+\t100644 $(git hash-object dir1/file3) 0\tdir1/file3\n+\t100644 $file2 0\tfile2\n+\tEOF\n+\ttest_cmp current expected\n '\n \n-cat > expected <<\\EOF\n-100644 594fb5bb1759d90998e2bf2a38261ae8e243c760 0\tdir1/file3\n-100644 0f1ae1422c2bf43f117d3dbd715c988a9ed2103f 0\tfile2\n-EOF\n test_expect_success 'update-index --update with pathspec' '\n \techo very happy >file2 &&\n \tcat file2 >dir1/file3 &&\n \tgit update-index --again dir1/ &&\n \tgit ls-files -s >current &&\n+\tcat >expected <<-EOF &&\n+\t100644 $(git hash-object dir1/file3) 0\tdir1/file3\n+\t100644 $file2 0\tfile2\n+\tEOF\n \tcmp current expected\n '\n \n"},{"id":"342935","messageId":"20180325192055.841459-11-sandals@crustytoothpaste.net","threadId":"48143","inReplyTo":"20180325192055.841459-1-sandals@crustytoothpaste.net","subject":"[PATCH 10/10] t2107: abstract away SHA-1-specific constants","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2018-03-25T19:20:55Z","receivedAt":"2018-03-25T19:21:36Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Use the $EMPTY_BLOB variable instead of hard-coding a hash.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n t/t2107-update-index-basic.sh | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/t/t2107-update-index-basic.sh b/t/t2107-update-index-basic.sh\nindex 32ac6e09bd..1db7e6a1ab 100755\n--- a/t/t2107-update-index-basic.sh\n+++ b/t/t2107-update-index-basic.sh\n@@ -85,9 +85,9 @@ test_expect_success '--chmod=+x and chmod=-x in the same argument list' '\n \t>B &&\n \tgit add A B &&\n \tgit update-index --chmod=+x A --chmod=-x B &&\n-\tcat >expect <<-\\EOF &&\n-\t100755 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0\tA\n-\t100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0\tB\n+\tcat >expect <<-EOF &&\n+\t100755 $EMPTY_BLOB 0\tA\n+\t100644 $EMPTY_BLOB 0\tB\n \tEOF\n \tgit ls-files --stage A B >actual &&\n \ttest_cmp expect actual\n"},{"id":"342960","messageId":"CAPig+cR==SNfGdhwqPdvW75fUxXg-VSQ5Tz_OR7Sy_c0L94axQ@mail.gmail.com","threadId":"48143","inReplyTo":"20180325192055.841459-1-sandals@crustytoothpaste.net","subject":"Re: [PATCH 00/10] Hash-independent tests (part 1)","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2018-03-26T02:10:21Z","receivedAt":"2018-03-26T02:10:26Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Sun, Mar 25, 2018 at 3:20 PM, brian m. carlson\n<sandals@crustytoothpaste.net> wrote:\n> This is a series to make our tests hash-independent.  Many tests have\n> hard-coded SHA-1 values in them, and it would be valuable to express\n> these items in a hash-independent way for our hash transitions.\n>\n> The approach in this series relies on only three components for hash\n> independence: git rev-parse, git hash-object, and EMPTY_BLOB and\n> EMPTY_TREE.  Because many of our shell scripts and test components\n> already rely on the first two, this seems like a safe assumption.\n>\n> For the same reason, this series avoids modifying tests that test these\n> components or their expected SHA-1 values.  I expect that when we add\n> another hash function, we'll copy these tests to expose both SHA-1 and\n> NewHash versions.\n\nWhat's the plan for oddball cases such as 66ae9a57b8 (t3404: rebase\n-i: demonstrate short SHA-1 collision, 2013-08-23) which depend\nimplicitly upon SHA-1 without actually hardcoding any hashes? The test\nadded by 66ae9a57b8, for instance, won't start failing in the face of\nNewHash, but it also won't be testing anything meaningful.\n\nShould such tests be dropped altogether? Should they be marked with a\n'SHA1' predicate or be annotated with a comment as being\nSHA-1-specific? Something else?\n"},{"id":"342963","messageId":"xmqq8tafe92r.fsf@gitster-ct.c.googlers.com","threadId":"48143","inReplyTo":"CAPig+cR==SNfGdhwqPdvW75fUxXg-VSQ5Tz_OR7Sy_c0L94axQ@mail.gmail.com","subject":"Re: [PATCH 00/10] Hash-independent tests (part 1)","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-03-26T04:48:12Z","receivedAt":"2018-03-26T04:48:20Z","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> What's the plan for oddball cases such as 66ae9a57b8 (t3404: rebase\n> -i: demonstrate short SHA-1 collision, 2013-08-23) which depend\n> implicitly upon SHA-1 without actually hardcoding any hashes? The test\n> added by 66ae9a57b8, for instance, won't start failing in the face of\n> NewHash, but it also won't be testing anything meaningful.\n>\n> Should such tests be dropped altogether? Should they be marked with a\n> 'SHA1' predicate or be annotated with a comment as being\n> SHA-1-specific? Something else?\n\nIdeally, the existing one be annotated with prereq SHA1, and also\nduplicated with a tweak to cause the same kind of (half-)collision\nunder the NewHash and be annotated with prereq NewHash.\n\nIt's a different matter how feasible it is to attain such an ideal,\nthough.  t1512 was fun to write, but it was quite a lot of work to\ncome up with bunch of blobs, trees and commits whose object names\nshare the common prefix 0{10}.\n\n"},{"id":"343081","messageId":"xmqqefk6bhw3.fsf@gitster-ct.c.googlers.com","threadId":"48143","inReplyTo":"20180325192055.841459-5-sandals@crustytoothpaste.net","subject":"Re: [PATCH 04/10] t1405: sort reflog entries in a hash-independent way","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-03-26T22:18:20Z","receivedAt":"2018-03-26T22:18:27Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"brian m. carlson\" <sandals@crustytoothpaste.net> writes:\n\n> The test enumerates reflog entries in an arbitrary order and then sorts\n> them.  For SHA-1, this produces results that happen to sort in\n> alphabetical order, but for other hash algorithms they sort differently.\n> Ensure we sort the reflog entries in a hash-independent way by sorting\n> on the ref name instead of the object ID.\n\nMakes sense.\n\n> Remove an assumption about the length of a hash by using cut with\n> the delimiter and field options instead of the character range\n> option.\n\nI thought you used your truncated blake hash to develop and verify\nthese changes, but I'd imagine that the \"42\" thing were hard to\nspot.\n\nThanks.\n\n\n> Signed-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>\n> diff --git a/t/t1405-main-ref-store.sh b/t/t1405-main-ref-store.sh\n> index e8115df5ba..a1e243a05c 100755\n> --- a/t/t1405-main-ref-store.sh\n> +++ b/t/t1405-main-ref-store.sh\n> @@ -45,7 +45,7 @@ test_expect_success 'rename_refs(master, new-master)' '\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> @@ -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 | cut -c 42- >actual &&\n> +\t$RUN for-each-reflog | sort -k2 | cut -c 42- >actual &&\n>  \tcat >expected <<-\\EOF &&\n>  \tHEAD 0x1\n>  \trefs/heads/master 0x0\n"},{"id":"343083","messageId":"20180326032411.GF74743@genre.crustytoothpaste.net","threadId":"48143","inReplyTo":"CAPig+cR==SNfGdhwqPdvW75fUxXg-VSQ5Tz_OR7Sy_c0L94axQ@mail.gmail.com","subject":"Re: [PATCH 00/10] Hash-independent tests (part 1)","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2018-03-26T22:27:08Z","receivedAt":"2018-03-26T22:27:37Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On Sun, Mar 25, 2018 at 10:10:21PM -0400, Eric Sunshine wrote:\n> What's the plan for oddball cases such as 66ae9a57b8 (t3404: rebase\n> -i: demonstrate short SHA-1 collision, 2013-08-23) which depend\n> implicitly upon SHA-1 without actually hardcoding any hashes? The test\n> added by 66ae9a57b8, for instance, won't start failing in the face of\n> NewHash, but it also won't be testing anything meaningful.\n> \n> Should such tests be dropped altogether? Should they be marked with a\n> 'SHA1' predicate or be annotated with a comment as being\n> SHA-1-specific? Something else?\n\nMy plan for these was to treat them the same way as for git rev-parse\nand git hash-object.  Basically, for the moment, I had planned to ignore\nthem, although I like the idea for a prerequisite to get the full\ntestsuite passing in the interim.\n\nUltimately, we could use some sort of lookup table or a test helper to\ntranslate them so that we get functionally equivalent results.  t1512 is\nanother great example of this same kind of test.\n-- \nbrian m. carlson / brian with sandals: Houston, Texas, US\nhttps://www.crustytoothpaste.net/~bmc | My opinion only\nOpenPGP: https://keybase.io/bk2204\n"},{"id":"343086","messageId":"20180326230241.GH74743@genre.crustytoothpaste.net","threadId":"48143","inReplyTo":"xmqqefk6bhw3.fsf@gitster-ct.c.googlers.com","subject":"Re: [PATCH 04/10] t1405: sort reflog entries in a hash-independent way","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2018-03-26T23:02:41Z","receivedAt":"2018-03-26T23:02:52Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On Mon, Mar 26, 2018 at 03:18:20PM -0700, Junio C Hamano wrote:\n> \"brian m. carlson\" <sandals@crustytoothpaste.net> writes:\n> \n> > The test enumerates reflog entries in an arbitrary order and then sorts\n> > them.  For SHA-1, this produces results that happen to sort in\n> > alphabetical order, but for other hash algorithms they sort differently.\n> > Ensure we sort the reflog entries in a hash-independent way by sorting\n> > on the ref name instead of the object ID.\n> \n> Makes sense.\n> \n> > Remove an assumption about the length of a hash by using cut with\n> > the delimiter and field options instead of the character range\n> > option.\n> \n> I thought you used your truncated blake hash to develop and verify\n> these changes, but I'd imagine that the \"42\" thing were hard to\n> spot.\n\nYeah, I had to do those by hand, but it looks like I did miss one.  I'll\nreroll with that change.\n-- \nbrian m. carlson / brian with sandals: Houston, Texas, US\nhttps://www.crustytoothpaste.net/~bmc | My opinion only\nOpenPGP: https://keybase.io/bk2204\n"},{"id":"343127","messageId":"nycvar.QRO.7.76.6.1803271629030.77@ZVAVAG-6OXH6DA.rhebcr.pbec.zvpebfbsg.pbz","threadId":"48143","inReplyTo":"20180325192055.841459-1-sandals@crustytoothpaste.net","subject":"Re: [PATCH 00/10] Hash-independent tests (part 1)","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2018-03-27T14:30:12Z","receivedAt":"2018-03-27T14:30:36Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Brian,\n\nOn Sun, 25 Mar 2018, brian m. carlson wrote:\n\n> This is a series to make our tests hash-independent.  Many tests have\n> hard-coded SHA-1 values in them, and it would be valuable to express\n> these items in a hash-independent way for our hash transitions.\n> \n> The approach in this series relies on only three components for hash\n> independence: git rev-parse, git hash-object, and EMPTY_BLOB and\n> EMPTY_TREE.  Because many of our shell scripts and test components\n> already rely on the first two, this seems like a safe assumption.\n> \n> For the same reason, this series avoids modifying tests that test these\n> components or their expected SHA-1 values.  I expect that when we add\n> another hash function, we'll copy these tests to expose both SHA-1 and\n> NewHash versions.\n> \n> Many of our tests use heredocs for defining expected values.  My\n> approach has been to interpolate values into the heredocs, as that\n> produces the best readability in my view.\n> \n> These tests have been tested using my \"short BLAKE2b\" series (branch\n> blake2b-test-hash) and have also been tested based off master.\n> \n> Comments on any aspect of this series are welcome, but opinions on the\n> approach or style are especially so.\n\nThank you for this patch series!\n\nI reviewed all 10 patches, and while I cannot say anything about whether\nthey miss any spot, they all look sensible and correct.\n\nThanks,\nDscho\n"},{"id":"343129","messageId":"nycvar.QRO.7.76.6.1803271630210.77@ZVAVAG-6OXH6DA.rhebcr.pbec.zvpebfbsg.pbz","threadId":"48143","inReplyTo":"xmqq8tafe92r.fsf@gitster-ct.c.googlers.com","subject":"Re: [PATCH 00/10] Hash-independent tests (part 1)","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2018-03-27T14:40:47Z","receivedAt":"2018-03-27T14:41:06Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Junio,\n\nOn Sun, 25 Mar 2018, Junio C Hamano wrote:\n\n> Eric Sunshine <sunshine@sunshineco.com> writes:\n> \n> > What's the plan for oddball cases such as 66ae9a57b8 (t3404: rebase\n> > -i: demonstrate short SHA-1 collision, 2013-08-23) which depend\n> > implicitly upon SHA-1 without actually hardcoding any hashes? The test\n> > added by 66ae9a57b8, for instance, won't start failing in the face of\n> > NewHash, but it also won't be testing anything meaningful.\n> >\n> > Should such tests be dropped altogether? Should they be marked with a\n> > 'SHA1' predicate or be annotated with a comment as being\n> > SHA-1-specific? Something else?\n> \n> Ideally, the existing one be annotated with prereq SHA1, and also\n> duplicated with a tweak to cause the same kind of (half-)collision\n> under the NewHash and be annotated with prereq NewHash.\n\nThat's a good idea. I wonder whether we want to be a bit more specific,\nthough, so that we have something grep'able for the future? Something like\nSHA1_SHORT_COLLISION or some such?\n\n> It's a different matter how feasible it is to attain such an ideal,\n> though.  t1512 was fun to write, but it was quite a lot of work to\n> come up with bunch of blobs, trees and commits whose object names\n> share the common prefix 0{10}.\n\nDid you write a helper to brute-force those? If so, we might want to have\nsuch a helper in t/helper/ to generate/re-generate those (i.e. it could be\nasked to generate a blob whose ID starts with five NUL bytes, and it would\nhave hard-coded values for already-generated ones). Even if you did not\nwrite such a helper, we might want to have such a helper. That would take\nthe responsibility away from the shell script.\n\nCiao,\nDscho\n"},{"id":"343226","messageId":"xmqqh8p087ck.fsf@gitster-ct.c.googlers.com","threadId":"48143","inReplyTo":"nycvar.QRO.7.76.6.1803271630210.77@ZVAVAG-6OXH6DA.rhebcr.pbec.zvpebfbsg.pbz","subject":"Re: [PATCH 00/10] Hash-independent tests (part 1)","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-03-28T16:58:51Z","receivedAt":"2018-03-28T16:59:00Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n>> Ideally, the existing one be annotated with prereq SHA1, and also\n>> duplicated with a tweak to cause the same kind of (half-)collision\n>> under the NewHash and be annotated with prereq NewHash.\n>\n> That's a good idea. I wonder whether we want to be a bit more specific,\n> though, so that we have something grep'able for the future? Something like\n> SHA1_SHORT_COLLISION or some such?\n\nSorry, you lost me.  \n\nWhat I meant was that a test, for example, that expects the object\nname for an empty blob begins with e69de29 is valid ONLY when Git is\nusing SHA-1 to name objects, so such a test should be run only when\nGit is using SHA-1 and no other hash.  All tests in t1512 that\nexpects the sequence of events in it would yield blobs and trees\nwhose names have many leading \"0\"s are the same way.\n\nI think it would do to have a single prerequisite to cover all such\ntests: \"Run this piece of test only when Git is using SHA-1 hash\".\nI do not think you need a set of prerequisites to say \"Run this with\nSHA-1 because we are testing X\" where X may be \"disambiguation\",\n\"unique-abbrev\", \"loose-refs\", or whatever.\n"},{"id":"343323","messageId":"nycvar.QRO.7.76.6.1803291600240.5026@qfpub.tvgsbejvaqbjf.bet","threadId":"48143","inReplyTo":"xmqqh8p087ck.fsf@gitster-ct.c.googlers.com","subject":"Re: [PATCH 00/10] Hash-independent tests (part 1)","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2018-03-29T14:01:45Z","receivedAt":"2018-03-29T14:02:05Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Junio,\n\nOn Wed, 28 Mar 2018, Junio C Hamano wrote:\n\n> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n> \n> >> Ideally, the existing one be annotated with prereq SHA1, and also\n> >> duplicated with a tweak to cause the same kind of (half-)collision\n> >> under the NewHash and be annotated with prereq NewHash.\n> >\n> > That's a good idea. I wonder whether we want to be a bit more specific,\n> > though, so that we have something grep'able for the future? Something like\n> > SHA1_SHORT_COLLISION or some such?\n> \n> Sorry, you lost me.  \n> \n> What I meant was that a test, for example, that expects the object\n> name for an empty blob begins with e69de29 is valid ONLY when Git is\n> using SHA-1 to name objects, so such a test should be run only when\n> Git is using SHA-1 and no other hash.  All tests in t1512 that\n> expects the sequence of events in it would yield blobs and trees\n> whose names have many leading \"0\"s are the same way.\n> \n> I think it would do to have a single prerequisite to cover all such\n> tests: \"Run this piece of test only when Git is using SHA-1 hash\".\n> I do not think you need a set of prerequisites to say \"Run this with\n> SHA-1 because we are testing X\" where X may be \"disambiguation\",\n> \"unique-abbrev\", \"loose-refs\", or whatever.\n\nI meant for the test case to be annotated such that one could find easily\nwhich test cases rely on specially-crafted objects to cause identical hash\nprefixes.\n\nBut I guess it is not worth the effort (because you'll only find out which\ntests miss that annotation when you try to port the test suite to a new\nhash).\n\nCiao,\nDscho\n"}]}