git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 7/8] convert users of "cmp -s" to "git diff"

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Feb 25, 2007, 22:37 UTC
Message-ID
<Pine.LNX.4.63.0702252337010.22628@wbgn013.biozentrum.uni-wuerzburg.de>
This is really just
$ perl -pi.bak -e "s/(^\s*|'|&&\s*)cmp -s /\1git diff /" *.sh
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
	We should probably add a "--quiet" flag for the diff family
	first, and use that...
 t/t0000-basic.sh      |    4 ++--
 t/t4002-diff-basic.sh |   26 +++++++++++++-------------
 2 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/t/t0000-basic.sh b/t/t0000-basic.sh
index 186de70..743ee03 100755
--- a/t/t0000-basic.sh
+++ b/t/t0000-basic.sh
@@ -37,7 +37,7 @@ fi
 find .git/objects -type f -print >should-be-empty
 test_expect_success \
     '.git/objects should be empty after git-init in an empty repo.' \
-    'cmp -s /dev/null should-be-empty' 
+    'git diff /dev/null should-be-empty' 
 
 # also it should have 2 subdirectories; no fan-out anymore, pack, and info.
 # 3 is counting "objects" itself
@@ -242,7 +242,7 @@ test_expect_success \
 
 test_expect_success \
     'no diff after checkout and git-update-index --refresh.' \
-    'git-diff-files >current && cmp -s current /dev/null'
+    'git-diff-files >current && git diff current /dev/null'
 
 ################################################################
 P=087704a96baf1c2d1c869a8b084481e121c88b5b
diff --git a/t/t4002-diff-basic.sh b/t/t4002-diff-basic.sh
index 56eda63..50e9922 100755
--- a/t/t4002-diff-basic.sh
+++ b/t/t4002-diff-basic.sh
@@ -141,50 +141,50 @@ cmp_diff_files_output () {
 test_expect_success \
     'diff-tree of known trees.' \
     'git-diff-tree $tree_O $tree_A >.test-a &&
-     cmp -s .test-a .test-plain-OA'
+     git diff .test-a .test-plain-OA'
 
 test_expect_success \
     'diff-tree of known trees.' \
     'git-diff-tree -r $tree_O $tree_A >.test-a &&
-     cmp -s .test-a .test-recursive-OA'
+     git diff .test-a .test-recursive-OA'
 
 test_expect_success \
     'diff-tree of known trees.' \
     'git-diff-tree $tree_O $tree_B >.test-a &&
-     cmp -s .test-a .test-plain-OB'
+     git diff .test-a .test-plain-OB'
 
 test_expect_success \
     'diff-tree of known trees.' \
     'git-diff-tree -r $tree_O $tree_B >.test-a &&
-     cmp -s .test-a .test-recursive-OB'
+     git diff .test-a .test-recursive-OB'
 
 test_expect_success \
     'diff-tree of known trees.' \
     'git-diff-tree $tree_A $tree_B >.test-a &&
-     cmp -s .test-a .test-plain-AB'
+     git diff .test-a .test-plain-AB'
 
 test_expect_success \
     'diff-tree of known trees.' \
     'git-diff-tree -r $tree_A $tree_B >.test-a &&
-     cmp -s .test-a .test-recursive-AB'
+     git diff .test-a .test-recursive-AB'
 
 test_expect_success \
     'diff-cache O with A in cache' \
     'git-read-tree $tree_A &&
      git-diff-index --cached $tree_O >.test-a &&
-     cmp -s .test-a .test-recursive-OA'
+     git diff .test-a .test-recursive-OA'
 
 test_expect_success \
     'diff-cache O with B in cache' \
     'git-read-tree $tree_B &&
      git-diff-index --cached $tree_O >.test-a &&
-     cmp -s .test-a .test-recursive-OB'
+     git diff .test-a .test-recursive-OB'
 
 test_expect_success \
     'diff-cache A with B in cache' \
     'git-read-tree $tree_B &&
      git-diff-index --cached $tree_A >.test-a &&
-     cmp -s .test-a .test-recursive-AB'
+     git diff .test-a .test-recursive-AB'
 
 test_expect_success \
     'diff-files with O in cache and A checked out' \
@@ -224,24 +224,24 @@ test_expect_success \
     'diff-tree O A == diff-tree -R A O' \
     'git-diff-tree $tree_O $tree_A >.test-a &&
     git-diff-tree -R $tree_A $tree_O >.test-b &&
-    cmp -s .test-a .test-b'
+    git diff .test-a .test-b'
 
 test_expect_success \
     'diff-tree -r O A == diff-tree -r -R A O' \
     'git-diff-tree -r $tree_O $tree_A >.test-a &&
     git-diff-tree -r -R $tree_A $tree_O >.test-b &&
-    cmp -s .test-a .test-b'
+    git diff .test-a .test-b'
 
 test_expect_success \
     'diff-tree B A == diff-tree -R A B' \
     'git-diff-tree $tree_B $tree_A >.test-a &&
     git-diff-tree -R $tree_A $tree_B >.test-b &&
-    cmp -s .test-a .test-b'
+    git diff .test-a .test-b'
 
 test_expect_success \
     'diff-tree -r B A == diff-tree -r -R A B' \
     'git-diff-tree -r $tree_B $tree_A >.test-a &&
     git-diff-tree -r -R $tree_A $tree_B >.test-b &&
-    cmp -s .test-a .test-b'
+    git diff .test-a .test-b'
 
 test_done
-- 
1.5.0.1.788.g8ca52
Message 1 of 1 in “convert users of "cmp -s" to "git diff"”
  1. 7/8 convert users of "cmp -s" to "git diff"Johannes Schindelin, Feb 25, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.