{"thread":{"id":"18315","subject":"[PATCH] Tests: use test_cmp instead of diff where possible","startedAt":"2009-03-15T13:33:56Z","lastAt":"2009-03-17T13:21:50Z","messageCount":6,"participants":["Miklos Vajna","René Scharfe","Jeff King","Carlos Rica"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"108047","messageId":"1237124036-1348-1-git-send-email-vmiklos@frugalware.org","threadId":"18315","inReplyTo":null,"subject":"[PATCH] Tests: use test_cmp instead of diff where possible","fromName":"Miklos Vajna","fromEmail":"vmiklos@frugalware.org","sentAt":"2009-03-15T13:33:56Z","receivedAt":"2009-03-15T13:33:56Z","isPatch":true,"sender":{"key":"vmiklos@frugalware.org","avatar":"https://gravatar.com/avatar/401c1cbbb3a5d13e650c691a2c71d6fd0b80df1a01bc74d9f1972675dd58f2bd?d=mp&s=160"},"body":"Several old tests were written before test_cmp was introduced, convert\nthese to test_cmp.\n\nSigned-off-by: Miklos Vajna <vmiklos@frugalware.org>\n---\n\nI intentionally did not touch t5000 - using test_cmp -r works for me,\nsince the default is diff -u, but that would break the setup of users\nwhere GIT_TEST_CMP is set to cmp.\n\n t/t0000-basic.sh                    |    8 ++++----\n t/t1100-commit-tree-options.sh      |    2 +-\n t/t1400-update-ref.sh               |    6 +++---\n t/t3000-ls-files-others.sh          |    4 ++--\n t/t3010-ls-files-killed-modified.sh |    4 ++--\n t/t5000-tar-tree.sh                 |    2 +-\n t/t9001-send-email.sh               |    2 +-\n 7 files changed, 14 insertions(+), 14 deletions(-)\n\ndiff --git a/t/t0000-basic.sh b/t/t0000-basic.sh\nindex 70df15c..4837300 100755\n--- a/t/t0000-basic.sh\n+++ b/t/t0000-basic.sh\n@@ -127,7 +127,7 @@ cat >expected <<\\EOF\n EOF\n test_expect_success \\\n     'validate git ls-files output for a known tree.' \\\n-    'diff current expected'\n+    'test_cmp current expected'\n \n test_expect_success \\\n     'writing tree out with git write-tree.' \\\n@@ -147,7 +147,7 @@ cat >expected <<\\EOF\n EOF\n test_expect_success \\\n     'git ls-tree output for a known tree.' \\\n-    'diff current expected'\n+    'test_cmp current expected'\n \n # This changed in ls-tree pathspec change -- recursive does\n # not show tree nodes anymore.\n@@ -166,7 +166,7 @@ cat >expected <<\\EOF\n EOF\n test_expect_success \\\n     'git ls-tree -r output for a known tree.' \\\n-    'diff current expected'\n+    'test_cmp current expected'\n \n # But with -r -t we can have both.\n test_expect_success \\\n@@ -187,7 +187,7 @@ cat >expected <<\\EOF\n EOF\n test_expect_success \\\n     'git ls-tree -r output for a known tree.' \\\n-    'diff current expected'\n+    'test_cmp current expected'\n \n test_expect_success \\\n     'writing partial tree out with git write-tree --prefix.' \\\ndiff --git a/t/t1100-commit-tree-options.sh b/t/t1100-commit-tree-options.sh\nindex 7f7fc36..c4414ff 100755\n--- a/t/t1100-commit-tree-options.sh\n+++ b/t/t1100-commit-tree-options.sh\n@@ -40,6 +40,6 @@ test_expect_success \\\n \n test_expect_success \\\n     'compare commit' \\\n-    'diff expected commit'\n+    'test_cmp expected commit'\n \n test_done\ndiff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh\nindex bd58926..54ba3df 100755\n--- a/t/t1400-update-ref.sh\n+++ b/t/t1400-update-ref.sh\n@@ -137,7 +137,7 @@ $B $A $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150860 +0000\n EOF\n test_expect_success \\\n \t\"verifying $m's log\" \\\n-\t\"diff expect .git/logs/$m\"\n+\t\"test_cmp expect .git/logs/$m\"\n rm -rf .git/$m .git/logs expect\n \n test_expect_success \\\n@@ -168,7 +168,7 @@ $B $A $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150980 +0000\n EOF\n test_expect_success \\\n \t\"verifying $m's log\" \\\n-\t'diff expect .git/logs/$m'\n+\t'test_cmp expect .git/logs/$m'\n rm -f .git/$m .git/logs/$m expect\n \n git update-ref $m $D\n@@ -272,7 +272,7 @@ $h_FIXED $h_MERGED $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117151100 +0000\tc\n EOF\n test_expect_success \\\n \t'git commit logged updates' \\\n-\t\"diff expect .git/logs/$m\"\n+\t\"test_cmp expect .git/logs/$m\"\n unset h_TEST h_OTHER h_FIXED h_MERGED\n \n test_expect_success \\\ndiff --git a/t/t3000-ls-files-others.sh b/t/t3000-ls-files-others.sh\nindex bc0a351..304dd02 100755\n--- a/t/t3000-ls-files-others.sh\n+++ b/t/t3000-ls-files-others.sh\n@@ -42,7 +42,7 @@ test_expect_success \\\n \n test_expect_success \\\n     'git ls-files --others should pick up symlinks.' \\\n-    'diff output expected1'\n+    'test_cmp output expected1'\n \n test_expect_success \\\n     'git ls-files --others --directory to show output.' \\\n@@ -51,6 +51,6 @@ test_expect_success \\\n \n test_expect_success \\\n     'git ls-files --others --directory should not get confused.' \\\n-    'diff output expected2'\n+    'test_cmp output expected2'\n \n test_done\ndiff --git a/t/t3010-ls-files-killed-modified.sh b/t/t3010-ls-files-killed-modified.sh\nindex ec14040..4f5375e 100755\n--- a/t/t3010-ls-files-killed-modified.sh\n+++ b/t/t3010-ls-files-killed-modified.sh\n@@ -75,7 +75,7 @@ EOF\n \n test_expect_success \\\n     'validate git ls-files -k output.' \\\n-    'diff .output .expected'\n+    'test_cmp .output .expected'\n \n test_expect_success \\\n     'git ls-files -m to show modified files.' \\\n@@ -91,6 +91,6 @@ EOF\n \n test_expect_success \\\n     'validate git ls-files -m output.' \\\n-    'diff .output .expected'\n+    'test_cmp .output .expected'\n \n test_done\ndiff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh\nindex b7e3628..bfd593c 100755\n--- a/t/t5000-tar-tree.sh\n+++ b/t/t5000-tar-tree.sh\n@@ -76,7 +76,7 @@ test_expect_success \\\n \n test_expect_success \\\n     'git archive vs. git tar-tree' \\\n-    'diff b.tar b2.tar'\n+    'test_cmp b.tar b2.tar'\n \n test_expect_success \\\n     'git archive in a bare repo' \\\ndiff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh\nindex 08d5b91..4fcc2e1 100755\n--- a/t/t9001-send-email.sh\n+++ b/t/t9001-send-email.sh\n@@ -88,7 +88,7 @@ cat >expected <<\\EOF\n EOF\n test_expect_success \\\n     'Verify commandline' \\\n-    'diff commandline1 expected'\n+    'test_cmp commandline1 expected'\n \n cat >expected-show-all-headers <<\\EOF\n 0001-Second.patch\n-- \n1.6.2\n"},{"id":"108051","messageId":"49BD4C28.4030303@lsrfire.ath.cx","threadId":"18315","inReplyTo":"1237124036-1348-1-git-send-email-vmiklos@frugalware.org","subject":"Re: [PATCH] Tests: use test_cmp instead of diff where possible","fromName":"René Scharfe","fromEmail":"rene.scharfe@lsrfire.ath.cx","sentAt":"2009-03-15T18:42:48Z","receivedAt":"2009-03-15T18:42:48Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"Miklos Vajna schrieb:\n> Several old tests were written before test_cmp was introduced, convert\n> these to test_cmp.\n> \n> Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>\n> ---\n> \n> I intentionally did not touch t5000 - using test_cmp -r works for me,\n> since the default is diff -u, but that would break the setup of users\n> where GIT_TEST_CMP is set to cmp.\n> \n>  t/t0000-basic.sh                    |    8 ++++----\n>  t/t1100-commit-tree-options.sh      |    2 +-\n>  t/t1400-update-ref.sh               |    6 +++---\n>  t/t3000-ls-files-others.sh          |    4 ++--\n>  t/t3010-ls-files-killed-modified.sh |    4 ++--\n>  t/t5000-tar-tree.sh                 |    2 +-\n>  t/t9001-send-email.sh               |    2 +-\n>  7 files changed, 14 insertions(+), 14 deletions(-)\n\nYou _did_ touch t5000, and converted one of the diff calls.  I agree\nthat the ones using the option -r should stay, but the rest could be\nswitched to test_cmp, too.\n\n>\n> diff --git a/t/t0000-basic.sh b/t/t0000-basic.sh\n> index 70df15c..4837300 100755\n> --- a/t/t0000-basic.sh\n> +++ b/t/t0000-basic.sh\n> @@ -127,7 +127,7 @@ cat >expected <<\\EOF\n>  EOF\n>  test_expect_success \\\n>      'validate git ls-files output for a known tree.' \\\n> -    'diff current expected'\n> +    'test_cmp current expected'\n\nWhile you're changing this, you could switch the order of the two files,\nfor consistency.  If expected comes first, the command shows how the\ntest result deviates from the correct output.\n\n>  \n>  test_expect_success \\\n>      'writing tree out with git write-tree.' \\\n> @@ -147,7 +147,7 @@ cat >expected <<\\EOF\n>  EOF\n>  test_expect_success \\\n>      'git ls-tree output for a known tree.' \\\n> -    'diff current expected'\n> +    'test_cmp current expected'\n\nSame here.\n\n>  \n>  # This changed in ls-tree pathspec change -- recursive does\n>  # not show tree nodes anymore.\n> @@ -166,7 +166,7 @@ cat >expected <<\\EOF\n>  EOF\n>  test_expect_success \\\n>      'git ls-tree -r output for a known tree.' \\\n> -    'diff current expected'\n> +    'test_cmp current expected'\n\nSame here.\n\n>  \n>  # But with -r -t we can have both.\n>  test_expect_success \\\n> @@ -187,7 +187,7 @@ cat >expected <<\\EOF\n>  EOF\n>  test_expect_success \\\n>      'git ls-tree -r output for a known tree.' \\\n> -    'diff current expected'\n> +    'test_cmp current expected'\n\nSame here.\n\n>  \n>  test_expect_success \\\n>      'writing partial tree out with git write-tree --prefix.' \\\n> diff --git a/t/t1100-commit-tree-options.sh b/t/t1100-commit-tree-options.sh\n> index 7f7fc36..c4414ff 100755\n> --- a/t/t1100-commit-tree-options.sh\n> +++ b/t/t1100-commit-tree-options.sh\n> @@ -40,6 +40,6 @@ test_expect_success \\\n>  \n>  test_expect_success \\\n>      'compare commit' \\\n> -    'diff expected commit'\n> +    'test_cmp expected commit'\n>  \n>  test_done\n> diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh\n> index bd58926..54ba3df 100755\n> --- a/t/t1400-update-ref.sh\n> +++ b/t/t1400-update-ref.sh\n> @@ -137,7 +137,7 @@ $B $A $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150860 +0000\n>  EOF\n>  test_expect_success \\\n>  \t\"verifying $m's log\" \\\n> -\t\"diff expect .git/logs/$m\"\n> +\t\"test_cmp expect .git/logs/$m\"\n>  rm -rf .git/$m .git/logs expect\n>  \n>  test_expect_success \\\n> @@ -168,7 +168,7 @@ $B $A $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150980 +0000\n>  EOF\n>  test_expect_success \\\n>  \t\"verifying $m's log\" \\\n> -\t'diff expect .git/logs/$m'\n> +\t'test_cmp expect .git/logs/$m'\n>  rm -f .git/$m .git/logs/$m expect\n>  \n>  git update-ref $m $D\n> @@ -272,7 +272,7 @@ $h_FIXED $h_MERGED $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117151100 +0000\tc\n>  EOF\n>  test_expect_success \\\n>  \t'git commit logged updates' \\\n> -\t\"diff expect .git/logs/$m\"\n> +\t\"test_cmp expect .git/logs/$m\"\n>  unset h_TEST h_OTHER h_FIXED h_MERGED\n>  \n>  test_expect_success \\\n> diff --git a/t/t3000-ls-files-others.sh b/t/t3000-ls-files-others.sh\n> index bc0a351..304dd02 100755\n> --- a/t/t3000-ls-files-others.sh\n> +++ b/t/t3000-ls-files-others.sh\n> @@ -42,7 +42,7 @@ test_expect_success \\\n>  \n>  test_expect_success \\\n>      'git ls-files --others should pick up symlinks.' \\\n> -    'diff output expected1'\n> +    'test_cmp output expected1'\n\nSame here.\n\n>  \n>  test_expect_success \\\n>      'git ls-files --others --directory to show output.' \\\n> @@ -51,6 +51,6 @@ test_expect_success \\\n>  \n>  test_expect_success \\\n>      'git ls-files --others --directory should not get confused.' \\\n> -    'diff output expected2'\n> +    'test_cmp output expected2'\n\nSame here.\n\n>  \n>  test_done\n> diff --git a/t/t3010-ls-files-killed-modified.sh b/t/t3010-ls-files-killed-modified.sh\n> index ec14040..4f5375e 100755\n> --- a/t/t3010-ls-files-killed-modified.sh\n> +++ b/t/t3010-ls-files-killed-modified.sh\n> @@ -75,7 +75,7 @@ EOF\n>  \n>  test_expect_success \\\n>      'validate git ls-files -k output.' \\\n> -    'diff .output .expected'\n> +    'test_cmp .output .expected'\n\nSame here.\n\n>  \n>  test_expect_success \\\n>      'git ls-files -m to show modified files.' \\\n> @@ -91,6 +91,6 @@ EOF\n>  \n>  test_expect_success \\\n>      'validate git ls-files -m output.' \\\n> -    'diff .output .expected'\n> +    'test_cmp .output .expected'\n\nAnd here.\n\n>  \n>  test_done\n> diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh\n> index b7e3628..bfd593c 100755\n> --- a/t/t5000-tar-tree.sh\n> +++ b/t/t5000-tar-tree.sh\n> @@ -76,7 +76,7 @@ test_expect_success \\\n>  \n>  test_expect_success \\\n>      'git archive vs. git tar-tree' \\\n> -    'diff b.tar b2.tar'\n> +    'test_cmp b.tar b2.tar'\n>  \n>  test_expect_success \\\n>      'git archive in a bare repo' \\\n> diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh\n> index 08d5b91..4fcc2e1 100755\n> --- a/t/t9001-send-email.sh\n> +++ b/t/t9001-send-email.sh\n> @@ -88,7 +88,7 @@ cat >expected <<\\EOF\n>  EOF\n>  test_expect_success \\\n>      'Verify commandline' \\\n> -    'diff commandline1 expected'\n> +    'test_cmp commandline1 expected'\n\nAnd here, too.\n\n>  \n>  cat >expected-show-all-headers <<\\EOF\n>  0001-Second.patch\n"},{"id":"108132","messageId":"1237234722-19049-1-git-send-email-vmiklos@frugalware.org","threadId":"18315","inReplyTo":"49BD4C28.4030303@lsrfire.ath.cx","subject":"[PATCH] Tests: use test_cmp instead of diff where possible","fromName":"Miklos Vajna","fromEmail":"vmiklos@frugalware.org","sentAt":"2009-03-16T20:18:42Z","receivedAt":"2009-03-16T20:18:42Z","isPatch":true,"sender":{"key":"vmiklos@frugalware.org","avatar":"https://gravatar.com/avatar/401c1cbbb3a5d13e650c691a2c71d6fd0b80df1a01bc74d9f1972675dd58f2bd?d=mp&s=160"},"body":"Several old tests were written before test_cmp was introduced, convert\nthese to test_cmp.\n\nIf were are at it, fix the order of the arguments where necessary to\nmake expected come first, so the command shows how the test result\ndeviates from the correct output.\n\nSigned-off-by: Miklos Vajna <vmiklos@frugalware.org>\n---\n\nOn Sun, Mar 15, 2009 at 07:42:48PM +0100, René Scharfe <rene.scharfe@lsrfire.ath.cx> wrote:\n> >  t/t5000-tar-tree.sh                 |    2 +-\n> >  t/t9001-send-email.sh               |    2 +-\n> >  7 files changed, 14 insertions(+), 14 deletions(-)\n>\n> You _did_ touch t5000, and converted one of the diff calls.  I agree\n> that the ones using the option -r should stay, but the rest could be\n> switched to test_cmp, too.\n\nOK, changed all occurrences, where no options were used.\n\nI also fixed the order problems.\n\n t/t0000-basic.sh                    |    8 ++++----\n t/t1100-commit-tree-options.sh      |    2 +-\n t/t1400-update-ref.sh               |    6 +++---\n t/t3000-ls-files-others.sh          |    4 ++--\n t/t3010-ls-files-killed-modified.sh |    4 ++--\n t/t5000-tar-tree.sh                 |   22 +++++++++++-----------\n t/t9001-send-email.sh               |    2 +-\n 7 files changed, 24 insertions(+), 24 deletions(-)\n\ndiff --git a/t/t0000-basic.sh b/t/t0000-basic.sh\nindex 70df15c..ddcd5b0 100755\n--- a/t/t0000-basic.sh\n+++ b/t/t0000-basic.sh\n@@ -127,7 +127,7 @@ cat >expected <<\\EOF\n EOF\n test_expect_success \\\n     'validate git ls-files output for a known tree.' \\\n-    'diff current expected'\n+    'test_cmp expected current'\n \n test_expect_success \\\n     'writing tree out with git write-tree.' \\\n@@ -147,7 +147,7 @@ cat >expected <<\\EOF\n EOF\n test_expect_success \\\n     'git ls-tree output for a known tree.' \\\n-    'diff current expected'\n+    'test_cmp expected current'\n \n # This changed in ls-tree pathspec change -- recursive does\n # not show tree nodes anymore.\n@@ -166,7 +166,7 @@ cat >expected <<\\EOF\n EOF\n test_expect_success \\\n     'git ls-tree -r output for a known tree.' \\\n-    'diff current expected'\n+    'test_cmp expected current'\n \n # But with -r -t we can have both.\n test_expect_success \\\n@@ -187,7 +187,7 @@ cat >expected <<\\EOF\n EOF\n test_expect_success \\\n     'git ls-tree -r output for a known tree.' \\\n-    'diff current expected'\n+    'test_cmp expected current'\n \n test_expect_success \\\n     'writing partial tree out with git write-tree --prefix.' \\\ndiff --git a/t/t1100-commit-tree-options.sh b/t/t1100-commit-tree-options.sh\nindex 7f7fc36..c4414ff 100755\n--- a/t/t1100-commit-tree-options.sh\n+++ b/t/t1100-commit-tree-options.sh\n@@ -40,6 +40,6 @@ test_expect_success \\\n \n test_expect_success \\\n     'compare commit' \\\n-    'diff expected commit'\n+    'test_cmp expected commit'\n \n test_done\ndiff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh\nindex bd58926..54ba3df 100755\n--- a/t/t1400-update-ref.sh\n+++ b/t/t1400-update-ref.sh\n@@ -137,7 +137,7 @@ $B $A $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150860 +0000\n EOF\n test_expect_success \\\n \t\"verifying $m's log\" \\\n-\t\"diff expect .git/logs/$m\"\n+\t\"test_cmp expect .git/logs/$m\"\n rm -rf .git/$m .git/logs expect\n \n test_expect_success \\\n@@ -168,7 +168,7 @@ $B $A $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150980 +0000\n EOF\n test_expect_success \\\n \t\"verifying $m's log\" \\\n-\t'diff expect .git/logs/$m'\n+\t'test_cmp expect .git/logs/$m'\n rm -f .git/$m .git/logs/$m expect\n \n git update-ref $m $D\n@@ -272,7 +272,7 @@ $h_FIXED $h_MERGED $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117151100 +0000\tc\n EOF\n test_expect_success \\\n \t'git commit logged updates' \\\n-\t\"diff expect .git/logs/$m\"\n+\t\"test_cmp expect .git/logs/$m\"\n unset h_TEST h_OTHER h_FIXED h_MERGED\n \n test_expect_success \\\ndiff --git a/t/t3000-ls-files-others.sh b/t/t3000-ls-files-others.sh\nindex bc0a351..36eee0f 100755\n--- a/t/t3000-ls-files-others.sh\n+++ b/t/t3000-ls-files-others.sh\n@@ -42,7 +42,7 @@ test_expect_success \\\n \n test_expect_success \\\n     'git ls-files --others should pick up symlinks.' \\\n-    'diff output expected1'\n+    'test_cmp expected1 output'\n \n test_expect_success \\\n     'git ls-files --others --directory to show output.' \\\n@@ -51,6 +51,6 @@ test_expect_success \\\n \n test_expect_success \\\n     'git ls-files --others --directory should not get confused.' \\\n-    'diff output expected2'\n+    'test_cmp expected2 output'\n \n test_done\ndiff --git a/t/t3010-ls-files-killed-modified.sh b/t/t3010-ls-files-killed-modified.sh\nindex ec14040..e4f02a0 100755\n--- a/t/t3010-ls-files-killed-modified.sh\n+++ b/t/t3010-ls-files-killed-modified.sh\n@@ -75,7 +75,7 @@ EOF\n \n test_expect_success \\\n     'validate git ls-files -k output.' \\\n-    'diff .output .expected'\n+    'test_cmp .expected .output'\n \n test_expect_success \\\n     'git ls-files -m to show modified files.' \\\n@@ -91,6 +91,6 @@ EOF\n \n test_expect_success \\\n     'validate git ls-files -m output.' \\\n-    'diff .output .expected'\n+    'test_cmp .expected .output'\n \n test_done\ndiff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh\nindex b7e3628..e1ed073 100755\n--- a/t/t5000-tar-tree.sh\n+++ b/t/t5000-tar-tree.sh\n@@ -76,7 +76,7 @@ test_expect_success \\\n \n test_expect_success \\\n     'git archive vs. git tar-tree' \\\n-    'diff b.tar b2.tar'\n+    'test_cmp b.tar b2.tar'\n \n test_expect_success \\\n     'git archive in a bare repo' \\\n@@ -96,12 +96,12 @@ test_expect_success \\\n      \"$TAR\" xf b.tar -C extract a/a &&\n      test-chmtime -v +0 extract/a/a |cut -f 1 >b.mtime &&\n      echo \"1117231200\" >expected.mtime &&\n-     diff expected.mtime b.mtime'\n+     test_cmp expected.mtime b.mtime'\n \n test_expect_success \\\n     'git get-tar-commit-id' \\\n     'git get-tar-commit-id <b.tar >b.commitid &&\n-     diff .git/$(git symbolic-ref HEAD) b.commitid'\n+     test_cmp .git/$(git symbolic-ref HEAD) b.commitid'\n \n test_expect_success \\\n     'extract tar archive' \\\n@@ -110,7 +110,7 @@ test_expect_success \\\n test_expect_success \\\n     'validate filenames' \\\n     '(cd b/a && find .) | sort >b.lst &&\n-     diff a.lst b.lst'\n+     test_cmp a.lst b.lst'\n \n test_expect_success \\\n     'validate file contents' \\\n@@ -127,7 +127,7 @@ test_expect_success \\\n test_expect_success \\\n     'validate filenames with prefix' \\\n     '(cd c/prefix/a && find .) | sort >c.lst &&\n-     diff a.lst c.lst'\n+     test_cmp a.lst c.lst'\n \n test_expect_success \\\n     'validate file contents with prefix' \\\n@@ -148,8 +148,8 @@ test_expect_success \\\n      'validate substfile contents' \\\n      'git log --max-count=1 \"--pretty=format:A${SUBSTFORMAT}O\" HEAD \\\n       >f/a/substfile1.expected &&\n-      diff f/a/substfile1.expected f/a/substfile1 &&\n-      diff a/substfile2 f/a/substfile2\n+      test_cmp f/a/substfile1.expected f/a/substfile1 &&\n+      test_cmp a/substfile2 f/a/substfile2\n '\n \n test_expect_success \\\n@@ -160,8 +160,8 @@ test_expect_success \\\n      'validate substfile contents from archive with prefix' \\\n      'git log --max-count=1 \"--pretty=format:A${SUBSTFORMAT}O\" HEAD \\\n       >g/prefix/a/substfile1.expected &&\n-      diff g/prefix/a/substfile1.expected g/prefix/a/substfile1 &&\n-      diff a/substfile2 g/prefix/a/substfile2\n+      test_cmp g/prefix/a/substfile1.expected g/prefix/a/substfile1 &&\n+      test_cmp a/substfile2 g/prefix/a/substfile2\n '\n \n test_expect_success \\\n@@ -194,7 +194,7 @@ test_expect_success \\\n test_expect_success \\\n     'validate filenames' \\\n     '(cd d/a && find .) | sort >d.lst &&\n-     diff a.lst d.lst'\n+     test_cmp a.lst d.lst'\n \n test_expect_success \\\n     'validate file contents' \\\n@@ -211,7 +211,7 @@ test_expect_success \\\n test_expect_success \\\n     'validate filenames with prefix' \\\n     '(cd e/prefix/a && find .) | sort >e.lst &&\n-     diff a.lst e.lst'\n+     test_cmp a.lst e.lst'\n \n test_expect_success \\\n     'validate file contents with prefix' \\\ndiff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh\nindex 08d5b91..9523305 100755\n--- a/t/t9001-send-email.sh\n+++ b/t/t9001-send-email.sh\n@@ -88,7 +88,7 @@ cat >expected <<\\EOF\n EOF\n test_expect_success \\\n     'Verify commandline' \\\n-    'diff commandline1 expected'\n+    'test_cmp expected commandline1'\n \n cat >expected-show-all-headers <<\\EOF\n 0001-Second.patch\n-- \n1.6.2\n"},{"id":"108194","messageId":"20090317082845.GH18475@coredump.intra.peff.net","threadId":"18315","inReplyTo":"1237124036-1348-1-git-send-email-vmiklos@frugalware.org","subject":"Re: [PATCH] Tests: use test_cmp instead of diff where possible","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-03-17T08:28:45Z","receivedAt":"2009-03-17T08:28:45Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sun, Mar 15, 2009 at 02:33:56PM +0100, Miklos Vajna wrote:\n\n> I intentionally did not touch t5000 - using test_cmp -r works for me,\n> since the default is diff -u, but that would break the setup of users\n> where GIT_TEST_CMP is set to cmp.\n\nDefinitely \"test_cmp -r\" is a bad idea since we don't know what\nunderlies it. But I wonder how portable \"diff -r\" is. Wasn't it a point\nof contention in the recent cvsimport tests that were added (and Michael\nended up writing a mini recursive differ using some shell commands)?\n\nOTOH, I haven't seen any complaints about it, so perhaps it is fine to\nleave it.\n\n-Peff\n"},{"id":"108223","messageId":"1b46aba20903170602j79735631uf20e0a729e69c4b@mail.gmail.com","threadId":"18315","inReplyTo":"1237124036-1348-1-git-send-email-vmiklos@frugalware.org","subject":"Re: [PATCH] Tests: use test_cmp instead of diff where possible","fromName":"Carlos Rica","fromEmail":"jasampler@gmail.com","sentAt":"2009-03-17T13:02:37Z","receivedAt":"2009-03-17T13:02:37Z","isPatch":true,"sender":{"key":"jasampler@gmail.com","avatar":null},"body":"On Sun, Mar 15, 2009 at 2:33 PM, Miklos Vajna <vmiklos@frugalware.org> wrote:\n> Several old tests were written before test_cmp was introduced, convert\n> these to test_cmp.\n\nWhat about the current other calls to cmp? I don't know if they should\nbe changed too. Are they just the subject of another future change or\nhave a different purpose? I recently used test_cmp in a test full of\ncmp calls (t1300-repo-config.sh).\n"},{"id":"108224","messageId":"20090317132150.GW3817@genesis.frugalware.org","threadId":"18315","inReplyTo":"1b46aba20903170602j79735631uf20e0a729e69c4b@mail.gmail.com","subject":"Re: [PATCH] Tests: use test_cmp instead of diff where possible","fromName":"Miklos Vajna","fromEmail":"vmiklos@frugalware.org","sentAt":"2009-03-17T13:21:50Z","receivedAt":"2009-03-17T13:21:50Z","isPatch":true,"sender":{"key":"vmiklos@frugalware.org","avatar":"https://gravatar.com/avatar/401c1cbbb3a5d13e650c691a2c71d6fd0b80df1a01bc74d9f1972675dd58f2bd?d=mp&s=160"},"body":"On Tue, Mar 17, 2009 at 02:02:37PM +0100, Carlos Rica <jasampler@gmail.com> wrote:\n> What about the current other calls to cmp? I don't know if they should\n> be changed too. Are they just the subject of another future change or\n> have a different purpose? I recently used test_cmp in a test full of\n> cmp calls (t1300-repo-config.sh).\n\nI think that would be the next step, my patch only converts diff calls\nto test_cmp.\n"}]}