{"thread":{"id":"46585","subject":"[PATCH] t1002: stop using sum(1)","startedAt":"2017-08-14T20:16:54Z","lastAt":"2017-08-15T14:44:05Z","messageCount":6,"participants":["René Scharfe","Junio C Hamano","Jonathan Nieder","Johannes Sixt"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"326304","messageId":"9f6e13d3-07ff-1eaa-9453-05ca26a3c1ff@web.de","threadId":"46585","inReplyTo":null,"subject":"[PATCH] t1002: stop using sum(1)","fromName":"René Scharfe","fromEmail":"l.s.r@web.de","sentAt":"2017-08-14T20:16:34Z","receivedAt":"2017-08-14T20:16:54Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"sum(1) is a command for calculating checksums of the contents of files.\nIt was part of early editions of Unix (\"Research Unix\", 1972/1973, [1]).\ncksum(1) appeared in 4.4BSD (1993) as a replacement [2], and became part\nof POSIX.1-2008 [3].  OpenBSD 5.6 (2014) removed sum(1).\n\nWe only use sum(1) in t1002 to check for changes in three files.  On\nMinGW we use md5sum(1) instead.  We could switch to the standard command\ncksum(1) for all platforms; MinGW comes with GNU coreutils now, which\nprovides sum(1), cksum(1) and md5sum(1).  Use our standard method for\nchecking for file changes instead: test_cmp.\n\nIt's more convenient because it shows differences nicely, it's faster on\nMinGW because we have a special implementation there based only on\nshell-internal commands, it's simpler as it allows us to avoid stripping\nout unnecessary entries from the checksum file using grep(1), and it's\nmore consistent with the rest of the test suite.\n\nWe already compare changed files with their expected new contents using\ndiff(1), so we don't need to check with \"test_must_fail test_cmp\" if\nthey differ from their original state.  A later patch could convert the\ndirect diff(1) calls to test_cmp as well.\n\nWith all sum(1) calls gone, remove the MinGW-specific implementation\nfrom test-lib.sh as well.\n\n[1] http://minnie.tuhs.org/cgi-bin/utree.pl?file=V3/man/man1/sum.1\n[2] http://minnie.tuhs.org/cgi-bin/utree.pl?file=4.4BSD/usr/share/man/cat1/cksum.0\n[3] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/cksum.html\n---\n t/t1002-read-tree-m-u-2way.sh | 67 ++++++++++++++++++++++---------------------\n t/test-lib.sh                 |  3 --\n 2 files changed, 35 insertions(+), 35 deletions(-)\n\ndiff --git a/t/t1002-read-tree-m-u-2way.sh b/t/t1002-read-tree-m-u-2way.sh\nindex e3bf821694..7ca2e65d10 100755\n--- a/t/t1002-read-tree-m-u-2way.sh\n+++ b/t/t1002-read-tree-m-u-2way.sh\n@@ -51,7 +51,9 @@ test_expect_success \\\n      treeM=$(git write-tree) &&\n      echo treeM $treeM &&\n      git ls-tree $treeM &&\n-     sum bozbar frotz nitfol >M.sum &&\n+     cp bozbar bozbar.M &&\n+     cp frotz frotz.M &&\n+     cp nitfol nitfol.M &&\n      git diff-tree $treeH $treeM'\n \n test_expect_success \\\n@@ -61,8 +63,9 @@ test_expect_success \\\n      read_tree_u_must_succeed -m -u $treeH $treeM &&\n      git ls-files --stage >1-3.out &&\n      cmp M.out 1-3.out &&\n-     sum bozbar frotz nitfol >actual3.sum &&\n-     cmp M.sum actual3.sum &&\n+     test_cmp bozbar.M bozbar &&\n+     test_cmp frotz.M frotz &&\n+     test_cmp nitfol.M nitfol &&\n      check_cache_at bozbar clean &&\n      check_cache_at frotz clean &&\n      check_cache_at nitfol clean'\n@@ -79,8 +82,9 @@ test_expect_success \\\n      test_might_fail git diff -U0 --no-index M.out 4.out >4diff.out &&\n      compare_change 4diff.out expected &&\n      check_cache_at yomin clean &&\n-     sum bozbar frotz nitfol >actual4.sum &&\n-     cmp M.sum actual4.sum &&\n+     test_cmp bozbar.M bozbar &&\n+     test_cmp frotz.M frotz &&\n+     test_cmp nitfol.M nitfol &&\n      echo yomin >yomin1 &&\n      diff yomin yomin1 &&\n      rm -f yomin1'\n@@ -98,8 +102,9 @@ test_expect_success \\\n      test_might_fail git diff -U0 --no-index M.out 5.out >5diff.out &&\n      compare_change 5diff.out expected &&\n      check_cache_at yomin dirty &&\n-     sum bozbar frotz nitfol >actual5.sum &&\n-     cmp M.sum actual5.sum &&\n+     test_cmp bozbar.M bozbar &&\n+     test_cmp frotz.M frotz &&\n+     test_cmp nitfol.M nitfol &&\n      : dirty index should have prevented -u from checking it out. &&\n      echo yomin yomin >yomin1 &&\n      diff yomin yomin1 &&\n@@ -115,8 +120,9 @@ test_expect_success \\\n      git ls-files --stage >6.out &&\n      test_cmp M.out 6.out &&\n      check_cache_at frotz clean &&\n-     sum bozbar frotz nitfol >actual3.sum &&\n-     cmp M.sum actual3.sum &&\n+     test_cmp bozbar.M bozbar &&\n+     test_cmp frotz.M frotz &&\n+     test_cmp nitfol.M nitfol &&\n      echo frotz >frotz1 &&\n      diff frotz frotz1 &&\n      rm -f frotz1'\n@@ -132,8 +138,8 @@ test_expect_success \\\n      git ls-files --stage >7.out &&\n      test_cmp M.out 7.out &&\n      check_cache_at frotz dirty &&\n-     sum bozbar frotz nitfol >actual7.sum &&\n-     if cmp M.sum actual7.sum; then false; else :; fi &&\n+     test_cmp bozbar.M bozbar &&\n+     test_cmp nitfol.M nitfol &&\n      : dirty index should have prevented -u from checking it out. &&\n      echo frotz frotz >frotz1 &&\n      diff frotz frotz1 &&\n@@ -165,8 +171,10 @@ test_expect_success \\\n      read_tree_u_must_succeed -m -u $treeH $treeM &&\n      git ls-files --stage >10.out &&\n      cmp M.out 10.out &&\n-     sum bozbar frotz nitfol >actual10.sum &&\n-     cmp M.sum actual10.sum'\n+     test_cmp bozbar.M bozbar &&\n+     test_cmp frotz.M frotz &&\n+     test_cmp nitfol.M nitfol\n+'\n \n test_expect_success \\\n     '11 - dirty path removed.' \\\n@@ -209,11 +217,8 @@ test_expect_success \\\n      git ls-files --stage >14.out &&\n      test_must_fail git diff -U0 --no-index M.out 14.out >14diff.out &&\n      compare_change 14diff.out expected &&\n-     sum bozbar frotz >actual14.sum &&\n-     grep -v nitfol M.sum > expected14.sum &&\n-     cmp expected14.sum actual14.sum &&\n-     sum bozbar frotz nitfol >actual14a.sum &&\n-     if cmp M.sum actual14a.sum; then false; else :; fi &&\n+     test_cmp bozbar.M bozbar &&\n+     test_cmp frotz.M frotz &&\n      check_cache_at nitfol clean &&\n      echo nitfol nitfol >nitfol1 &&\n      diff nitfol nitfol1 &&\n@@ -231,11 +236,8 @@ test_expect_success \\\n      test_must_fail git diff -U0 --no-index M.out 15.out >15diff.out &&\n      compare_change 15diff.out expected &&\n      check_cache_at nitfol dirty &&\n-     sum bozbar frotz >actual15.sum &&\n-     grep -v nitfol M.sum > expected15.sum &&\n-     cmp expected15.sum actual15.sum &&\n-     sum bozbar frotz nitfol >actual15a.sum &&\n-     if cmp M.sum actual15a.sum; then false; else :; fi &&\n+     test_cmp bozbar.M bozbar &&\n+     test_cmp frotz.M frotz &&\n      echo nitfol nitfol nitfol >nitfol1 &&\n      diff nitfol nitfol1 &&\n      rm -f nitfol1'\n@@ -267,8 +269,10 @@ test_expect_success \\\n      git ls-files --stage >18.out &&\n      test_cmp M.out 18.out &&\n      check_cache_at bozbar clean &&\n-     sum bozbar frotz nitfol >actual18.sum &&\n-     cmp M.sum actual18.sum'\n+     test_cmp bozbar.M bozbar &&\n+     test_cmp frotz.M frotz &&\n+     test_cmp nitfol.M nitfol\n+'\n \n test_expect_success \\\n     '19 - local change already having a good result, further modified.' \\\n@@ -281,11 +285,8 @@ test_expect_success \\\n      git ls-files --stage >19.out &&\n      test_cmp M.out 19.out &&\n      check_cache_at bozbar dirty &&\n-     sum frotz nitfol >actual19.sum &&\n-     grep -v bozbar  M.sum > expected19.sum &&\n-     cmp expected19.sum actual19.sum &&\n-     sum bozbar frotz nitfol >actual19a.sum &&\n-     if cmp M.sum actual19a.sum; then false; else :; fi &&\n+     test_cmp frotz.M frotz &&\n+     test_cmp nitfol.M nitfol &&\n      echo gnusto gnusto >bozbar1 &&\n      diff bozbar bozbar1 &&\n      rm -f bozbar1'\n@@ -300,8 +301,10 @@ test_expect_success \\\n      git ls-files --stage >20.out &&\n      test_cmp M.out 20.out &&\n      check_cache_at bozbar clean &&\n-     sum bozbar frotz nitfol >actual20.sum &&\n-     cmp M.sum actual20.sum'\n+     test_cmp bozbar.M bozbar &&\n+     test_cmp frotz.M frotz &&\n+     test_cmp nitfol.M nitfol\n+'\n \n test_expect_success \\\n     '21 - no local change, dirty cache.' \\\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex 1b6e53f78a..51f52dcd4e 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -991,9 +991,6 @@ case $uname_s in\n \tfind () {\n \t\t/usr/bin/find \"$@\"\n \t}\n-\tsum () {\n-\t\tmd5sum \"$@\"\n-\t}\n \t# git sees Windows-style pwd\n \tpwd () {\n \t\tbuiltin pwd -W\n-- \n2.14.1\n"},{"id":"326309","messageId":"xmqqtw19ubtz.fsf@gitster.mtv.corp.google.com","threadId":"46585","inReplyTo":"9f6e13d3-07ff-1eaa-9453-05ca26a3c1ff@web.de","subject":"Re: [PATCH] t1002: stop using sum(1)","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-08-14T20:35:36Z","receivedAt":"2017-08-14T20:35:43Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"René Scharfe <l.s.r@web.de> writes:\n\n> It's more convenient because it shows differences nicely, it's faster on\n> MinGW because we have a special implementation there based only on\n> shell-internal commands,...\n\nThis made me wonder why we are not using that \"faster\" one\neverywhere, but it turns out that it depends on bash-ism \"local\",\nwhich is perfectly fine when limited to MinGW but not safe to assume\nin general.\n\n> ...\n> With all sum(1) calls gone, remove the MinGW-specific implementation\n> from test-lib.sh as well.\n>\n> [1] http://minnie.tuhs.org/cgi-bin/utree.pl?file=V3/man/man1/sum.1\n> [2] http://minnie.tuhs.org/cgi-bin/utree.pl?file=4.4BSD/usr/share/man/cat1/cksum.0\n> [3] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/cksum.html\n> ---\n>  t/t1002-read-tree-m-u-2way.sh | 67 ++++++++++++++++++++++---------------------\n>  t/test-lib.sh                 |  3 --\n>  2 files changed, 35 insertions(+), 35 deletions(-)\n\nSounds like a sensible approach to clean things up; I didn't check\nwith fine toothed comb if the patch does follow that approach\ncorrectly without breaking things, though.\n\n"},{"id":"326355","messageId":"20170815004546.GA78174@aiede.mtv.corp.google.com","threadId":"46585","inReplyTo":"9f6e13d3-07ff-1eaa-9453-05ca26a3c1ff@web.de","subject":"Re: [PATCH] t1002: stop using sum(1)","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2017-08-15T00:46:35Z","receivedAt":"2017-08-15T00:46:45Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Hi,\n\nRené Scharfe wrote:\n\n> sum(1) is a command for calculating checksums of the contents of files.\n> It was part of early editions of Unix (\"Research Unix\", 1972/1973, [1]).\n> cksum(1) appeared in 4.4BSD (1993) as a replacement [2], and became part\n> of POSIX.1-2008 [3].  OpenBSD 5.6 (2014) removed sum(1).\n>\n> We only use sum(1) in t1002 to check for changes in three files.  On\n> MinGW we use md5sum(1) instead.  We could switch to the standard command\n> cksum(1) for all platforms; MinGW comes with GNU coreutils now, which\n> provides sum(1), cksum(1) and md5sum(1).  Use our standard method for\n> checking for file changes instead: test_cmp.\n>\n> It's more convenient because it shows differences nicely, it's faster on\n> MinGW because we have a special implementation there based only on\n> shell-internal commands, it's simpler as it allows us to avoid stripping\n> out unnecessary entries from the checksum file using grep(1), and it's\n> more consistent with the rest of the test suite.\n>\n> We already compare changed files with their expected new contents using\n> diff(1), so we don't need to check with \"test_must_fail test_cmp\" if\n> they differ from their original state.  A later patch could convert the\n> direct diff(1) calls to test_cmp as well.\n>\n> With all sum(1) calls gone, remove the MinGW-specific implementation\n> from test-lib.sh as well.\n>\n> [1] http://minnie.tuhs.org/cgi-bin/utree.pl?file=V3/man/man1/sum.1\n> [2] http://minnie.tuhs.org/cgi-bin/utree.pl?file=4.4BSD/usr/share/man/cat1/cksum.0\n> [3] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/cksum.html\n> ---\n>  t/t1002-read-tree-m-u-2way.sh | 67 ++++++++++++++++++++++---------------------\n>  t/test-lib.sh                 |  3 --\n>  2 files changed, 35 insertions(+), 35 deletions(-)\n\nNicely analyzed.  May we forge your sign-off?\n\n[...]\n> --- a/t/t1002-read-tree-m-u-2way.sh\n> +++ b/t/t1002-read-tree-m-u-2way.sh\n[...]\n> @@ -132,8 +138,8 @@ test_expect_success \\\n>       git ls-files --stage >7.out &&\n>       test_cmp M.out 7.out &&\n>       check_cache_at frotz dirty &&\n> -     sum bozbar frotz nitfol >actual7.sum &&\n> -     if cmp M.sum actual7.sum; then false; else :; fi &&\n> +     test_cmp bozbar.M bozbar &&\n> +     test_cmp nitfol.M nitfol &&\n\nThis one is strange.  What is that '! cmp' trying to check for?\nDoes the replacement capture the same thing?\n\nE.g., does it need a '! test_cmp frotz.M frotz &&' line?\n\nI haven't looked at the context closely --- another option could be a\nnote in the commit message about how that '! cmp' line was not testing\nanything useful in the first place.\n\n[...]\n> @@ -209,11 +217,8 @@ test_expect_success \\\n>       git ls-files --stage >14.out &&\n>       test_must_fail git diff -U0 --no-index M.out 14.out >14diff.out &&\n>       compare_change 14diff.out expected &&\n> -     sum bozbar frotz >actual14.sum &&\n> -     grep -v nitfol M.sum > expected14.sum &&\n> -     cmp expected14.sum actual14.sum &&\n> -     sum bozbar frotz nitfol >actual14a.sum &&\n> -     if cmp M.sum actual14a.sum; then false; else :; fi &&\n> +     test_cmp bozbar.M bozbar &&\n> +     test_cmp frotz.M frotz &&\n\nSame question here: the preimage seems to be a stricter test than the\npostimage.\n\n[...]\n> @@ -231,11 +236,8 @@ test_expect_success \\\n>       test_must_fail git diff -U0 --no-index M.out 15.out >15diff.out &&\n>       compare_change 15diff.out expected &&\n>       check_cache_at nitfol dirty &&\n> -     sum bozbar frotz >actual15.sum &&\n> -     grep -v nitfol M.sum > expected15.sum &&\n> -     cmp expected15.sum actual15.sum &&\n> -     sum bozbar frotz nitfol >actual15a.sum &&\n> -     if cmp M.sum actual15a.sum; then false; else :; fi &&\n> +     test_cmp bozbar.M bozbar &&\n> +     test_cmp frotz.M frotz &&\n\nLikewise.\n\n[...]\n> @@ -281,11 +285,8 @@ test_expect_success \\\n>       git ls-files --stage >19.out &&\n>       test_cmp M.out 19.out &&\n>       check_cache_at bozbar dirty &&\n> -     sum frotz nitfol >actual19.sum &&\n> -     grep -v bozbar  M.sum > expected19.sum &&\n> -     cmp expected19.sum actual19.sum &&\n> -     sum bozbar frotz nitfol >actual19a.sum &&\n> -     if cmp M.sum actual19a.sum; then false; else :; fi &&\n> +     test_cmp frotz.M frotz &&\n> +     test_cmp nitfol.M nitfol &&\n\nLikewise.\n\nThe rest looks good.\n\nThanks,\nJonathan\n"},{"id":"326366","messageId":"53a9a3cd-f814-47a3-cc9b-977f9107614c@kdbg.org","threadId":"46585","inReplyTo":"20170815004546.GA78174@aiede.mtv.corp.google.com","subject":"Re: [PATCH] t1002: stop using sum(1)","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2017-08-15T06:27:35Z","receivedAt":"2017-08-15T06:27:48Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 15.08.2017 um 02:46 schrieb Jonathan Nieder:\n> Hi,\n> \n> René Scharfe wrote:\n> \n>> sum(1) is a command for calculating checksums of the contents of files.\n>> It was part of early editions of Unix (\"Research Unix\", 1972/1973, [1]).\n>> cksum(1) appeared in 4.4BSD (1993) as a replacement [2], and became part\n>> of POSIX.1-2008 [3].  OpenBSD 5.6 (2014) removed sum(1).\n>>\n>> We only use sum(1) in t1002 to check for changes in three files.  On\n>> MinGW we use md5sum(1) instead.  We could switch to the standard command\n>> cksum(1) for all platforms; MinGW comes with GNU coreutils now, which\n>> provides sum(1), cksum(1) and md5sum(1).  Use our standard method for\n>> checking for file changes instead: test_cmp.\n>>\n>> It's more convenient because it shows differences nicely, it's faster on\n>> MinGW because we have a special implementation there based only on\n>> shell-internal commands, it's simpler as it allows us to avoid stripping\n>> out unnecessary entries from the checksum file using grep(1), and it's\n>> more consistent with the rest of the test suite.\n>>\n>> We already compare changed files with their expected new contents using\n>> diff(1), so we don't need to check with \"test_must_fail test_cmp\" if\n>> they differ from their original state.  A later patch could convert the\n>> direct diff(1) calls to test_cmp as well.\n>>\n>> With all sum(1) calls gone, remove the MinGW-specific implementation\n>> from test-lib.sh as well.\n>>\n>> [1] http://minnie.tuhs.org/cgi-bin/utree.pl?file=V3/man/man1/sum.1\n>> [2] http://minnie.tuhs.org/cgi-bin/utree.pl?file=4.4BSD/usr/share/man/cat1/cksum.0\n>> [3] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/cksum.html\n>> ---\n>>   t/t1002-read-tree-m-u-2way.sh | 67 ++++++++++++++++++++++---------------------\n>>   t/test-lib.sh                 |  3 --\n>>   2 files changed, 35 insertions(+), 35 deletions(-)\n> \n> Nicely analyzed.  May we forge your sign-off?\n> \n> [...]\n>> --- a/t/t1002-read-tree-m-u-2way.sh\n>> +++ b/t/t1002-read-tree-m-u-2way.sh\n> [...]\n>> @@ -132,8 +138,8 @@ test_expect_success \\\n>>        git ls-files --stage >7.out &&\n>>        test_cmp M.out 7.out &&\n>>        check_cache_at frotz dirty &&\n>> -     sum bozbar frotz nitfol >actual7.sum &&\n>> -     if cmp M.sum actual7.sum; then false; else :; fi &&\n>> +     test_cmp bozbar.M bozbar &&\n>> +     test_cmp nitfol.M nitfol &&\n> \n> This one is strange.  What is that '! cmp' trying to check for?\n> Does the replacement capture the same thing?\n> \n> E.g., does it need a '! test_cmp frotz.M frotz &&' line?\n\nIn the context that you stripped a 'diff frotz frotz1' occurs, i.e., a \ncheck for the expected content of the file whose content changes. \nTogether with the new test_cmp lines, the new text is a stricter check \nthan we have in the old text.\n\nThe patch looks good.\n\nReviewed-by: Johannes Sixt <j6t@kdbg.org>\n\n-- Hannes\n"},{"id":"326404","messageId":"12431963-18b4-73f8-4801-37c8cd2e7268@web.de","threadId":"46585","inReplyTo":"9f6e13d3-07ff-1eaa-9453-05ca26a3c1ff@web.de","subject":"Re: [PATCH] t1002: stop using sum(1)","fromName":"René Scharfe","fromEmail":"l.s.r@web.de","sentAt":"2017-08-15T14:37:28Z","receivedAt":"2017-08-15T14:37:55Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"Am 14.08.2017 um 22:16 schrieb René Scharfe:\n> sum(1) is a command for calculating checksums of the contents of files.\n> It was part of early editions of Unix (\"Research Unix\", 1972/1973, [1]).\n> cksum(1) appeared in 4.4BSD (1993) as a replacement [2], and became part\n> of POSIX.1-2008 [3].  OpenBSD 5.6 (2014) removed sum(1).\n> \n> We only use sum(1) in t1002 to check for changes in three files.  On\n> MinGW we use md5sum(1) instead.  We could switch to the standard command\n> cksum(1) for all platforms; MinGW comes with GNU coreutils now, which\n> provides sum(1), cksum(1) and md5sum(1).  Use our standard method for\n> checking for file changes instead: test_cmp.\n> \n> It's more convenient because it shows differences nicely, it's faster on\n> MinGW because we have a special implementation there based only on\n> shell-internal commands, it's simpler as it allows us to avoid stripping\n> out unnecessary entries from the checksum file using grep(1), and it's\n> more consistent with the rest of the test suite.\n> \n> We already compare changed files with their expected new contents using\n> diff(1), so we don't need to check with \"test_must_fail test_cmp\" if\n> they differ from their original state.  A later patch could convert the\n> direct diff(1) calls to test_cmp as well.\n> \n> With all sum(1) calls gone, remove the MinGW-specific implementation\n> from test-lib.sh as well.\n> \n> [1] http://minnie.tuhs.org/cgi-bin/utree.pl?file=V3/man/man1/sum.1\n> [2] http://minnie.tuhs.org/cgi-bin/utree.pl?file=4.4BSD/usr/share/man/cat1/cksum.0\n> [3] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/cksum.html\n\nForgot this (intentional full-quote ahead):\n\nSigned-off-by: Rene Scharfe <l.s.r@web.de>\n\n> ---\n>   t/t1002-read-tree-m-u-2way.sh | 67 ++++++++++++++++++++++---------------------\n>   t/test-lib.sh                 |  3 --\n>   2 files changed, 35 insertions(+), 35 deletions(-)\n> \n> diff --git a/t/t1002-read-tree-m-u-2way.sh b/t/t1002-read-tree-m-u-2way.sh\n> index e3bf821694..7ca2e65d10 100755\n> --- a/t/t1002-read-tree-m-u-2way.sh\n> +++ b/t/t1002-read-tree-m-u-2way.sh\n> @@ -51,7 +51,9 @@ test_expect_success \\\n>        treeM=$(git write-tree) &&\n>        echo treeM $treeM &&\n>        git ls-tree $treeM &&\n> -     sum bozbar frotz nitfol >M.sum &&\n> +     cp bozbar bozbar.M &&\n> +     cp frotz frotz.M &&\n> +     cp nitfol nitfol.M &&\n>        git diff-tree $treeH $treeM'\n>   \n>   test_expect_success \\\n> @@ -61,8 +63,9 @@ test_expect_success \\\n>        read_tree_u_must_succeed -m -u $treeH $treeM &&\n>        git ls-files --stage >1-3.out &&\n>        cmp M.out 1-3.out &&\n> -     sum bozbar frotz nitfol >actual3.sum &&\n> -     cmp M.sum actual3.sum &&\n> +     test_cmp bozbar.M bozbar &&\n> +     test_cmp frotz.M frotz &&\n> +     test_cmp nitfol.M nitfol &&\n>        check_cache_at bozbar clean &&\n>        check_cache_at frotz clean &&\n>        check_cache_at nitfol clean'\n> @@ -79,8 +82,9 @@ test_expect_success \\\n>        test_might_fail git diff -U0 --no-index M.out 4.out >4diff.out &&\n>        compare_change 4diff.out expected &&\n>        check_cache_at yomin clean &&\n> -     sum bozbar frotz nitfol >actual4.sum &&\n> -     cmp M.sum actual4.sum &&\n> +     test_cmp bozbar.M bozbar &&\n> +     test_cmp frotz.M frotz &&\n> +     test_cmp nitfol.M nitfol &&\n>        echo yomin >yomin1 &&\n>        diff yomin yomin1 &&\n>        rm -f yomin1'\n> @@ -98,8 +102,9 @@ test_expect_success \\\n>        test_might_fail git diff -U0 --no-index M.out 5.out >5diff.out &&\n>        compare_change 5diff.out expected &&\n>        check_cache_at yomin dirty &&\n> -     sum bozbar frotz nitfol >actual5.sum &&\n> -     cmp M.sum actual5.sum &&\n> +     test_cmp bozbar.M bozbar &&\n> +     test_cmp frotz.M frotz &&\n> +     test_cmp nitfol.M nitfol &&\n>        : dirty index should have prevented -u from checking it out. &&\n>        echo yomin yomin >yomin1 &&\n>        diff yomin yomin1 &&\n> @@ -115,8 +120,9 @@ test_expect_success \\\n>        git ls-files --stage >6.out &&\n>        test_cmp M.out 6.out &&\n>        check_cache_at frotz clean &&\n> -     sum bozbar frotz nitfol >actual3.sum &&\n> -     cmp M.sum actual3.sum &&\n> +     test_cmp bozbar.M bozbar &&\n> +     test_cmp frotz.M frotz &&\n> +     test_cmp nitfol.M nitfol &&\n>        echo frotz >frotz1 &&\n>        diff frotz frotz1 &&\n>        rm -f frotz1'\n> @@ -132,8 +138,8 @@ test_expect_success \\\n>        git ls-files --stage >7.out &&\n>        test_cmp M.out 7.out &&\n>        check_cache_at frotz dirty &&\n> -     sum bozbar frotz nitfol >actual7.sum &&\n> -     if cmp M.sum actual7.sum; then false; else :; fi &&\n> +     test_cmp bozbar.M bozbar &&\n> +     test_cmp nitfol.M nitfol &&\n>        : dirty index should have prevented -u from checking it out. &&\n>        echo frotz frotz >frotz1 &&\n>        diff frotz frotz1 &&\n> @@ -165,8 +171,10 @@ test_expect_success \\\n>        read_tree_u_must_succeed -m -u $treeH $treeM &&\n>        git ls-files --stage >10.out &&\n>        cmp M.out 10.out &&\n> -     sum bozbar frotz nitfol >actual10.sum &&\n> -     cmp M.sum actual10.sum'\n> +     test_cmp bozbar.M bozbar &&\n> +     test_cmp frotz.M frotz &&\n> +     test_cmp nitfol.M nitfol\n> +'\n>   \n>   test_expect_success \\\n>       '11 - dirty path removed.' \\\n> @@ -209,11 +217,8 @@ test_expect_success \\\n>        git ls-files --stage >14.out &&\n>        test_must_fail git diff -U0 --no-index M.out 14.out >14diff.out &&\n>        compare_change 14diff.out expected &&\n> -     sum bozbar frotz >actual14.sum &&\n> -     grep -v nitfol M.sum > expected14.sum &&\n> -     cmp expected14.sum actual14.sum &&\n> -     sum bozbar frotz nitfol >actual14a.sum &&\n> -     if cmp M.sum actual14a.sum; then false; else :; fi &&\n> +     test_cmp bozbar.M bozbar &&\n> +     test_cmp frotz.M frotz &&\n>        check_cache_at nitfol clean &&\n>        echo nitfol nitfol >nitfol1 &&\n>        diff nitfol nitfol1 &&\n> @@ -231,11 +236,8 @@ test_expect_success \\\n>        test_must_fail git diff -U0 --no-index M.out 15.out >15diff.out &&\n>        compare_change 15diff.out expected &&\n>        check_cache_at nitfol dirty &&\n> -     sum bozbar frotz >actual15.sum &&\n> -     grep -v nitfol M.sum > expected15.sum &&\n> -     cmp expected15.sum actual15.sum &&\n> -     sum bozbar frotz nitfol >actual15a.sum &&\n> -     if cmp M.sum actual15a.sum; then false; else :; fi &&\n> +     test_cmp bozbar.M bozbar &&\n> +     test_cmp frotz.M frotz &&\n>        echo nitfol nitfol nitfol >nitfol1 &&\n>        diff nitfol nitfol1 &&\n>        rm -f nitfol1'\n> @@ -267,8 +269,10 @@ test_expect_success \\\n>        git ls-files --stage >18.out &&\n>        test_cmp M.out 18.out &&\n>        check_cache_at bozbar clean &&\n> -     sum bozbar frotz nitfol >actual18.sum &&\n> -     cmp M.sum actual18.sum'\n> +     test_cmp bozbar.M bozbar &&\n> +     test_cmp frotz.M frotz &&\n> +     test_cmp nitfol.M nitfol\n> +'\n>   \n>   test_expect_success \\\n>       '19 - local change already having a good result, further modified.' \\\n> @@ -281,11 +285,8 @@ test_expect_success \\\n>        git ls-files --stage >19.out &&\n>        test_cmp M.out 19.out &&\n>        check_cache_at bozbar dirty &&\n> -     sum frotz nitfol >actual19.sum &&\n> -     grep -v bozbar  M.sum > expected19.sum &&\n> -     cmp expected19.sum actual19.sum &&\n> -     sum bozbar frotz nitfol >actual19a.sum &&\n> -     if cmp M.sum actual19a.sum; then false; else :; fi &&\n> +     test_cmp frotz.M frotz &&\n> +     test_cmp nitfol.M nitfol &&\n>        echo gnusto gnusto >bozbar1 &&\n>        diff bozbar bozbar1 &&\n>        rm -f bozbar1'\n> @@ -300,8 +301,10 @@ test_expect_success \\\n>        git ls-files --stage >20.out &&\n>        test_cmp M.out 20.out &&\n>        check_cache_at bozbar clean &&\n> -     sum bozbar frotz nitfol >actual20.sum &&\n> -     cmp M.sum actual20.sum'\n> +     test_cmp bozbar.M bozbar &&\n> +     test_cmp frotz.M frotz &&\n> +     test_cmp nitfol.M nitfol\n> +'\n>   \n>   test_expect_success \\\n>       '21 - no local change, dirty cache.' \\\n> diff --git a/t/test-lib.sh b/t/test-lib.sh\n> index 1b6e53f78a..51f52dcd4e 100644\n> --- a/t/test-lib.sh\n> +++ b/t/test-lib.sh\n> @@ -991,9 +991,6 @@ case $uname_s in\n>   \tfind () {\n>   \t\t/usr/bin/find \"$@\"\n>   \t}\n> -\tsum () {\n> -\t\tmd5sum \"$@\"\n> -\t}\n>   \t# git sees Windows-style pwd\n>   \tpwd () {\n>   \t\tbuiltin pwd -W\n> \n"},{"id":"326406","messageId":"5c9752cb-3c47-19f0-42b2-591bd29134f9@web.de","threadId":"46585","inReplyTo":"20170815004546.GA78174@aiede.mtv.corp.google.com","subject":"Re: [PATCH] t1002: stop using sum(1)","fromName":"René Scharfe","fromEmail":"l.s.r@web.de","sentAt":"2017-08-15T14:43:51Z","receivedAt":"2017-08-15T14:44:05Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"Am 15.08.2017 um 02:46 schrieb Jonathan Nieder:\n> Hi,\n> \n> René Scharfe wrote:\n\n>> We already compare changed files with their expected new contents using\n>> diff(1), so we don't need to check with \"test_must_fail test_cmp\" if\n>> they differ from their original state.  A later patch could convert the\n>> direct diff(1) calls to test_cmp as well.\n\nLet's call that paragraph \"A\".\n\n> Nicely analyzed.  May we forge your sign-off?\n\nOops, yes, thanks for reminding me, handed it in late now.\n\n> \n> [...]\n>> --- a/t/t1002-read-tree-m-u-2way.sh\n>> +++ b/t/t1002-read-tree-m-u-2way.sh\n> [...]\n>> @@ -132,8 +138,8 @@ test_expect_success \\\n>>        git ls-files --stage >7.out &&\n>>        test_cmp M.out 7.out &&\n>>        check_cache_at frotz dirty &&\n>> -     sum bozbar frotz nitfol >actual7.sum &&\n>> -     if cmp M.sum actual7.sum; then false; else :; fi &&\n>> +     test_cmp bozbar.M bozbar &&\n>> +     test_cmp nitfol.M nitfol &&\n> \n> This one is strange.  What is that '! cmp' trying to check for?\n> Does the replacement capture the same thing?\n> \n> E.g., does it need a '! test_cmp frotz.M frotz &&' line?\n> \n> I haven't looked at the context closely --- another option could be a\n> note in the commit message about how that '! cmp' line was not testing\n> anything useful in the first place.\n\nThat's what paragraph A refers to.  And as Johannes mentioned: We\nalready check for equality in the lines following the context you\ncited (it's in my original email), so there is no need to check\nfor inequality as well.  That's true for all the cases you spotted.\n\nRené\n"}]}