threads / patch / 18315

patchTests: use test_cmp instead of diff where possible

Subject: [PATCH] Tests: use test_cmp instead of diff where possible

## tl;dr

6 messages between Mar 15, 2009 and Mar 17, 2009. Diffs are folded; open one to read it.

replies: 5people: 4as markdown or json

Miklos Vajna· Mar 15, 2009, 13:33 UTC · lore

Several old tests were written before test_cmp was introduced, convert these to test_cmp.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---

I intentionally did not touch t5000 - using test_cmp -r works for me, since the default is diff -u, but that would break the setup of users where GIT_TEST_CMP is set to cmp.

 t/t0000-basic.sh                    |    8 ++++----
 t/t1100-commit-tree-options.sh      |    2 +-
 t/t1400-update-ref.sh               |    6 +++---
 t/t3000-ls-files-others.sh          |    4 ++--
 t/t3010-ls-files-killed-modified.sh |    4 ++--
 t/t5000-tar-tree.sh                 |    2 +-
 t/t9001-send-email.sh               |    2 +-
 7 files changed, 14 insertions(+), 14 deletions(-)
Show changes to 7 files +14 −14

t/t0000-basic.sh, t/t1100-commit-tree-options.sh, t/t1400-update-ref.sh, t/t3000-ls-files-others.sh, t/t3010-ls-files-killed-modified.sh, t/t5000-tar-tree.sh, t/t9001-send-email.sh

diff --git a/t/t0000-basic.sh b/t/t0000-basic.sh
index 70df15c..4837300 100755
--- a/t/t0000-basic.sh
+++ b/t/t0000-basic.sh
@@ -127,7 +127,7 @@ cat >expected <<\EOF
 EOF
 test_expect_success \
     'validate git ls-files output for a known tree.' \
-    'diff current expected'
+    'test_cmp current expected'
 
 test_expect_success \
     'writing tree out with git write-tree.' \
@@ -147,7 +147,7 @@ cat >expected <<\EOF
 EOF
 test_expect_success \
     'git ls-tree output for a known tree.' \
-    'diff current expected'
+    'test_cmp current expected'
 
 # This changed in ls-tree pathspec change -- recursive does
 # not show tree nodes anymore.
@@ -166,7 +166,7 @@ cat >expected <<\EOF
 EOF
 test_expect_success \
     'git ls-tree -r output for a known tree.' \
-    'diff current expected'
+    'test_cmp current expected'
 
 # But with -r -t we can have both.
 test_expect_success \
@@ -187,7 +187,7 @@ cat >expected <<\EOF
 EOF
 test_expect_success \
     'git ls-tree -r output for a known tree.' \
-    'diff current expected'
+    'test_cmp current expected'
 
 test_expect_success \
     'writing partial tree out with git write-tree --prefix.' \
diff --git a/t/t1100-commit-tree-options.sh b/t/t1100-commit-tree-options.sh
index 7f7fc36..c4414ff 100755
--- a/t/t1100-commit-tree-options.sh
+++ b/t/t1100-commit-tree-options.sh
@@ -40,6 +40,6 @@ test_expect_success \
 
 test_expect_success \
     'compare commit' \
-    'diff expected commit'
+    'test_cmp expected commit'
 
 test_done
diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh
index bd58926..54ba3df 100755
--- a/t/t1400-update-ref.sh
+++ b/t/t1400-update-ref.sh
@@ -137,7 +137,7 @@ $B $A $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150860 +0000
 EOF
 test_expect_success \
 	"verifying $m's log" \
-	"diff expect .git/logs/$m"
+	"test_cmp expect .git/logs/$m"
 rm -rf .git/$m .git/logs expect
 
 test_expect_success \
@@ -168,7 +168,7 @@ $B $A $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150980 +0000
 EOF
 test_expect_success \
 	"verifying $m's log" \
-	'diff expect .git/logs/$m'
+	'test_cmp expect .git/logs/$m'
 rm -f .git/$m .git/logs/$m expect
 
 git update-ref $m $D
@@ -272,7 +272,7 @@ $h_FIXED $h_MERGED $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117151100 +0000	c
 EOF
 test_expect_success \
 	'git commit logged updates' \
-	"diff expect .git/logs/$m"
+	"test_cmp expect .git/logs/$m"
 unset h_TEST h_OTHER h_FIXED h_MERGED
 
 test_expect_success \
diff --git a/t/t3000-ls-files-others.sh b/t/t3000-ls-files-others.sh
index bc0a351..304dd02 100755
--- a/t/t3000-ls-files-others.sh
+++ b/t/t3000-ls-files-others.sh
@@ -42,7 +42,7 @@ test_expect_success \
 
 test_expect_success \
     'git ls-files --others should pick up symlinks.' \
-    'diff output expected1'
+    'test_cmp output expected1'
 
 test_expect_success \
     'git ls-files --others --directory to show output.' \
@@ -51,6 +51,6 @@ test_expect_success \
 
 test_expect_success \
     'git ls-files --others --directory should not get confused.' \
-    'diff output expected2'
+    'test_cmp output expected2'
 
 test_done
diff --git a/t/t3010-ls-files-killed-modified.sh b/t/t3010-ls-files-killed-modified.sh
index ec14040..4f5375e 100755
--- a/t/t3010-ls-files-killed-modified.sh
+++ b/t/t3010-ls-files-killed-modified.sh
@@ -75,7 +75,7 @@ EOF
 
 test_expect_success \
     'validate git ls-files -k output.' \
-    'diff .output .expected'
+    'test_cmp .output .expected'
 
 test_expect_success \
     'git ls-files -m to show modified files.' \
@@ -91,6 +91,6 @@ EOF
 
 test_expect_success \
     'validate git ls-files -m output.' \
-    'diff .output .expected'
+    'test_cmp .output .expected'
 
 test_done
diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh
index b7e3628..bfd593c 100755
--- a/t/t5000-tar-tree.sh
+++ b/t/t5000-tar-tree.sh
@@ -76,7 +76,7 @@ test_expect_success \
 
 test_expect_success \
     'git archive vs. git tar-tree' \
-    'diff b.tar b2.tar'
+    'test_cmp b.tar b2.tar'
 
 test_expect_success \
     'git archive in a bare repo' \
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 08d5b91..4fcc2e1 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -88,7 +88,7 @@ cat >expected <<\EOF
 EOF
 test_expect_success \
     'Verify commandline' \
-    'diff commandline1 expected'
+    'test_cmp commandline1 expected'
 
 cat >expected-show-all-headers <<\EOF
 0001-Second.patch
-- 
1.6.2
René Scharfe· Mar 15, 2009, 18:42 UTC · re: Miklos Vajna · lore

Re: [PATCH] Tests: use test_cmp instead of diff where possible

Miklos Vajna schrieb:
Show 18 quoted lines
> Several old tests were written before test_cmp was introduced, convert
> these to test_cmp.
> 
> Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
> ---
> 
> I intentionally did not touch t5000 - using test_cmp -r works for me,
> since the default is diff -u, but that would break the setup of users
> where GIT_TEST_CMP is set to cmp.
> 
>  t/t0000-basic.sh                    |    8 ++++----
>  t/t1100-commit-tree-options.sh      |    2 +-
>  t/t1400-update-ref.sh               |    6 +++---
>  t/t3000-ls-files-others.sh          |    4 ++--
>  t/t3010-ls-files-killed-modified.sh |    4 ++--
>  t/t5000-tar-tree.sh                 |    2 +-
>  t/t9001-send-email.sh               |    2 +-
>  7 files changed, 14 insertions(+), 14 deletions(-)

You _did_ touch t5000, and converted one of the diff calls. I agree that the ones using the option -r should stay, but the rest could be switched to test_cmp, too.

Show 11 quoted lines
>
> diff --git a/t/t0000-basic.sh b/t/t0000-basic.sh
> index 70df15c..4837300 100755
> --- a/t/t0000-basic.sh
> +++ b/t/t0000-basic.sh
> @@ -127,7 +127,7 @@ cat >expected <<\EOF
>  EOF
>  test_expect_success \
>      'validate git ls-files output for a known tree.' \
> -    'diff current expected'
> +    'test_cmp current expected'

While you're changing this, you could switch the order of the two files, for consistency. If expected comes first, the command shows how the test result deviates from the correct output.

Show 9 quoted lines
>  
>  test_expect_success \
>      'writing tree out with git write-tree.' \
> @@ -147,7 +147,7 @@ cat >expected <<\EOF
>  EOF
>  test_expect_success \
>      'git ls-tree output for a known tree.' \
> -    'diff current expected'
> +    'test_cmp current expected'
Same here.
Show 9 quoted lines
>  
>  # This changed in ls-tree pathspec change -- recursive does
>  # not show tree nodes anymore.
> @@ -166,7 +166,7 @@ cat >expected <<\EOF
>  EOF
>  test_expect_success \
>      'git ls-tree -r output for a known tree.' \
> -    'diff current expected'
> +    'test_cmp current expected'
Same here.
Show 9 quoted lines
>  
>  # But with -r -t we can have both.
>  test_expect_success \
> @@ -187,7 +187,7 @@ cat >expected <<\EOF
>  EOF
>  test_expect_success \
>      'git ls-tree -r output for a known tree.' \
> -    'diff current expected'
> +    'test_cmp current expected'
Same here.
Show 56 quoted lines
>  
>  test_expect_success \
>      'writing partial tree out with git write-tree --prefix.' \
> diff --git a/t/t1100-commit-tree-options.sh b/t/t1100-commit-tree-options.sh
> index 7f7fc36..c4414ff 100755
> --- a/t/t1100-commit-tree-options.sh
> +++ b/t/t1100-commit-tree-options.sh
> @@ -40,6 +40,6 @@ test_expect_success \
>  
>  test_expect_success \
>      'compare commit' \
> -    'diff expected commit'
> +    'test_cmp expected commit'
>  
>  test_done
> diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh
> index bd58926..54ba3df 100755
> --- a/t/t1400-update-ref.sh
> +++ b/t/t1400-update-ref.sh
> @@ -137,7 +137,7 @@ $B $A $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150860 +0000
>  EOF
>  test_expect_success \
>  	"verifying $m's log" \
> -	"diff expect .git/logs/$m"
> +	"test_cmp expect .git/logs/$m"
>  rm -rf .git/$m .git/logs expect
>  
>  test_expect_success \
> @@ -168,7 +168,7 @@ $B $A $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150980 +0000
>  EOF
>  test_expect_success \
>  	"verifying $m's log" \
> -	'diff expect .git/logs/$m'
> +	'test_cmp expect .git/logs/$m'
>  rm -f .git/$m .git/logs/$m expect
>  
>  git update-ref $m $D
> @@ -272,7 +272,7 @@ $h_FIXED $h_MERGED $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117151100 +0000	c
>  EOF
>  test_expect_success \
>  	'git commit logged updates' \
> -	"diff expect .git/logs/$m"
> +	"test_cmp expect .git/logs/$m"
>  unset h_TEST h_OTHER h_FIXED h_MERGED
>  
>  test_expect_success \
> diff --git a/t/t3000-ls-files-others.sh b/t/t3000-ls-files-others.sh
> index bc0a351..304dd02 100755
> --- a/t/t3000-ls-files-others.sh
> +++ b/t/t3000-ls-files-others.sh
> @@ -42,7 +42,7 @@ test_expect_success \
>  
>  test_expect_success \
>      'git ls-files --others should pick up symlinks.' \
> -    'diff output expected1'
> +    'test_cmp output expected1'
Same here.
Show 9 quoted lines
>  
>  test_expect_success \
>      'git ls-files --others --directory to show output.' \
> @@ -51,6 +51,6 @@ test_expect_success \
>  
>  test_expect_success \
>      'git ls-files --others --directory should not get confused.' \
> -    'diff output expected2'
> +    'test_cmp output expected2'
Same here.
Show 12 quoted lines
>  
>  test_done
> diff --git a/t/t3010-ls-files-killed-modified.sh b/t/t3010-ls-files-killed-modified.sh
> index ec14040..4f5375e 100755
> --- a/t/t3010-ls-files-killed-modified.sh
> +++ b/t/t3010-ls-files-killed-modified.sh
> @@ -75,7 +75,7 @@ EOF
>  
>  test_expect_success \
>      'validate git ls-files -k output.' \
> -    'diff .output .expected'
> +    'test_cmp .output .expected'
Same here.
Show 9 quoted lines
>  
>  test_expect_success \
>      'git ls-files -m to show modified files.' \
> @@ -91,6 +91,6 @@ EOF
>  
>  test_expect_success \
>      'validate git ls-files -m output.' \
> -    'diff .output .expected'
> +    'test_cmp .output .expected'
And here.
Show 25 quoted lines
>  
>  test_done
> diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh
> index b7e3628..bfd593c 100755
> --- a/t/t5000-tar-tree.sh
> +++ b/t/t5000-tar-tree.sh
> @@ -76,7 +76,7 @@ test_expect_success \
>  
>  test_expect_success \
>      'git archive vs. git tar-tree' \
> -    'diff b.tar b2.tar'
> +    'test_cmp b.tar b2.tar'
>  
>  test_expect_success \
>      'git archive in a bare repo' \
> diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
> index 08d5b91..4fcc2e1 100755
> --- a/t/t9001-send-email.sh
> +++ b/t/t9001-send-email.sh
> @@ -88,7 +88,7 @@ cat >expected <<\EOF
>  EOF
>  test_expect_success \
>      'Verify commandline' \
> -    'diff commandline1 expected'
> +    'test_cmp commandline1 expected'
And here, too.
>  
>  cat >expected-show-all-headers <<\EOF
>  0001-Second.patch
Miklos Vajna· Mar 16, 2009, 20:18 UTC · re: René Scharfe · lore

Several old tests were written before test_cmp was introduced, convert these to test_cmp.

If were are at it, fix the order of the arguments where necessary to make expected come first, so the command shows how the test result deviates from the correct output.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---
On Sun, Mar 15, 2009 at 07:42:48PM +0100, René Scharfe <rene.scharfe@lsrfire.ath.cx> wrote:
Show 7 quoted lines
> >  t/t5000-tar-tree.sh                 |    2 +-
> >  t/t9001-send-email.sh               |    2 +-
> >  7 files changed, 14 insertions(+), 14 deletions(-)
>
> You _did_ touch t5000, and converted one of the diff calls.  I agree
> that the ones using the option -r should stay, but the rest could be
> switched to test_cmp, too.
OK, changed all occurrences, where no options were used.
I also fixed the order problems.
 t/t0000-basic.sh                    |    8 ++++----
 t/t1100-commit-tree-options.sh      |    2 +-
 t/t1400-update-ref.sh               |    6 +++---
 t/t3000-ls-files-others.sh          |    4 ++--
 t/t3010-ls-files-killed-modified.sh |    4 ++--
 t/t5000-tar-tree.sh                 |   22 +++++++++++-----------
 t/t9001-send-email.sh               |    2 +-
 7 files changed, 24 insertions(+), 24 deletions(-)
Show changes to 7 files +24 −24

t/t0000-basic.sh, t/t1100-commit-tree-options.sh, t/t1400-update-ref.sh, t/t3000-ls-files-others.sh, t/t3010-ls-files-killed-modified.sh, t/t5000-tar-tree.sh, t/t9001-send-email.sh

diff --git a/t/t0000-basic.sh b/t/t0000-basic.sh
index 70df15c..ddcd5b0 100755
--- a/t/t0000-basic.sh
+++ b/t/t0000-basic.sh
@@ -127,7 +127,7 @@ cat >expected <<\EOF
 EOF
 test_expect_success \
     'validate git ls-files output for a known tree.' \
-    'diff current expected'
+    'test_cmp expected current'
 
 test_expect_success \
     'writing tree out with git write-tree.' \
@@ -147,7 +147,7 @@ cat >expected <<\EOF
 EOF
 test_expect_success \
     'git ls-tree output for a known tree.' \
-    'diff current expected'
+    'test_cmp expected current'
 
 # This changed in ls-tree pathspec change -- recursive does
 # not show tree nodes anymore.
@@ -166,7 +166,7 @@ cat >expected <<\EOF
 EOF
 test_expect_success \
     'git ls-tree -r output for a known tree.' \
-    'diff current expected'
+    'test_cmp expected current'
 
 # But with -r -t we can have both.
 test_expect_success \
@@ -187,7 +187,7 @@ cat >expected <<\EOF
 EOF
 test_expect_success \
     'git ls-tree -r output for a known tree.' \
-    'diff current expected'
+    'test_cmp expected current'
 
 test_expect_success \
     'writing partial tree out with git write-tree --prefix.' \
diff --git a/t/t1100-commit-tree-options.sh b/t/t1100-commit-tree-options.sh
index 7f7fc36..c4414ff 100755
--- a/t/t1100-commit-tree-options.sh
+++ b/t/t1100-commit-tree-options.sh
@@ -40,6 +40,6 @@ test_expect_success \
 
 test_expect_success \
     'compare commit' \
-    'diff expected commit'
+    'test_cmp expected commit'
 
 test_done
diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh
index bd58926..54ba3df 100755
--- a/t/t1400-update-ref.sh
+++ b/t/t1400-update-ref.sh
@@ -137,7 +137,7 @@ $B $A $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150860 +0000
 EOF
 test_expect_success \
 	"verifying $m's log" \
-	"diff expect .git/logs/$m"
+	"test_cmp expect .git/logs/$m"
 rm -rf .git/$m .git/logs expect
 
 test_expect_success \
@@ -168,7 +168,7 @@ $B $A $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150980 +0000
 EOF
 test_expect_success \
 	"verifying $m's log" \
-	'diff expect .git/logs/$m'
+	'test_cmp expect .git/logs/$m'
 rm -f .git/$m .git/logs/$m expect
 
 git update-ref $m $D
@@ -272,7 +272,7 @@ $h_FIXED $h_MERGED $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117151100 +0000	c
 EOF
 test_expect_success \
 	'git commit logged updates' \
-	"diff expect .git/logs/$m"
+	"test_cmp expect .git/logs/$m"
 unset h_TEST h_OTHER h_FIXED h_MERGED
 
 test_expect_success \
diff --git a/t/t3000-ls-files-others.sh b/t/t3000-ls-files-others.sh
index bc0a351..36eee0f 100755
--- a/t/t3000-ls-files-others.sh
+++ b/t/t3000-ls-files-others.sh
@@ -42,7 +42,7 @@ test_expect_success \
 
 test_expect_success \
     'git ls-files --others should pick up symlinks.' \
-    'diff output expected1'
+    'test_cmp expected1 output'
 
 test_expect_success \
     'git ls-files --others --directory to show output.' \
@@ -51,6 +51,6 @@ test_expect_success \
 
 test_expect_success \
     'git ls-files --others --directory should not get confused.' \
-    'diff output expected2'
+    'test_cmp expected2 output'
 
 test_done
diff --git a/t/t3010-ls-files-killed-modified.sh b/t/t3010-ls-files-killed-modified.sh
index ec14040..e4f02a0 100755
--- a/t/t3010-ls-files-killed-modified.sh
+++ b/t/t3010-ls-files-killed-modified.sh
@@ -75,7 +75,7 @@ EOF
 
 test_expect_success \
     'validate git ls-files -k output.' \
-    'diff .output .expected'
+    'test_cmp .expected .output'
 
 test_expect_success \
     'git ls-files -m to show modified files.' \
@@ -91,6 +91,6 @@ EOF
 
 test_expect_success \
     'validate git ls-files -m output.' \
-    'diff .output .expected'
+    'test_cmp .expected .output'
 
 test_done
diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh
index b7e3628..e1ed073 100755
--- a/t/t5000-tar-tree.sh
+++ b/t/t5000-tar-tree.sh
@@ -76,7 +76,7 @@ test_expect_success \
 
 test_expect_success \
     'git archive vs. git tar-tree' \
-    'diff b.tar b2.tar'
+    'test_cmp b.tar b2.tar'
 
 test_expect_success \
     'git archive in a bare repo' \
@@ -96,12 +96,12 @@ test_expect_success \
      "$TAR" xf b.tar -C extract a/a &&
      test-chmtime -v +0 extract/a/a |cut -f 1 >b.mtime &&
      echo "1117231200" >expected.mtime &&
-     diff expected.mtime b.mtime'
+     test_cmp expected.mtime b.mtime'
 
 test_expect_success \
     'git get-tar-commit-id' \
     'git get-tar-commit-id <b.tar >b.commitid &&
-     diff .git/$(git symbolic-ref HEAD) b.commitid'
+     test_cmp .git/$(git symbolic-ref HEAD) b.commitid'
 
 test_expect_success \
     'extract tar archive' \
@@ -110,7 +110,7 @@ test_expect_success \
 test_expect_success \
     'validate filenames' \
     '(cd b/a && find .) | sort >b.lst &&
-     diff a.lst b.lst'
+     test_cmp a.lst b.lst'
 
 test_expect_success \
     'validate file contents' \
@@ -127,7 +127,7 @@ test_expect_success \
 test_expect_success \
     'validate filenames with prefix' \
     '(cd c/prefix/a && find .) | sort >c.lst &&
-     diff a.lst c.lst'
+     test_cmp a.lst c.lst'
 
 test_expect_success \
     'validate file contents with prefix' \
@@ -148,8 +148,8 @@ test_expect_success \
      'validate substfile contents' \
      'git log --max-count=1 "--pretty=format:A${SUBSTFORMAT}O" HEAD \
       >f/a/substfile1.expected &&
-      diff f/a/substfile1.expected f/a/substfile1 &&
-      diff a/substfile2 f/a/substfile2
+      test_cmp f/a/substfile1.expected f/a/substfile1 &&
+      test_cmp a/substfile2 f/a/substfile2
 '
 
 test_expect_success \
@@ -160,8 +160,8 @@ test_expect_success \
      'validate substfile contents from archive with prefix' \
      'git log --max-count=1 "--pretty=format:A${SUBSTFORMAT}O" HEAD \
       >g/prefix/a/substfile1.expected &&
-      diff g/prefix/a/substfile1.expected g/prefix/a/substfile1 &&
-      diff a/substfile2 g/prefix/a/substfile2
+      test_cmp g/prefix/a/substfile1.expected g/prefix/a/substfile1 &&
+      test_cmp a/substfile2 g/prefix/a/substfile2
 '
 
 test_expect_success \
@@ -194,7 +194,7 @@ test_expect_success \
 test_expect_success \
     'validate filenames' \
     '(cd d/a && find .) | sort >d.lst &&
-     diff a.lst d.lst'
+     test_cmp a.lst d.lst'
 
 test_expect_success \
     'validate file contents' \
@@ -211,7 +211,7 @@ test_expect_success \
 test_expect_success \
     'validate filenames with prefix' \
     '(cd e/prefix/a && find .) | sort >e.lst &&
-     diff a.lst e.lst'
+     test_cmp a.lst e.lst'
 
 test_expect_success \
     'validate file contents with prefix' \
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 08d5b91..9523305 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -88,7 +88,7 @@ cat >expected <<\EOF
 EOF
 test_expect_success \
     'Verify commandline' \
-    'diff commandline1 expected'
+    'test_cmp expected commandline1'
 
 cat >expected-show-all-headers <<\EOF
 0001-Second.patch
-- 
1.6.2
Jeff King· Mar 17, 2009, 08:28 UTC · re: Miklos Vajna · lore

Re: [PATCH] Tests: use test_cmp instead of diff where possible

On Sun, Mar 15, 2009 at 02:33:56PM +0100, Miklos Vajna wrote:
> I intentionally did not touch t5000 - using test_cmp -r works for me,
> since the default is diff -u, but that would break the setup of users
> where GIT_TEST_CMP is set to cmp.

Definitely "test_cmp -r" is a bad idea since we don't know what underlies it. But I wonder how portable "diff -r" is. Wasn't it a point of contention in the recent cvsimport tests that were added (and Michael ended up writing a mini recursive differ using some shell commands)?

OTOH, I haven't seen any complaints about it, so perhaps it is fine to leave it.

-Peff
Carlos Rica· Mar 17, 2009, 13:02 UTC · re: Miklos Vajna · lore

Re: [PATCH] Tests: use test_cmp instead of diff where possible

On Sun, Mar 15, 2009 at 2:33 PM, Miklos Vajna <vmiklos@frugalware.org> wrote:
> Several old tests were written before test_cmp was introduced, convert
> these to test_cmp.

What about the current other calls to cmp? I don't know if they should be changed too. Are they just the subject of another future change or have a different purpose? I recently used test_cmp in a test full of cmp calls (t1300-repo-config.sh).

Miklos Vajna· Mar 17, 2009, 13:21 UTC · re: Carlos Rica · lore

Re: [PATCH] Tests: use test_cmp instead of diff where possible

On Tue, Mar 17, 2009 at 02:02:37PM +0100, Carlos Rica <jasampler@gmail.com> wrote:
> What about the current other calls to cmp? I don't know if they should
> be changed too. Are they just the subject of another future change or
> have a different purpose? I recently used test_cmp in a test full of
> cmp calls (t1300-repo-config.sh).

I think that would be the next step, my patch only converts diff calls to test_cmp.

← back to recent threads