]> git.ipfire.org Git - thirdparty/git.git/commitdiff
tests: fix diff order arguments in test_cmp
authorStefan Beller <sbeller@google.com>
Fri, 6 Oct 2017 19:00:06 +0000 (12:00 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sat, 7 Oct 2017 01:56:08 +0000 (10:56 +0900)
Fix the argument order for test_cmp. When given the expected
result first the diff shows the actual output with '+' and the
expectation with '-', which is the convention for our tests.

Signed-off-by: Stefan Beller <sbeller@google.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 files changed:
t/t1004-read-tree-m-u-wf.sh
t/t4015-diff-whitespace.sh
t/t4205-log-pretty-formats.sh
t/t6007-rev-list-cherry-pick-file.sh
t/t6013-rev-list-reverse-parents.sh
t/t7001-mv.sh
t/t7005-editor.sh
t/t7102-reset.sh
t/t7201-co.sh
t/t7400-submodule-basic.sh
t/t7405-submodule-merge.sh
t/t7506-status-submodule.sh
t/t7600-merge.sh
t/t7610-mergetool.sh
t/t9001-send-email.sh

index c70cf423008cfb6f3f3fd735c1f6ee2d1408de2c..c7ce5d8bb588215d528fad5dfa6aa094d2a5d468 100755 (executable)
@@ -218,7 +218,7 @@ test_expect_success 'D/F' '
                echo "100644 $a 2       subdir/file2"
                echo "100644 $b 3       subdir/file2/another"
        ) >expect &&
-       test_cmp actual expect
+       test_cmp expect actual
 
 '
 
index 12d182dc1bba82401a929e6207eb2dcc7ea21672..1709e4578b89d36779783d946d574d14a14cca08 100755 (executable)
@@ -155,7 +155,7 @@ test_expect_success 'ignore-blank-lines: only new lines' '
 " >x &&
        git diff --ignore-blank-lines >out &&
        >expect &&
-       test_cmp out expect
+       test_cmp expect out
 '
 
 test_expect_success 'ignore-blank-lines: only new lines with space' '
@@ -165,7 +165,7 @@ test_expect_success 'ignore-blank-lines: only new lines with space' '
  " >x &&
        git diff -w --ignore-blank-lines >out &&
        >expect &&
-       test_cmp out expect
+       test_cmp expect out
 '
 
 test_expect_success 'ignore-blank-lines: after change' '
index ec5f530102c04080b9d199269583cac9ab924c7e..42f584f8b323b6d4f23e2243ff7c689955018794 100755 (executable)
@@ -590,7 +590,7 @@ test_expect_success '%(trailers:unfold) unfolds trailers' '
 test_expect_success ':only and :unfold work together' '
        git log --no-walk --pretty="%(trailers:only:unfold)" >actual &&
        git log --no-walk --pretty="%(trailers:unfold:only)" >reverse &&
-       test_cmp actual reverse &&
+       test_cmp reverse actual &&
        {
                grep -v patch.description <trailers | unfold &&
                echo
index 29597451967dd7e4847a5114b79a91399e1b3ab3..f0268372d25e562ad8fc5c347b376b88a62d8803 100755 (executable)
@@ -57,7 +57,7 @@ test_expect_success '--left-right' '
        git rev-list --left-right B...C > actual &&
        git name-rev --stdin --name-only --refs="*tags/*" \
                < actual > actual.named &&
-       test_cmp actual.named expect
+       test_cmp expect actual.named
 '
 
 test_expect_success '--count' '
@@ -77,14 +77,14 @@ test_expect_success '--cherry-pick bar does not come up empty' '
        git rev-list --left-right --cherry-pick B...C -- bar > actual &&
        git name-rev --stdin --name-only --refs="*tags/*" \
                < actual > actual.named &&
-       test_cmp actual.named expect
+       test_cmp expect actual.named
 '
 
 test_expect_success 'bar does not come up empty' '
        git rev-list --left-right B...C -- bar > actual &&
        git name-rev --stdin --name-only --refs="*tags/*" \
                < actual > actual.named &&
-       test_cmp actual.named expect
+       test_cmp expect actual.named
 '
 
 cat >expect <<EOF
@@ -96,14 +96,14 @@ test_expect_success '--cherry-pick bar does not come up empty (II)' '
        git rev-list --left-right --cherry-pick F...E -- bar > actual &&
        git name-rev --stdin --name-only --refs="*tags/*" \
                < actual > actual.named &&
-       test_cmp actual.named expect
+       test_cmp expect actual.named
 '
 
 test_expect_success 'name-rev multiple --refs combine inclusive' '
        git rev-list --left-right --cherry-pick F...E -- bar >actual &&
        git name-rev --stdin --name-only --refs="*tags/F" --refs="*tags/E" \
                <actual >actual.named &&
-       test_cmp actual.named expect
+       test_cmp expect actual.named
 '
 
 cat >expect <<EOF
@@ -115,7 +115,7 @@ test_expect_success 'name-rev --refs excludes non-matched patterns' '
        git rev-list --left-right --cherry-pick F...E -- bar >actual &&
        git name-rev --stdin --name-only --refs="*tags/F" \
                <actual >actual.named &&
-       test_cmp actual.named expect
+       test_cmp expect actual.named
 '
 
 cat >expect <<EOF
@@ -127,14 +127,14 @@ test_expect_success 'name-rev --exclude excludes matched patterns' '
        git rev-list --left-right --cherry-pick F...E -- bar >actual &&
        git name-rev --stdin --name-only --refs="*tags/*" --exclude="*E" \
                <actual >actual.named &&
-       test_cmp actual.named expect
+       test_cmp expect actual.named
 '
 
 test_expect_success 'name-rev --no-refs clears the refs list' '
        git rev-list --left-right --cherry-pick F...E -- bar >expect &&
        git name-rev --stdin --name-only --refs="*tags/F" --refs="*tags/E" --no-refs --refs="*tags/G" \
                <expect >actual &&
-       test_cmp actual expect
+       test_cmp expect actual
 '
 
 cat >expect <<EOF
@@ -148,7 +148,7 @@ test_expect_success '--cherry-mark' '
        git rev-list --cherry-mark F...E -- bar > actual &&
        git name-rev --stdin --name-only --refs="*tags/*" \
                < actual > actual.named &&
-       test_cmp actual.named expect
+       test_cmp expect actual.named
 '
 
 cat >expect <<EOF
@@ -162,7 +162,7 @@ test_expect_success '--cherry-mark --left-right' '
        git rev-list --cherry-mark --left-right F...E -- bar > actual &&
        git name-rev --stdin --name-only --refs="*tags/*" \
                < actual > actual.named &&
-       test_cmp actual.named expect
+       test_cmp expect actual.named
 '
 
 cat >expect <<EOF
@@ -173,14 +173,14 @@ test_expect_success '--cherry-pick --right-only' '
        git rev-list --cherry-pick --right-only F...E -- bar > actual &&
        git name-rev --stdin --name-only --refs="*tags/*" \
                < actual > actual.named &&
-       test_cmp actual.named expect
+       test_cmp expect actual.named
 '
 
 test_expect_success '--cherry-pick --left-only' '
        git rev-list --cherry-pick --left-only E...F -- bar > actual &&
        git name-rev --stdin --name-only --refs="*tags/*" \
                < actual > actual.named &&
-       test_cmp actual.named expect
+       test_cmp expect actual.named
 '
 
 cat >expect <<EOF
@@ -192,7 +192,7 @@ test_expect_success '--cherry' '
        git rev-list --cherry F...E -- bar > actual &&
        git name-rev --stdin --name-only --refs="*tags/*" \
                < actual > actual.named &&
-       test_cmp actual.named expect
+       test_cmp expect actual.named
 '
 
 cat >expect <<EOF
@@ -201,7 +201,7 @@ EOF
 
 test_expect_success '--cherry --count' '
        git rev-list --cherry --count F...E -- bar > actual &&
-       test_cmp actual expect
+       test_cmp expect actual
 '
 
 cat >expect <<EOF
@@ -210,7 +210,7 @@ EOF
 
 test_expect_success '--cherry-mark --count' '
        git rev-list --cherry-mark --count F...E -- bar > actual &&
-       test_cmp actual expect
+       test_cmp expect actual
 '
 
 cat >expect <<EOF
@@ -219,7 +219,7 @@ EOF
 
 test_expect_success '--cherry-mark --left-right --count' '
        git rev-list --cherry-mark --left-right --count F...E -- bar > actual &&
-       test_cmp actual expect
+       test_cmp expect actual
 '
 
 test_expect_success '--cherry-pick with independent, but identical branches' '
index 59fc2f06e0b5895af60b6eb4084fe7a38d3aa948..89458d370f5f05d245ba57e430b7b97dd5880639 100755 (executable)
@@ -28,7 +28,7 @@ test_expect_success '--reverse --parents --full-history combines correctly' '
                perl -e "print reverse <>" > expected &&
        git rev-list --reverse --parents --full-history master -- foo \
                > actual &&
-       test_cmp actual expected
+       test_cmp expected actual
        '
 
 test_expect_success '--boundary does too' '
@@ -36,7 +36,7 @@ test_expect_success '--boundary does too' '
                perl -e "print reverse <>" > expected &&
        git rev-list --boundary --reverse --parents --full-history \
                master ^root -- foo > actual &&
-       test_cmp actual expected
+       test_cmp expected actual
        '
 
 test_done
index cbc5fb37fe531ff9a60c236a175fd6a4f29b1ece..f5929c46f3ea7ed6317a77086d6263ac25a4f02b 100755 (executable)
@@ -488,7 +488,7 @@ test_expect_success 'moving a submodule in nested directories' '
                git config -f ../.gitmodules submodule.deep/directory/hierarchy/sub.path >../actual &&
                echo "directory/hierarchy/sub" >../expect
        ) &&
-       test_cmp actual expect
+       test_cmp expect actual
 '
 
 test_expect_failure 'moving nested submodules' '
index 1b530b5022fb58ce51ad8cd44c630acdca613311..29e5043b9452b9c32a0d8ad437fb33745b296ac6 100755 (executable)
@@ -38,7 +38,7 @@ test_expect_success setup '
        test_commit "$msg" &&
        echo "$msg" >expect &&
        git show -s --format=%s > actual &&
-       test_cmp actual expect
+       test_cmp expect actual
 
 '
 
@@ -85,7 +85,7 @@ do
                git --exec-path=. commit --amend &&
                git show -s --pretty=oneline |
                sed -e "s/^[0-9a-f]* //" >actual &&
-               test_cmp actual expect
+               test_cmp expect actual
        '
 done
 
@@ -107,7 +107,7 @@ do
                git --exec-path=. commit --amend &&
                git show -s --pretty=oneline |
                sed -e "s/^[0-9a-f]* //" >actual &&
-               test_cmp actual expect
+               test_cmp expect actual
        '
 done
 
index 86f23be34aa69a9a345f95554f8a32d6ac45af5d..95653a08cade25fb6edd7dcc479fb102d800f534 100755 (executable)
@@ -428,9 +428,9 @@ test_expect_success 'test --mixed <paths>' '
        git reset HEAD -- file1 file2 file3 &&
        test_must_fail git diff --quiet &&
        git diff > output &&
-       test_cmp output expect &&
+       test_cmp expect output &&
        git diff --cached > output &&
-       test_cmp output cached_expect
+       test_cmp cached_expect output
 '
 
 test_expect_success 'test resetting the index at give paths' '
index d4b217b0ee5136d2836ba9526b286659d66afe80..76c223c9675cd1531ac078fa9e0c1f8cc4e09781 100755 (executable)
@@ -187,7 +187,7 @@ test_expect_success 'format of merge conflict from checkout -m' '
        d
        >>>>>>> local
        EOF
-       test_cmp two expect
+       test_cmp expect two
 '
 
 test_expect_success 'checkout --merge --conflict=diff3 <branch>' '
@@ -213,7 +213,7 @@ test_expect_success 'checkout --merge --conflict=diff3 <branch>' '
        d
        >>>>>>> local
        EOF
-       test_cmp two expect
+       test_cmp expect two
 '
 
 test_expect_success 'switch to another branch while carrying a deletion' '
index 6f8337ffb563cf13f194186b101bbaebf0beeb35..a39e69a3ebd1c39ddf8feb861f8a39c8315aa7f8 100755 (executable)
@@ -1211,7 +1211,7 @@ test_expect_success 'clone --recurse-submodules with a pathspec works' '
 
        git clone --recurse-submodules="sub0" multisuper multisuper_clone &&
        git -C multisuper_clone submodule status |cut -c1,43- >actual &&
-       test_cmp actual expected
+       test_cmp expected actual
 '
 
 test_expect_success 'clone with multiple --recurse-submodules options' '
index 0d5b42a25bbe79d3fb7b09ce4bf5107ee55928e5..7bfb2f498d3579d6e0aed2056a996f5c2829e8e4 100755 (executable)
@@ -119,7 +119,7 @@ test_expect_success 'merge with one side as a fast-forward of the other' '
         git ls-tree test-forward sub | cut -f1 | cut -f3 -d" " > actual &&
         (cd sub &&
          git rev-parse sub-d > ../expect) &&
-        test_cmp actual expect)
+        test_cmp expect actual)
 '
 
 test_expect_success 'merging should conflict for non fast-forward' '
index 055c90736e9c0cfb60fef7db643f30c7573de581..9edf6572ed3b8f04ef1169f545043fcb2e09fe21 100755 (executable)
@@ -306,7 +306,7 @@ test_expect_success 'diff with merge conflict in .gitmodules' '
                cd super &&
                git diff >../diff_actual 2>&1
        ) &&
-       test_cmp diff_actual diff_expect
+       test_cmp diff_expect diff_actual
 '
 
 test_expect_success 'diff --submodule with merge conflict in .gitmodules' '
@@ -314,7 +314,7 @@ test_expect_success 'diff --submodule with merge conflict in .gitmodules' '
                cd super &&
                git diff --submodule >../diff_submodule_actual 2>&1
        ) &&
-       test_cmp diff_submodule_actual diff_submodule_expect
+       test_cmp diff_submodule_expect diff_submodule_actual
 '
 
 # We'll setup different cases for further testing:
index 80194b79f90c800e7aaeecca9cd502e3ade494b4..dfde6a675a8cd28297324627923a861bc7410ff2 100755 (executable)
@@ -697,7 +697,7 @@ test_expect_success 'merge --no-ff --edit' '
        git cat-file commit HEAD >raw &&
        grep "work done on the side branch" raw &&
        sed "1,/^$/d" >actual raw &&
-       test_cmp actual expected
+       test_cmp expected actual
 '
 
 test_expect_success GPG 'merge --ff-only tag' '
@@ -709,7 +709,7 @@ test_expect_success GPG 'merge --ff-only tag' '
        git merge --ff-only signed &&
        git rev-parse signed^0 >expect &&
        git rev-parse HEAD >actual &&
-       test_cmp actual expect
+       test_cmp expect actual
 '
 
 test_expect_success GPG 'merge --no-edit tag should skip editor' '
@@ -721,7 +721,7 @@ test_expect_success GPG 'merge --no-edit tag should skip editor' '
        EDITOR=false git merge --no-edit signed &&
        git rev-parse signed^0 >expect &&
        git rev-parse HEAD^2 >actual &&
-       test_cmp actual expect
+       test_cmp expect actual
 '
 
 test_expect_success 'set up mod-256 conflict scenario' '
index 381b7df452e44622c46c8c3471f181b4568be10a..1a430b9c40d477dd7a399c165585444818f471cf 100755 (executable)
@@ -621,7 +621,7 @@ test_expect_success 'file with no base' '
        test_must_fail git merge master &&
        git mergetool --no-prompt --tool mybase -- both &&
        >expected &&
-       test_cmp both expected
+       test_cmp expected both
 '
 
 test_expect_success 'custom commands override built-ins' '
@@ -632,7 +632,7 @@ test_expect_success 'custom commands override built-ins' '
        test_must_fail git merge master &&
        git mergetool --no-prompt --tool defaults -- both &&
        echo master both added >expected &&
-       test_cmp both expected
+       test_cmp expected both
 '
 
 test_expect_success 'filenames seen by tools start with ./' '
index f30980895c2f1b93317870e6b471d67bc99b0fd2..4d261c2a9c2a8081b07ee8db39d0983f0a470341 100755 (executable)
@@ -1266,7 +1266,7 @@ test_expect_success $PREREQ 'asks about and fixes 8bit encodings' '
        grep email-using-8bit stdout &&
        grep "Which 8bit encoding" stdout &&
        egrep "Content|MIME" msgtxt1 >actual &&
-       test_cmp actual content-type-decl
+       test_cmp content-type-decl actual
 '
 
 test_expect_success $PREREQ 'sendemail.8bitEncoding works' '
@@ -1277,7 +1277,7 @@ test_expect_success $PREREQ 'sendemail.8bitEncoding works' '
                        --smtp-server="$(pwd)/fake.sendmail" \
                        email-using-8bit >stdout &&
        egrep "Content|MIME" msgtxt1 >actual &&
-       test_cmp actual content-type-decl
+       test_cmp content-type-decl actual
 '
 
 test_expect_success $PREREQ '--8bit-encoding overrides sendemail.8bitEncoding' '
@@ -1289,7 +1289,7 @@ test_expect_success $PREREQ '--8bit-encoding overrides sendemail.8bitEncoding' '
                        --8bit-encoding=UTF-8 \
                        email-using-8bit >stdout &&
        egrep "Content|MIME" msgtxt1 >actual &&
-       test_cmp actual content-type-decl
+       test_cmp content-type-decl actual
 '
 
 test_expect_success $PREREQ 'setup expect' '