tests: fix diff order arguments in test_cmp

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>

Stefan Beller committed Oct 6, 2017 at 12:00 UTC 9c5b2fab304b5ce3233401c7c7e7a123d551c484
15 files changed +42 -42
t/t1004-read-tree-m-u-wf.sh
+1 -1
@@ -218,7 +218,7 @@ test_expect_success 'D/F' '
218 echo "100644 $a 2 subdir/file2"
219 echo "100644 $b 3 subdir/file2/another"
220 ) >expect &&
221 - test_cmp actual expect
221 + test_cmp expect actual
222
223 '
224
t/t4015-diff-whitespace.sh
+2 -2
@@ -155,7 +155,7 @@ test_expect_success 'ignore-blank-lines: only new lines' '
155 " >x &&
156 git diff --ignore-blank-lines >out &&
157 >expect &&
158 - test_cmp out expect
158 + test_cmp expect out
159 '
160
161 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' '
165 " >x &&
166 git diff -w --ignore-blank-lines >out &&
167 >expect &&
168 - test_cmp out expect
168 + test_cmp expect out
169 '
170
171 test_expect_success 'ignore-blank-lines: after change' '
t/t4205-log-pretty-formats.sh
+1 -1
@@ -590,7 +590,7 @@ test_expect_success '%(trailers:unfold) unfolds trailers' '
590 test_expect_success ':only and :unfold work together' '
591 git log --no-walk --pretty="%(trailers:only:unfold)" >actual &&
592 git log --no-walk --pretty="%(trailers:unfold:only)" >reverse &&
593 - test_cmp actual reverse &&
593 + test_cmp reverse actual &&
594 {
595 grep -v patch.description <trailers | unfold &&
596 echo
t/t6007-rev-list-cherry-pick-file.sh
+16 -16
@@ -57,7 +57,7 @@ test_expect_success '--left-right' '
57 git rev-list --left-right B...C > actual &&
58 git name-rev --stdin --name-only --refs="*tags/*" \
59 < actual > actual.named &&
60 - test_cmp actual.named expect
60 + test_cmp expect actual.named
61 '
62
63 test_expect_success '--count' '
@@ -77,14 +77,14 @@ test_expect_success '--cherry-pick bar does not come up empty' '
77 git rev-list --left-right --cherry-pick B...C -- bar > actual &&
78 git name-rev --stdin --name-only --refs="*tags/*" \
79 < actual > actual.named &&
80 - test_cmp actual.named expect
80 + test_cmp expect actual.named
81 '
82
83 test_expect_success 'bar does not come up empty' '
84 git rev-list --left-right B...C -- bar > actual &&
85 git name-rev --stdin --name-only --refs="*tags/*" \
86 < actual > actual.named &&
87 - test_cmp actual.named expect
87 + test_cmp expect actual.named
88 '
89
90 cat >expect <<EOF
@@ -96,14 +96,14 @@ test_expect_success '--cherry-pick bar does not come up empty (II)' '
96 git rev-list --left-right --cherry-pick F...E -- bar > actual &&
97 git name-rev --stdin --name-only --refs="*tags/*" \
98 < actual > actual.named &&
99 - test_cmp actual.named expect
99 + test_cmp expect actual.named
100 '
101
102 test_expect_success 'name-rev multiple --refs combine inclusive' '
103 git rev-list --left-right --cherry-pick F...E -- bar >actual &&
104 git name-rev --stdin --name-only --refs="*tags/F" --refs="*tags/E" \
105 <actual >actual.named &&
106 - test_cmp actual.named expect
106 + test_cmp expect actual.named
107 '
108
109 cat >expect <<EOF
@@ -115,7 +115,7 @@ test_expect_success 'name-rev --refs excludes non-matched patterns' '
115 git rev-list --left-right --cherry-pick F...E -- bar >actual &&
116 git name-rev --stdin --name-only --refs="*tags/F" \
117 <actual >actual.named &&
118 - test_cmp actual.named expect
118 + test_cmp expect actual.named
119 '
120
121 cat >expect <<EOF
@@ -127,14 +127,14 @@ test_expect_success 'name-rev --exclude excludes matched patterns' '
127 git rev-list --left-right --cherry-pick F...E -- bar >actual &&
128 git name-rev --stdin --name-only --refs="*tags/*" --exclude="*E" \
129 <actual >actual.named &&
130 - test_cmp actual.named expect
130 + test_cmp expect actual.named
131 '
132
133 test_expect_success 'name-rev --no-refs clears the refs list' '
134 git rev-list --left-right --cherry-pick F...E -- bar >expect &&
135 git name-rev --stdin --name-only --refs="*tags/F" --refs="*tags/E" --no-refs --refs="*tags/G" \
136 <expect >actual &&
137 - test_cmp actual expect
137 + test_cmp expect actual
138 '
139
140 cat >expect <<EOF
@@ -148,7 +148,7 @@ test_expect_success '--cherry-mark' '
148 git rev-list --cherry-mark F...E -- bar > actual &&
149 git name-rev --stdin --name-only --refs="*tags/*" \
150 < actual > actual.named &&
151 - test_cmp actual.named expect
151 + test_cmp expect actual.named
152 '
153
154 cat >expect <<EOF
@@ -162,7 +162,7 @@ test_expect_success '--cherry-mark --left-right' '
162 git rev-list --cherry-mark --left-right F...E -- bar > actual &&
163 git name-rev --stdin --name-only --refs="*tags/*" \
164 < actual > actual.named &&
165 - test_cmp actual.named expect
165 + test_cmp expect actual.named
166 '
167
168 cat >expect <<EOF
@@ -173,14 +173,14 @@ test_expect_success '--cherry-pick --right-only' '
173 git rev-list --cherry-pick --right-only F...E -- bar > actual &&
174 git name-rev --stdin --name-only --refs="*tags/*" \
175 < actual > actual.named &&
176 - test_cmp actual.named expect
176 + test_cmp expect actual.named
177 '
178
179 test_expect_success '--cherry-pick --left-only' '
180 git rev-list --cherry-pick --left-only E...F -- bar > actual &&
181 git name-rev --stdin --name-only --refs="*tags/*" \
182 < actual > actual.named &&
183 - test_cmp actual.named expect
183 + test_cmp expect actual.named
184 '
185
186 cat >expect <<EOF
@@ -192,7 +192,7 @@ test_expect_success '--cherry' '
192 git rev-list --cherry F...E -- bar > actual &&
193 git name-rev --stdin --name-only --refs="*tags/*" \
194 < actual > actual.named &&
195 - test_cmp actual.named expect
195 + test_cmp expect actual.named
196 '
197
198 cat >expect <<EOF
@@ -201,7 +201,7 @@ EOF
201
202 test_expect_success '--cherry --count' '
203 git rev-list --cherry --count F...E -- bar > actual &&
204 - test_cmp actual expect
204 + test_cmp expect actual
205 '
206
207 cat >expect <<EOF
@@ -210,7 +210,7 @@ EOF
210
211 test_expect_success '--cherry-mark --count' '
212 git rev-list --cherry-mark --count F...E -- bar > actual &&
213 - test_cmp actual expect
213 + test_cmp expect actual
214 '
215
216 cat >expect <<EOF
@@ -219,7 +219,7 @@ EOF
219
220 test_expect_success '--cherry-mark --left-right --count' '
221 git rev-list --cherry-mark --left-right --count F...E -- bar > actual &&
222 - test_cmp actual expect
222 + test_cmp expect actual
223 '
224
225 test_expect_success '--cherry-pick with independent, but identical branches' '
t/t6013-rev-list-reverse-parents.sh
+2 -2
@@ -28,7 +28,7 @@ test_expect_success '--reverse --parents --full-history combines correctly' '
28 perl -e "print reverse <>" > expected &&
29 git rev-list --reverse --parents --full-history master -- foo \
30 > actual &&
31 - test_cmp actual expected
31 + test_cmp expected actual
32 '
33
34 test_expect_success '--boundary does too' '
@@ -36,7 +36,7 @@ test_expect_success '--boundary does too' '
36 perl -e "print reverse <>" > expected &&
37 git rev-list --boundary --reverse --parents --full-history \
38 master ^root -- foo > actual &&
39 - test_cmp actual expected
39 + test_cmp expected actual
40 '
41
42 test_done
t/t7001-mv.sh
+1 -1
@@ -488,7 +488,7 @@ test_expect_success 'moving a submodule in nested directories' '
488 git config -f ../.gitmodules submodule.deep/directory/hierarchy/sub.path >../actual &&
489 echo "directory/hierarchy/sub" >../expect
490 ) &&
491 - test_cmp actual expect
491 + test_cmp expect actual
492 '
493
494 test_expect_failure 'moving nested submodules' '
t/t7005-editor.sh
+3 -3
@@ -38,7 +38,7 @@ test_expect_success setup '
38 test_commit "$msg" &&
39 echo "$msg" >expect &&
40 git show -s --format=%s > actual &&
41 - test_cmp actual expect
41 + test_cmp expect actual
42
43 '
44
@@ -85,7 +85,7 @@ do
85 git --exec-path=. commit --amend &&
86 git show -s --pretty=oneline |
87 sed -e "s/^[0-9a-f]* //" >actual &&
88 - test_cmp actual expect
88 + test_cmp expect actual
89 '
90 done
91
@@ -107,7 +107,7 @@ do
107 git --exec-path=. commit --amend &&
108 git show -s --pretty=oneline |
109 sed -e "s/^[0-9a-f]* //" >actual &&
110 - test_cmp actual expect
110 + test_cmp expect actual
111 '
112 done
113
t/t7102-reset.sh
+2 -2
@@ -428,9 +428,9 @@ test_expect_success 'test --mixed <paths>' '
428 git reset HEAD -- file1 file2 file3 &&
429 test_must_fail git diff --quiet &&
430 git diff > output &&
431 - test_cmp output expect &&
431 + test_cmp expect output &&
432 git diff --cached > output &&
433 - test_cmp output cached_expect
433 + test_cmp cached_expect output
434 '
435
436 test_expect_success 'test resetting the index at give paths' '
t/t7201-co.sh
+2 -2
@@ -187,7 +187,7 @@ test_expect_success 'format of merge conflict from checkout -m' '
187 d
188 >>>>>>> local
189 EOF
190 - test_cmp two expect
190 + test_cmp expect two
191 '
192
193 test_expect_success 'checkout --merge --conflict=diff3 <branch>' '
@@ -213,7 +213,7 @@ test_expect_success 'checkout --merge --conflict=diff3 <branch>' '
213 d
214 >>>>>>> local
215 EOF
216 - test_cmp two expect
216 + test_cmp expect two
217 '
218
219 test_expect_success 'switch to another branch while carrying a deletion' '
t/t7400-submodule-basic.sh
+1 -1
@@ -1211,7 +1211,7 @@ test_expect_success 'clone --recurse-submodules with a pathspec works' '
1211
1212 git clone --recurse-submodules="sub0" multisuper multisuper_clone &&
1213 git -C multisuper_clone submodule status |cut -c1,43- >actual &&
1214 - test_cmp actual expected
1214 + test_cmp expected actual
1215 '
1216
1217 test_expect_success 'clone with multiple --recurse-submodules options' '
t/t7405-submodule-merge.sh
+1 -1
@@ -119,7 +119,7 @@ test_expect_success 'merge with one side as a fast-forward of the other' '
119 git ls-tree test-forward sub | cut -f1 | cut -f3 -d" " > actual &&
120 (cd sub &&
121 git rev-parse sub-d > ../expect) &&
122 - test_cmp actual expect)
122 + test_cmp expect actual)
123 '
124
125 test_expect_success 'merging should conflict for non fast-forward' '
t/t7506-status-submodule.sh
+2 -2
@@ -306,7 +306,7 @@ test_expect_success 'diff with merge conflict in .gitmodules' '
306 cd super &&
307 git diff >../diff_actual 2>&1
308 ) &&
309 - test_cmp diff_actual diff_expect
309 + test_cmp diff_expect diff_actual
310 '
311
312 test_expect_success 'diff --submodule with merge conflict in .gitmodules' '
@@ -314,7 +314,7 @@ test_expect_success 'diff --submodule with merge conflict in .gitmodules' '
314 cd super &&
315 git diff --submodule >../diff_submodule_actual 2>&1
316 ) &&
317 - test_cmp diff_submodule_actual diff_submodule_expect
317 + test_cmp diff_submodule_expect diff_submodule_actual
318 '
319
320 # We'll setup different cases for further testing:
t/t7600-merge.sh
+3 -3
@@ -697,7 +697,7 @@ test_expect_success 'merge --no-ff --edit' '
697 git cat-file commit HEAD >raw &&
698 grep "work done on the side branch" raw &&
699 sed "1,/^$/d" >actual raw &&
700 - test_cmp actual expected
700 + test_cmp expected actual
701 '
702
703 test_expect_success GPG 'merge --ff-only tag' '
@@ -709,7 +709,7 @@ test_expect_success GPG 'merge --ff-only tag' '
709 git merge --ff-only signed &&
710 git rev-parse signed^0 >expect &&
711 git rev-parse HEAD >actual &&
712 - test_cmp actual expect
712 + test_cmp expect actual
713 '
714
715 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' '
721 EDITOR=false git merge --no-edit signed &&
722 git rev-parse signed^0 >expect &&
723 git rev-parse HEAD^2 >actual &&
724 - test_cmp actual expect
724 + test_cmp expect actual
725 '
726
727 test_expect_success 'set up mod-256 conflict scenario' '
t/t7610-mergetool.sh
+2 -2
@@ -621,7 +621,7 @@ test_expect_success 'file with no base' '
621 test_must_fail git merge master &&
622 git mergetool --no-prompt --tool mybase -- both &&
623 >expected &&
624 - test_cmp both expected
624 + test_cmp expected both
625 '
626
627 test_expect_success 'custom commands override built-ins' '
@@ -632,7 +632,7 @@ test_expect_success 'custom commands override built-ins' '
632 test_must_fail git merge master &&
633 git mergetool --no-prompt --tool defaults -- both &&
634 echo master both added >expected &&
635 - test_cmp both expected
635 + test_cmp expected both
636 '
637
638 test_expect_success 'filenames seen by tools start with ./' '
t/t9001-send-email.sh
+3 -3
@@ -1266,7 +1266,7 @@ test_expect_success $PREREQ 'asks about and fixes 8bit encodings' '
1266 grep email-using-8bit stdout &&
1267 grep "Which 8bit encoding" stdout &&
1268 egrep "Content|MIME" msgtxt1 >actual &&
1269 - test_cmp actual content-type-decl
1269 + test_cmp content-type-decl actual
1270 '
1271
1272 test_expect_success $PREREQ 'sendemail.8bitEncoding works' '
@@ -1277,7 +1277,7 @@ test_expect_success $PREREQ 'sendemail.8bitEncoding works' '
1277 --smtp-server="$(pwd)/fake.sendmail" \
1278 email-using-8bit >stdout &&
1279 egrep "Content|MIME" msgtxt1 >actual &&
1280 - test_cmp actual content-type-decl
1280 + test_cmp content-type-decl actual
1281 '
1282
1283 test_expect_success $PREREQ '--8bit-encoding overrides sendemail.8bitEncoding' '
@@ -1289,7 +1289,7 @@ test_expect_success $PREREQ '--8bit-encoding overrides sendemail.8bitEncoding' '
1289 --8bit-encoding=UTF-8 \
1290 email-using-8bit >stdout &&
1291 egrep "Content|MIME" msgtxt1 >actual &&
1292 - test_cmp actual content-type-decl
1292 + test_cmp content-type-decl actual
1293 '
1294
1295 test_expect_success $PREREQ 'setup expect' '