Index: src/ChangeLog =================================================================== RCS file: /home2/cvsroot/ccvs/src/ChangeLog,v retrieving revision 1.1997 diff -u -r1.1997 ChangeLog --- src/ChangeLog 2000/11/29 21:18:46 1.1997 +++ src/ChangeLog 2000/12/01 14:48:15 @@ -1,3 +1,10 @@ +2000-12-01 Donald Sharp + + * diff.c: Changed error code returning such that when doing + a diff on files that are same or different causes cvs to exit + with a exit code of '0'. Any type of diff failure will cause cvs + to exit with a '1'. + 2000-11-29 Derek Price * root.c (parse_cvsroot): back out yesterday's redundant changes Index: src/diff.c =================================================================== RCS file: /home2/cvsroot/ccvs/src/diff.c,v retrieving revision 1.83 diff -u -r1.83 diff.c --- src/diff.c 1999/04/15 00:12:26 1.83 +++ src/diff.c 2000/12/01 14:48:15 @@ -404,7 +404,21 @@ if (diff_date2 != NULL) free (diff_date2); - return (err); + /* err is actually one of three things here at this point + * 0 - no differences + * 1 - differences in file + * 2 - some sort of recoverable error occurred. + * unfortunately main takes the 1 and 2 return codes and makes them + * program failures. Which is not what is really intended. It's better to + * convert the 0 and 1 into program success and make '2' program failure. + * The ultimate goal here would be to allow cvs to exit with one of these + * three values for when diff is called. Unfortunately this is not feasible because the + * because diff_fileproc calls( at least ) tag_check_valid() which + * when it finds a error exits the program with a '1' error code. + * Which is not what we want in this case, and unless we can come up + * with a good way to tell functions what error code we want them to + * exit with this will never be feasible. */ + return( ( err <= 1 ) ? 0 : 1 ); } /* Index: src/sanity.sh =================================================================== RCS file: /home2/cvsroot/ccvs/src/sanity.sh,v retrieving revision 1.635 diff -u -r1.635 sanity.sh --- src/sanity.sh 2000/11/29 21:18:46 1.635 +++ src/sanity.sh 2000/12/01 14:48:26 @@ -797,7 +797,7 @@ dotest basica-6 "${testcvs} -q update" '' echo "ssfile line 2" >>sdir/ssdir/ssfile - dotest_status basica-6.2 1 "${testcvs} -q diff -c" \ + dotest_status basica-6.2 0 "${testcvs} -q diff -c" \ "Index: sdir/ssdir/ssfile =================================================================== RCS file: ${TESTDIR}/cvsroot/first-dir/sdir/ssdir/ssfile,v @@ -810,7 +810,7 @@ --- 1,2 ---- ssfile ${PLUS} ssfile line 2" - dotest_status basica-6.3 1 "${testcvs} -q diff -c -rBASE" \ + dotest_status basica-6.3 0 "${testcvs} -q diff -c -rBASE" \ "Index: sdir/ssdir/ssfile =================================================================== RCS file: ${TESTDIR}/cvsroot/first-dir/sdir/ssdir/ssfile,v @@ -2595,7 +2595,7 @@ done" echo "#include " >abc # check the behavior of the --ifdef=MACRO option - dotest_fail diff-7 "${testcvs} -q diff --ifdef=HAVE_WINSOCK_H" \ + dotest diff-7 "${testcvs} -q diff --ifdef=HAVE_WINSOCK_H" \ "Index: abc =================================================================== RCS file: ${TESTDIR}/cvsroot/first-dir/abc,v @@ -3048,7 +3048,7 @@ # If the DIFF that CVS is using (options.h) is Sun diff, this # test is said to fail (I think the /dev/null is the part # that differs), along with a number of the other similar tests. - dotest_fail death2-diff-2 "${testcvs} -q diff -N -c file1" \ + dotest death2-diff-2 "${testcvs} -q diff -N -c file1" \ "Index: file1 =================================================================== RCS file: file1 @@ -3071,7 +3071,7 @@ "${testcvs} -q diff -r1.1 -rbranch -c file1" \ "${PROG} [a-z]*: file1 was removed, no comparison available" - dotest_fail death2-diff-4 \ + dotest death2-diff-4 \ "${testcvs} -q diff -r1.1 -rbranch -N -c file1" \ "Index: file1 =================================================================== @@ -3087,7 +3087,7 @@ dotest_fail death2-diff-5 "${testcvs} -q diff -rtag -c ." \ "${PROG} [a-z]*: file1 no longer exists, no comparison available" - dotest_fail death2-diff-6 "${testcvs} -q diff -rtag -N -c ." \ + dotest death2-diff-6 "${testcvs} -q diff -rtag -N -c ." \ "Index: file1 =================================================================== RCS file: file1 @@ -3123,7 +3123,7 @@ dotest_fail death2-diff-7 "${testcvs} -q diff file1" \ "${PROG} [a-z]*: file1 is a new entry, no comparison available" - dotest_fail death2-diff-8 "${testcvs} -q diff -N -c file1" \ + dotest death2-diff-8 "${testcvs} -q diff -N -c file1" \ "Index: file1 =================================================================== RCS file: file1 @@ -3214,7 +3214,7 @@ dotest_fail death2-diff-9 "${testcvs} -q diff -rtag -c file3" \ "${PROG} [a-z]*: tag tag is not in file file3" - dotest_fail death2-diff-10 "${testcvs} -q diff -rtag -N -c file3" \ + dotest death2-diff-10 "${testcvs} -q diff -rtag -N -c file3" \ "Index: file3 =================================================================== RCS file: file3 @@ -3244,7 +3244,7 @@ ${PROG} [a-z]*: tag tag is not in file file3 ${PROG} [a-z]*: file4 no longer exists, no comparison available" - dotest_fail death2-diff-12 "${testcvs} -q diff -rtag -c -N ." \ + dotest death2-diff-12 "${testcvs} -q diff -rtag -c -N ." \ "Index: file1 =================================================================== RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v @@ -3302,7 +3302,7 @@ dotest_fail death2-diff-13 "${testcvs} -q diff -r rdiff-tag" \ "${PROG} [a-z]*: file1 is a new entry, no comparison available" - dotest_fail death2-diff-14 "${testcvs} -q diff -r rdiff-tag -c -N" \ + dotest death2-diff-14 "${testcvs} -q diff -r rdiff-tag -c -N" \ "Index: file1 =================================================================== RCS file: file1 @@ -3953,7 +3953,7 @@ date: [0-9/: ]*; author: ${username}; state: Exp; lines: ${PLUS}1 -1 modify =============================================================================" - dotest_status branches-14.4 1 \ + dotest_status branches-14.4 0 \ "${testcvs} diff -c -r 1.1 -r 1.3 file4" \ "Index: file4 =================================================================== @@ -3968,7 +3968,7 @@ ! 4:trunk-1 --- 1 ---- ! 4:trunk-3" - dotest_status branches-14.5 1 \ + dotest_status branches-14.5 0 \ "${testcvs} diff -c -r 1.1 -r 1.2.2.1 file4" \ "Index: file4 =================================================================== @@ -4488,7 +4488,7 @@ \*\*\*\*\*\*\*\*\*\*\*\*\*\*\* I am the second foo, and my name is \$""Name: second \$\." - dotest_fail rcsdiff-9 "${testcvs} diff -r first -r second" \ + dotest rcsdiff-9 "${testcvs} diff -r first -r second" \ "${PROG} [a-z]*: Diffing \. Index: foo\.c =================================================================== @@ -4502,7 +4502,7 @@ > I am the second foo, and my name is \$""Name: \$\." echo "I am the once and future foo, and my name is $""Name$." > foo.c - dotest_fail rcsdiff-10 "${testcvs} diff -r first" \ + dotest rcsdiff-10 "${testcvs} diff -r first" \ "${PROG} [a-z]*: Diffing \. Index: foo\.c =================================================================== @@ -4548,8 +4548,7 @@ mumble; } EOF - # Use dotest_fail because exit status from `cvs diff' must be 1. - dotest_fail rcslib-diffrgx-3 "${testcvs} diff -c -F'.*(' rgx.c" \ + dotest rcslib-diffrgx-3 "${testcvs} diff -c -F'.*(' rgx.c" \ "Index: rgx\.c =================================================================== RCS file: ${TESTDIR}/cvsroot/first-dir/rgx\.c,v @@ -16169,7 +16168,7 @@ Merging differences between 1\.1 and 1\.1\.2\.1 into file1 rcsmerge: warning: conflicts during merge" - dotest_fail keyword2-12 "${testcvs} diff file1" \ + dotest keyword2-12 "${testcvs} diff file1" \ "Index: file1 =================================================================== RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v @@ -16314,7 +16313,7 @@ add a line on trunk after trunktag" # and diff thinks so too. Case (a) from the comment in # cvs.texinfo (Common options). - dotest_fail head-trunk-diff "${testcvs} -q diff -c -r HEAD -r br1" \ + dotest head-trunk-diff "${testcvs} -q diff -c -r HEAD -r br1" \ "Index: file1 =================================================================== RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v @@ -16366,7 +16365,7 @@ add a line on trunk add a line on trunk after trunktag" # Like head-brtag-diff, there is a non-branch sticky tag. - dotest_fail head-trunktag-diff \ + dotest head-trunktag-diff \ "${testcvs} -q diff -c -r HEAD -r br1" \ "Index: file1 =================================================================== @@ -19986,7 +19985,7 @@ "T dir1/file1 T dir1/sdir/sfile T dir1/sdir/ssdir/ssfile" - dotest_status multiroot2-12 1 \ + dotest_status multiroot2-12 0 \ "${testcvs} -q diff -u -r tag1 -r tag2" \ "Index: dir1/file1 ===================================================================