tests: make use of the test_must_be_empty function

Change various tests that use an idiom of the form: >expect && test_cmp expect actual To instead use: test_must_be_empty actual The test_must_be_empty() wrapper was introduced in ca8d148daf ("test: test_must_be_empty helper", 2013-06-09). Many of these tests have been added after that time. This was mostly found with, and manually pruned from: git grep '^\s+>.*expect.* &&$' t Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ævar Arnfjörð Bjarmason committed Jul 27, 2018 at 17:48 UTC d3c6751b18170276f80e3578d16877d43ad22709
45 files changed +111 -205
t/t0008-ignores.sh
+3 -6
@@ -807,10 +807,9 @@ test_expect_success 'trailing whitespace is ignored' '
807 cat >expect <<EOF &&
808 whitespace/untracked
809 EOF
810 - : >err.expect &&
810 git ls-files -o -X ignore whitespace >actual 2>err &&
811 test_cmp expect actual &&
813 - test_cmp err.expect err
812 + test_must_be_empty err
813 '
814
815 test_expect_success !MINGW 'quoting allows trailing whitespace' '
@@ -820,10 +819,9 @@ test_expect_success !MINGW 'quoting allows trailing whitespace' '
819 >whitespace/untracked &&
820 echo "whitespace/trailing\\ \\ " >ignore &&
821 echo whitespace/untracked >expect &&
823 - : >err.expect &&
822 git ls-files -o -X ignore whitespace >actual 2>err &&
823 test_cmp expect actual &&
826 - test_cmp err.expect err
824 + test_must_be_empty err
825 '
826
827 test_expect_success !MINGW,!CYGWIN 'correct handling of backslashes' '
@@ -845,10 +843,9 @@ test_expect_success !MINGW,!CYGWIN 'correct handling of backslashes' '
843 whitespace/trailing 6 \\a\\Z
844 EOF
845 echo whitespace/untracked >expect &&
848 - >err.expect &&
846 git ls-files -o -X ignore whitespace >actual 2>err &&
847 test_cmp expect actual &&
851 - test_cmp err.expect err
848 + test_must_be_empty err
849 '
850
851 test_expect_success 'info/exclude trumps core.excludesfile' '
t/t0030-stripspace.sh
+8 -9
@@ -110,31 +110,30 @@ test_expect_success \
110
111 test_expect_success \
112 'only consecutive blank lines should be completely removed' '
113 - > expect &&
113
114 printf "\n" | git stripspace >actual &&
116 - test_cmp expect actual &&
115 + test_must_be_empty actual &&
116
117 printf "\n\n\n" | git stripspace >actual &&
119 - test_cmp expect actual &&
118 + test_must_be_empty actual &&
119
120 printf "$sss\n$sss\n$sss\n" | git stripspace >actual &&
122 - test_cmp expect actual &&
121 + test_must_be_empty actual &&
122
123 printf "$sss$sss\n$sss\n\n" | git stripspace >actual &&
125 - test_cmp expect actual &&
124 + test_must_be_empty actual &&
125
126 printf "\n$sss\n$sss$sss\n" | git stripspace >actual &&
128 - test_cmp expect actual &&
127 + test_must_be_empty actual &&
128
129 printf "$sss$sss$sss$sss\n\n\n" | git stripspace >actual &&
131 - test_cmp expect actual &&
130 + test_must_be_empty actual &&
131
132 printf "\n$sss$sss$sss$sss\n\n" | git stripspace >actual &&
134 - test_cmp expect actual &&
133 + test_must_be_empty actual &&
134
135 printf "\n\n$sss$sss$sss$sss\n" | git stripspace >actual &&
137 - test_cmp expect actual
136 + test_must_be_empty actual
137 '
138
139 test_expect_success \
t/t0300-credentials.sh
+1 -2
@@ -294,8 +294,7 @@ test_expect_success 'helpers can abort the process' '
294 -c credential.helper="!f() { echo quit=1; }; f" \
295 -c credential.helper="verbatim foo bar" \
296 credential fill >stdout &&
297 - >expect &&
298 - test_cmp expect stdout
297 + test_must_be_empty stdout
298 '
299
300 test_expect_success 'empty helper spec resets helper list' '
t/t1011-read-tree-sparse-checkout.sh
+1 -2
@@ -227,12 +227,11 @@ test_expect_success 'index removal and worktree narrowing at the same time' '
227 '
228
229 test_expect_success 'read-tree --reset removes outside worktree' '
230 - >empty &&
230 echo init.t >.git/info/sparse-checkout &&
231 git checkout -f top &&
232 git reset --hard removed &&
233 git ls-files sub/added >result &&
235 - test_cmp empty result
234 + test_must_be_empty result
235 '
236
237 test_expect_success 'print errors when failed to update worktree' '
t/t1306-xdg-files.sh
+2 -4
@@ -114,11 +114,10 @@ test_expect_success 'Exclusion in a non-XDG global ignore file' '
114 '
115
116 test_expect_success 'Checking XDG ignore file when HOME is unset' '
117 - >expected &&
117 (sane_unset HOME &&
118 git config --unset core.excludesfile &&
119 git ls-files --exclude-standard --ignored >actual) &&
121 - test_cmp expected actual
120 + test_must_be_empty actual
121 '
122
123 test_expect_success 'Checking attributes in the XDG attributes file' '
@@ -132,10 +131,9 @@ test_expect_success 'Checking attributes in the XDG attributes file' '
131 '
132
133 test_expect_success 'Checking XDG attributes when HOME is unset' '
135 - >expected &&
134 (sane_unset HOME &&
135 git check-attr -a f >actual) &&
138 - test_cmp expected actual
136 + test_must_be_empty actual
137 '
138
139 test_expect_success '$XDG_CONFIG_HOME overrides $HOME/.config/git/attributes' '
t/t1403-show-ref.sh
+17 -29
@@ -26,26 +26,22 @@ test_expect_success 'show-ref' '
26 git show-ref refs/tags/A >actual &&
27 test_cmp expect actual &&
28
29 - >expect &&
30 -
29 test_must_fail git show-ref D >actual &&
32 - test_cmp expect actual
30 + test_must_be_empty actual
31 '
32
33 test_expect_success 'show-ref -q' '
36 - >expect &&
37 -
34 git show-ref -q A >actual &&
39 - test_cmp expect actual &&
35 + test_must_be_empty actual &&
36
37 git show-ref -q tags/A >actual &&
42 - test_cmp expect actual &&
38 + test_must_be_empty actual &&
39
40 git show-ref -q refs/tags/A >actual &&
45 - test_cmp expect actual &&
41 + test_must_be_empty actual &&
42
43 test_must_fail git show-ref -q D >actual &&
48 - test_cmp expect actual
44 + test_must_be_empty actual
45 '
46
47 test_expect_success 'show-ref --verify' '
@@ -54,32 +50,28 @@ test_expect_success 'show-ref --verify' '
50 git show-ref --verify refs/tags/A >actual &&
51 test_cmp expect actual &&
52
57 - >expect &&
58 -
53 test_must_fail git show-ref --verify A >actual &&
60 - test_cmp expect actual &&
54 + test_must_be_empty actual &&
55
56 test_must_fail git show-ref --verify tags/A >actual &&
63 - test_cmp expect actual &&
57 + test_must_be_empty actual &&
58
59 test_must_fail git show-ref --verify D >actual &&
66 - test_cmp expect actual
60 + test_must_be_empty actual
61 '
62
63 test_expect_success 'show-ref --verify -q' '
70 - >expect &&
71 -
64 git show-ref --verify -q refs/tags/A >actual &&
73 - test_cmp expect actual &&
65 + test_must_be_empty actual &&
66
67 test_must_fail git show-ref --verify -q A >actual &&
76 - test_cmp expect actual &&
68 + test_must_be_empty actual &&
69
70 test_must_fail git show-ref --verify -q tags/A >actual &&
79 - test_cmp expect actual &&
71 + test_must_be_empty actual &&
72
73 test_must_fail git show-ref --verify -q D >actual &&
82 - test_cmp expect actual
74 + test_must_be_empty actual
75 '
76
77 test_expect_success 'show-ref -d' '
@@ -113,19 +105,17 @@ test_expect_success 'show-ref -d' '
105 git show-ref -d --verify refs/heads/master >actual &&
106 test_cmp expect actual &&
107
116 - >expect &&
117 -
108 test_must_fail git show-ref -d --verify master >actual &&
119 - test_cmp expect actual &&
109 + test_must_be_empty actual &&
110
111 test_must_fail git show-ref -d --verify heads/master >actual &&
122 - test_cmp expect actual &&
112 + test_must_be_empty actual &&
113
114 test_must_fail git show-ref --verify -d A C >actual &&
125 - test_cmp expect actual &&
115 + test_must_be_empty actual &&
116
117 test_must_fail git show-ref --verify -d tags/A tags/C >actual &&
128 - test_cmp expect actual
118 + test_must_be_empty actual
119
120 '
121
@@ -178,10 +168,8 @@ test_expect_success 'show-ref --verify HEAD' '
168 git show-ref --verify HEAD >actual &&
169 test_cmp expect actual &&
170
181 - >expect &&
182 -
171 git show-ref --verify -q HEAD >actual &&
184 - test_cmp expect actual
172 + test_must_be_empty actual
173 '
174
175 test_expect_success 'show-ref --verify with dangling ref' '
t/t1507-rev-parse-upstream.sh
+1 -2
@@ -138,8 +138,7 @@ test_expect_success 'branch -d other@{u}' '
138 git checkout -t -b other master &&
139 git branch -d @{u} &&
140 git for-each-ref refs/heads/master >actual &&
141 - >expect &&
142 - test_cmp expect actual
141 + test_must_be_empty actual
142 '
143
144 test_expect_success 'checkout other@{u}' '
t/t2202-add-addremove.sh
+1 -2
@@ -48,8 +48,7 @@ test_expect_success 'Just "git add" is a no-op' '
48 >will-not-be-added &&
49 git add &&
50 git diff-index --name-status --cached HEAD >actual &&
51 - >expect &&
52 - test_cmp expect actual
51 + test_must_be_empty actual
52 '
53
54 test_done
t/t3001-ls-files-others-exclude.sh
+5 -10
@@ -210,8 +210,7 @@ test_expect_success 'subdirectory ignore (toplevel)' '
210 cd top &&
211 git ls-files -o --exclude-standard
212 ) >actual &&
213 - >expect &&
214 - test_cmp expect actual
213 + test_must_be_empty actual
214 '
215
216 test_expect_success 'subdirectory ignore (l1/l2)' '
@@ -219,8 +218,7 @@ test_expect_success 'subdirectory ignore (l1/l2)' '
218 cd top/l1/l2 &&
219 git ls-files -o --exclude-standard
220 ) >actual &&
222 - >expect &&
223 - test_cmp expect actual
221 + test_must_be_empty actual
222 '
223
224 test_expect_success 'subdirectory ignore (l1)' '
@@ -228,8 +226,7 @@ test_expect_success 'subdirectory ignore (l1)' '
226 cd top/l1 &&
227 git ls-files -o --exclude-standard
228 ) >actual &&
231 - >expect &&
232 - test_cmp expect actual
229 + test_must_be_empty actual
230 '
231
232 test_expect_success 'show/hide empty ignored directory (setup)' '
@@ -251,8 +248,7 @@ test_expect_success 'hide empty ignored directory with --no-empty-directory' '
248 cd top &&
249 git ls-files -o -i --exclude l1 --directory --no-empty-directory
250 ) >actual &&
254 - >expect &&
255 - test_cmp expect actual
251 + test_must_be_empty actual
252 '
253
254 test_expect_success 'show/hide empty ignored sub-directory (setup)' '
@@ -277,8 +273,7 @@ test_expect_success 'hide empty ignored sub-directory with --no-empty-directory'
273 cd top &&
274 git ls-files -o -i --exclude l1 --directory --no-empty-directory
275 ) >actual &&
280 - >expect &&
281 - test_cmp expect actual
276 + test_must_be_empty actual
277 '
278
279 test_expect_success 'pattern matches prefix completely' '
t/t3070-wildmatch.sh
+1 -2
@@ -101,8 +101,7 @@ match_with_ls_files() {
101
102 match_stdout_stderr_cmp="
103 tr -d '\0' <actual.raw >actual &&
104 - >expect.err &&
105 - test_cmp expect.err actual.err &&
104 + test_must_be_empty actual.err &&
105 test_cmp expect actual"
106
107 if test "$match_expect" = 'E'
t/t3201-branch-contains.sh
+5 -10
@@ -48,16 +48,14 @@ test_expect_success 'branch --contains master' '
48 test_expect_success 'branch --no-contains=master' '
49
50 git branch --no-contains=master >actual &&
51 - >expect &&
52 - test_cmp expect actual
51 + test_must_be_empty actual
52
53 '
54
55 test_expect_success 'branch --no-contains master' '
56
57 git branch --no-contains master >actual &&
59 - >expect &&
60 - test_cmp expect actual
58 + test_must_be_empty actual
59
60 '
61
@@ -94,8 +92,7 @@ test_expect_success 'branch --contains with pattern implies --list' '
92 test_expect_success 'branch --no-contains with pattern implies --list' '
93
94 git branch --no-contains=master master >actual &&
97 - >expect &&
98 - test_cmp expect actual
95 + test_must_be_empty actual
96
97 '
98
@@ -123,8 +120,7 @@ test_expect_success 'branch --merged with pattern implies --list' '
120 test_expect_success 'side: branch --no-merged' '
121
122 git branch --no-merged >actual &&
126 - >expect &&
127 - test_cmp expect actual
123 + test_must_be_empty actual
124
125 '
126
@@ -152,8 +148,7 @@ test_expect_success 'master: branch --no-merged' '
148 test_expect_success 'branch --no-merged with pattern implies --list' '
149
150 git branch --no-merged=master master >actual &&
155 - >expect &&
156 - test_cmp expect actual
151 + test_must_be_empty actual
152
153 '
154
t/t3700-add.sh
+1 -2
@@ -188,9 +188,8 @@ test_expect_success 'git add --refresh with pathspec' '
188 git add foo bar baz && H=$(git rev-parse :foo) && git rm -f foo &&
189 echo "100644 $H 3 foo" | git update-index --index-info &&
190 test-tool chmtime -60 bar baz &&
191 - >expect &&
191 git add --refresh bar >actual &&
193 - test_cmp expect actual &&
192 + test_must_be_empty actual &&
193
194 git diff-files --name-only >actual &&
195 ! grep bar actual&&
t/t3910-mac-os-precompose.sh
+1 -2
@@ -187,9 +187,8 @@ test_expect_failure 'handle existing decomposed filenames' '
187 echo content >"verbatim.$Adiarnfd" &&
188 git -c core.precomposeunicode=false add "verbatim.$Adiarnfd" &&
189 git commit -m "existing decomposed file" &&
190 - >expect &&
190 git ls-files --exclude-standard -o "verbatim*" >untracked &&
192 - test_cmp expect untracked
191 + test_must_be_empty untracked
192 '
193
194 # Test if the global core.precomposeunicode stops autosensing
t/t4010-diff-pathspec.sh
+1 -2
@@ -74,8 +74,7 @@ test_expect_success 'diff-tree pathspec' '
74 tree2=$(git write-tree) &&
75 echo "$tree2" &&
76 git diff-tree -r --name-only $tree $tree2 -- pa path1/a >current &&
77 - >expected &&
78 - test_cmp expected current
77 + test_must_be_empty current
78 '
79
80 test_expect_success 'diff-tree with wildcard shows dir also matches' '
t/t4015-diff-whitespace.sh
+7 -10
@@ -93,21 +93,20 @@ test_expect_success 'another test, without options' '
93 git diff >out &&
94 test_cmp expect out &&
95
96 - >expect &&
96 git diff -w >out &&
98 - test_cmp expect out &&
97 + test_must_be_empty out &&
98
99 git diff -w -b >out &&
101 - test_cmp expect out &&
100 + test_must_be_empty out &&
101
102 git diff -w --ignore-space-at-eol >out &&
104 - test_cmp expect out &&
103 + test_must_be_empty out &&
104
105 git diff -w -b --ignore-space-at-eol >out &&
107 - test_cmp expect out &&
106 + test_must_be_empty out &&
107
108 git diff -w --ignore-cr-at-eol >out &&
110 - test_cmp expect out &&
109 + test_must_be_empty out &&
110
111 tr "Q_" "\015 " <<-\EOF >expect &&
112 diff --git a/x b/x
@@ -182,8 +181,7 @@ test_expect_success 'ignore-blank-lines: only new lines' '
181 test_seq 5 | sed "/3/i\\
182 " >x &&
183 git diff --ignore-blank-lines >out &&
185 - >expect &&
186 - test_cmp expect out
184 + test_must_be_empty out
185 '
186
187 test_expect_success 'ignore-blank-lines: only new lines with space' '
@@ -192,8 +190,7 @@ test_expect_success 'ignore-blank-lines: only new lines with space' '
190 test_seq 5 | sed "/3/i\\
191 " >x &&
192 git diff -w --ignore-blank-lines >out &&
195 - >expect &&
196 - test_cmp expect out
193 + test_must_be_empty out
194 '
195
196 test_expect_success 'ignore-blank-lines: after change' '
t/t4039-diff-assume-unchanged.sh
+1 -2
@@ -34,9 +34,8 @@ test_expect_success POSIXPERM 'find-copies-harder is not confused by mode bits'
34 git add exec &&
35 git commit -m exec &&
36 git update-index --assume-unchanged exec &&
37 - >expect &&
37 git diff-files --find-copies-harder -- exec >actual &&
39 - test_cmp expect actual
38 + test_must_be_empty actual
39 '
40
41 test_done
t/t4200-rerere.sh
+3 -6
@@ -267,8 +267,7 @@ rerere_gc_custom_expiry_test () {
267 git -c "gc.rerereresolved=$right_now" \
268 -c "gc.rerereunresolved=$right_now" rerere gc &&
269 find .git/rr-cache -type f | sort >actual &&
270 - >expect &&
271 - test_cmp expect actual
270 + test_must_be_empty actual
271 '
272 }
273
@@ -536,9 +535,8 @@ test_expect_success 'multiple identical conflicts' '
535
536 # We resolved file1 and file2
537 git rerere &&
539 - >expect &&
538 git rerere remaining >actual &&
541 - test_cmp expect actual &&
539 + test_must_be_empty actual &&
540
541 # We must have recorded both of them
542 count_pre_post 2 2 &&
@@ -548,9 +546,8 @@ test_expect_success 'multiple identical conflicts' '
546 test_must_fail git merge six.1 &&
547 git rerere &&
548
551 - >expect &&
549 git rerere remaining >actual &&
553 - test_cmp expect actual &&
550 + test_must_be_empty actual &&
551
552 concat_insert short 6.1 6.2 >file1.expect &&
553 concat_insert long 6.1 6.2 >file2.expect &&
t/t4202-log.sh
+2 -4
@@ -340,10 +340,9 @@ test_expect_success PCRE 'log -F -E --perl-regexp --grep=<pcre> uses PCRE' '
340 '
341
342 test_expect_success 'log with grep.patternType configuration' '
343 - >expect &&
343 git -c grep.patterntype=fixed \
344 log -1 --pretty=tformat:%s --grep=s.c.nd >actual &&
346 - test_cmp expect actual
345 + test_must_be_empty actual
346 '
347
348 test_expect_success 'log with grep.patternType configuration and command line' '
@@ -1625,9 +1624,8 @@ test_expect_success 'log diagnoses bogus HEAD' '
1624 '
1625
1626 test_expect_success 'log does not default to HEAD when rev input is given' '
1628 - >expect &&
1627 git log --branches=does-not-exist >actual &&
1630 - test_cmp expect actual
1628 + test_must_be_empty actual
1629 '
1630
1631 test_expect_success 'set up --source tests' '
t/t4210-log-i18n.sh
+2 -4
@@ -44,15 +44,13 @@ test_expect_success !MINGW 'log --grep searches in log output encoding (latin1)'
44 '
45
46 test_expect_success !MINGW 'log --grep does not find non-reencoded values (utf8)' '
47 - >expect &&
47 git log --encoding=utf8 --format=%s --grep=$latin1_e >actual &&
49 - test_cmp expect actual
48 + test_must_be_empty actual
49 '
50
51 test_expect_success 'log --grep does not find non-reencoded values (latin1)' '
53 - >expect &&
52 git log --encoding=ISO-8859-1 --format=%s --grep=$utf8_e >actual &&
55 - test_cmp expect actual
53 + test_must_be_empty actual
54 '
55
56 test_done
t/t5310-pack-bitmaps.sh
+3 -6
@@ -309,9 +309,8 @@ test_expect_success 'pack reuse respects --honor-pack-keep' '
309 done &&
310 reusable_pack --honor-pack-keep >empty.pack &&
311 git index-pack empty.pack &&
312 - >expect &&
312 git show-index <empty.idx >actual &&
314 - test_cmp expect actual
313 + test_must_be_empty actual
314 '
315
316 test_expect_success 'pack reuse respects --local' '
@@ -319,17 +318,15 @@ test_expect_success 'pack reuse respects --local' '
318 test_when_finished "mv alt.git/objects/pack/* .git/objects/pack/" &&
319 reusable_pack --local >empty.pack &&
320 git index-pack empty.pack &&
322 - >expect &&
321 git show-index <empty.idx >actual &&
324 - test_cmp expect actual
322 + test_must_be_empty actual
323 '
324
325 test_expect_success 'pack reuse respects --incremental' '
326 reusable_pack --incremental >empty.pack &&
327 git index-pack empty.pack &&
330 - >expect &&
328 git show-index <empty.idx >actual &&
332 - test_cmp expect actual
329 + test_must_be_empty actual
330 '
331
332 test_expect_success 'truncated bitmap fails gracefully' '
t/t5313-pack-bounds-checks.sh
+1 -2
@@ -90,9 +90,8 @@ test_expect_success 'matched bogus object count' '
90
91 # Unlike above, we should notice early that the .idx is totally
92 # bogus, and not even enumerate its contents.
93 - >expect &&
93 git cat-file --batch-all-objects --batch-check >actual &&
95 - test_cmp expect actual &&
94 + test_must_be_empty actual &&
95
96 # But as before, we can do the same object-access checks.
97 test_must_fail git cat-file blob $object &&
t/t5505-remote.sh
+2 -4
@@ -74,8 +74,7 @@ test_expect_success 'add another remote' '
74 git for-each-ref "--format=%(refname)" refs/remotes |
75 sed -e "/^refs\/remotes\/origin\//d" \
76 -e "/^refs\/remotes\/second\//d" >actual &&
77 - >expect &&
78 - test_cmp expect actual
77 + test_must_be_empty actual
78 )
79 '
80
@@ -112,8 +111,7 @@ test_expect_success C_LOCALE_OUTPUT 'remove remote' '
111 check_remote_track origin master side &&
112 git for-each-ref "--format=%(refname)" refs/remotes |
113 sed -e "/^refs\/remotes\/origin\//d" >actual &&
115 - >expect &&
116 - test_cmp expect actual
114 + test_must_be_empty actual
115 )
116 '
117
t/t5512-ls-remote.sh
+2 -4
@@ -155,14 +155,12 @@ test_expect_success 'die with non-2 for wrong repository even with --exit-code'
155
156 test_expect_success 'Report success even when nothing matches' '
157 git ls-remote other.git "refs/nsn/*" >actual &&
158 - >expect &&
159 - test_cmp expect actual
158 + test_must_be_empty actual
159 '
160
161 test_expect_success 'Report no-match with --exit-code' '
162 test_expect_code 2 git ls-remote --exit-code other.git "refs/nsn/*" >actual &&
164 - >expect &&
165 - test_cmp expect actual
163 + test_must_be_empty actual
164 '
165
166 test_expect_success 'Report match with --exit-code' '
t/t5514-fetch-multiple.sh
+1 -2
@@ -152,7 +152,6 @@ test_expect_success 'git fetch --multiple (ignoring skipFetchAll)' '
152 '
153
154 test_expect_success 'git fetch --all --no-tags' '
155 - >expect &&
155 git clone one test5 &&
156 git clone test5 test6 &&
157 (cd test5 && git tag test-tag) &&
@@ -161,7 +160,7 @@ test_expect_success 'git fetch --all --no-tags' '
160 git fetch --all --no-tags &&
161 git tag >output
162 ) &&
164 - test_cmp expect test6/output
163 + test_must_be_empty test6/output
164 '
165
166 test_expect_success 'git fetch --all --tags' '
t/t5533-push-cas.sh
+2 -4
@@ -142,9 +142,8 @@ test_expect_success 'push to delete (protected, forced)' '
142 cd dst &&
143 git push --force --force-with-lease=master:master^ origin :master
144 ) &&
145 - >expect &&
145 git ls-remote src refs/heads/master >actual &&
147 - test_cmp expect actual
146 + test_must_be_empty actual
147 '
148
149 test_expect_success 'push to delete (allowed)' '
@@ -154,9 +153,8 @@ test_expect_success 'push to delete (allowed)' '
153 git push --force-with-lease=master origin :master 2>err &&
154 grep deleted err
155 ) &&
157 - >expect &&
156 git ls-remote src refs/heads/master >actual &&
159 - test_cmp expect actual
157 + test_must_be_empty actual
158 '
159
160 test_expect_success 'cover everything with default force-with-lease (protected)' '
t/t5612-clone-refspec.sh
+3 -6
@@ -97,8 +97,7 @@ test_expect_success 'clone with --no-tags' '
97 git fetch &&
98 git for-each-ref refs/tags >../actual
99 ) &&
100 - >expect &&
101 - test_cmp expect actual
100 + test_must_be_empty actual
101 '
102
103 test_expect_success '--single-branch while HEAD pointing at master' '
@@ -140,8 +139,7 @@ test_expect_success '--single-branch while HEAD pointing at master and --no-tags
139 git fetch &&
140 git for-each-ref refs/tags >../actual
141 ) &&
143 - >expect &&
144 - test_cmp expect actual &&
142 + test_must_be_empty actual &&
143 test_line_count = 0 actual &&
144 # get tags with --tags overrides tagOpt
145 (
@@ -230,8 +228,7 @@ test_expect_success '--single-branch with detached' '
228 -e "s|/remotes/origin/|/heads/|" >../actual
229 ) &&
230 # nothing
233 - >expect &&
234 - test_cmp expect actual
231 + test_must_be_empty actual
232 '
233
234 test_done
t/t6000-rev-list-misc.sh
+1 -2
@@ -58,8 +58,7 @@ test_expect_success 'rev-list A..B and rev-list ^A B are the same' '
58
59 test_expect_success 'propagate uninteresting flag down correctly' '
60 git rev-list --objects ^HEAD^{tree} HEAD^{tree} >actual &&
61 - >expect &&
62 - test_cmp expect actual
61 + test_must_be_empty actual
62 '
63
64 test_expect_success 'symleft flag bit is propagated down from tag' '
t/t6009-rev-list-parent.sh
+2 -4
@@ -31,8 +31,7 @@ test_expect_success setup '
31 test_expect_success 'one is ancestor of others and should not be shown' '
32
33 git rev-list one --not four >result &&
34 - >expect &&
35 - test_cmp expect result
34 + test_must_be_empty result
35
36 '
37
@@ -144,8 +143,7 @@ test_expect_success 'ancestors with the same commit time' '
143 test_commit t$i
144 done &&
145 git rev-list t1^! --not t$i >result &&
147 - >expect &&
148 - test_cmp expect result
146 + test_must_be_empty result
147 '
148
149 test_done
t/t6018-rev-list-glob.sh
+4 -8
@@ -256,31 +256,27 @@ test_expect_success 'rev-list accumulates multiple --exclude' '
256 '
257
258 test_expect_failure 'rev-list should succeed with empty output on empty stdin' '
259 - >expect &&
259 git rev-list --stdin <expect >actual &&
261 - test_cmp expect actual
260 + test_must_be_empty actual
261 '
262
263 test_expect_success 'rev-list should succeed with empty output with all refs excluded' '
265 - >expect &&
264 git rev-list --exclude=* --all >actual &&
267 - test_cmp expect actual
265 + test_must_be_empty actual
266 '
267
268 test_expect_success 'rev-list should succeed with empty output with empty --all' '
269 (
270 test_create_repo empty &&
271 cd empty &&
274 - >expect &&
272 git rev-list --all >actual &&
276 - test_cmp expect actual
273 + test_must_be_empty actual
274 )
275 '
276
277 test_expect_success 'rev-list should succeed with empty output with empty glob' '
281 - >expect &&
278 git rev-list --glob=does-not-match-anything >actual &&
283 - test_cmp expect actual
279 + test_must_be_empty actual
280 '
281
282 test_expect_success 'shortlog accepts --glob/--tags/--remotes' '
t/t6019-rev-list-ancestry-path.sh
+1 -2
@@ -95,10 +95,9 @@ test_expect_success 'rev-list --ancestry-path F...I' '
95
96 # G.t is dropped in an "-s ours" merge
97 test_expect_success 'rev-list G..M -- G.t' '
98 - >expect &&
98 git rev-list --format=%s G..M -- G.t |
99 sed -e "/^commit /d" >actual &&
101 - test_cmp expect actual
100 + test_must_be_empty actual
101 '
102
103 test_expect_success 'rev-list --ancestry-path G..M -- G.t' '
t/t6022-merge-rename.sh
+1 -2
@@ -893,8 +893,7 @@ test_expect_success 'do not follow renames for empty files' '
893 git mv empty1 empty2 &&
894 git commit -m rename &&
895 test_must_fail git merge empty-base &&
896 - >expect &&
897 - test_cmp expect empty2
896 + test_must_be_empty empty2
897 '
898
899 test_done
t/t6060-merge-index.sh
+1 -2
@@ -44,8 +44,7 @@ test_expect_success 'read-tree does not resolve content merge' '
44 test_expect_success 'git merge-index git-merge-one-file resolves' '
45 git merge-index git-merge-one-file -a &&
46 git diff-files --name-only --diff-filter=U >unmerged &&
47 - >expect &&
48 - test_cmp expect unmerged &&
47 + test_must_be_empty unmerged &&
48 test_cmp expect-merged file &&
49 git cat-file blob :file >file-index &&
50 test_cmp expect-merged file-index
t/t6300-for-each-ref.sh
+1 -2
@@ -796,9 +796,8 @@ test_expect_success ':remotename and :remoteref' '
796 '
797
798 test_expect_success 'for-each-ref --ignore-case ignores case' '
799 - >expect &&
799 git for-each-ref --format="%(refname)" refs/heads/MASTER >actual &&
801 - test_cmp expect actual &&
800 + test_must_be_empty actual &&
801
802 echo refs/heads/master >expect &&
803 git for-each-ref --format="%(refname)" --ignore-case \
t/t7004-tag.sh
+8 -14
@@ -693,9 +693,8 @@ test_expect_success \
693 '
694
695 test_expect_success 'The -n 100 invocation means -n --list 100, not -n100' '
696 - >expect &&
696 git tag -n 100 >actual &&
698 - test_cmp expect actual &&
697 + test_must_be_empty actual &&
698
699 git tag -m "A msg" 100 &&
700 echo "100 A msg" >expect &&
@@ -974,9 +973,8 @@ test_expect_success GPG 'verifying a proper tag with --format pass and format ac
973 '
974
975 test_expect_success GPG 'verifying a forged tag with --format should fail silently' '
977 - >expect &&
976 test_must_fail git tag -v --format="tagname : %(tag)" "forged-tag" >actual &&
979 - test_cmp expect actual
977 + test_must_be_empty actual
978 '
979
980 # blank and empty messages for signed tags:
@@ -1382,9 +1380,8 @@ test_expect_success 'message in editor has initial comment: first line' '
1380 test_expect_success \
1381 'message in editor has initial comment: remainder' '
1382 # remove commented lines from the remainder -- should be empty
1385 - >rest.expect &&
1383 sed -e 1d -e "/^#/d" <actual >rest.actual &&
1387 - test_cmp rest.expect rest.actual
1384 + test_must_be_empty rest.actual
1385 '
1386
1387 get_tag_header reuse $commit commit $time >expect
@@ -1466,19 +1463,18 @@ test_expect_success 'checking that first commit is in all tags (relative)' "
1463
1464 # All the --contains tests above, but with --no-contains
1465 test_expect_success 'checking that first commit is not listed in any tag with --no-contains (hash)' "
1469 - >expected &&
1466 git tag -l --no-contains $hash1 v* >actual &&
1471 - test_cmp expected actual
1467 + test_must_be_empty actual
1468 "
1469
1470 test_expect_success 'checking that first commit is in all tags (tag)' "
1471 git tag -l --no-contains v1.0 v* >actual &&
1476 - test_cmp expected actual
1472 + test_must_be_empty actual
1473 "
1474
1475 test_expect_success 'checking that first commit is in all tags (relative)' "
1476 git tag -l --no-contains HEAD~2 v* >actual &&
1481 - test_cmp expected actual
1477 + test_must_be_empty actual
1478 "
1479
1480 cat > expected <<EOF
@@ -1606,9 +1602,8 @@ test_expect_success 'checking that --contains can be used in non-list mode' '
1602 '
1603
1604 test_expect_success 'checking that initial commit is in all tags with --no-contains' "
1609 - >expected &&
1605 git tag -l --no-contains $hash1 v* >actual &&
1611 - test_cmp expected actual
1606 + test_must_be_empty actual
1607 "
1608
1609 # mixing modes and options:
@@ -1905,7 +1900,6 @@ test_expect_success 'version sort with very long prerelease suffix' '
1900 '
1901
1902 test_expect_success ULIMIT_STACK_SIZE '--contains and --no-contains work in a deep repo' '
1908 - >expect &&
1903 i=1 &&
1904 while test $i -lt 8000
1905 do
@@ -1920,7 +1914,7 @@ EOF"
1914 git checkout master &&
1915 git tag far-far-away HEAD^ &&
1916 run_with_limited_stack git tag --contains HEAD >actual &&
1923 - test_cmp expect actual &&
1917 + test_must_be_empty actual &&
1918 run_with_limited_stack git tag --no-contains HEAD >actual &&
1919 test_line_count "-gt" 10 actual
1920 '
t/t7006-pager.sh
+1 -2
@@ -626,12 +626,11 @@ test_expect_success TTY 'sub-commands of externals use their own pager' '
626
627 test_expect_success TTY 'external command pagers override sub-commands' '
628 sane_unset PAGER GIT_PAGER &&
629 - >expect &&
629 >actual &&
630 test_config pager.external false &&
631 test_config pager.log "sed s/^/log:/ >actual" &&
632 test_terminal git --exec-path=. external log --format=%s -1 &&
634 - test_cmp expect actual
633 + test_must_be_empty actual
634 '
635
636 test_expect_success 'command with underscores does not complain' '
t/t7030-verify-tag.sh
+1 -2
@@ -134,9 +134,8 @@ test_expect_success GPG 'verifying tag with --format' '
134 '
135
136 test_expect_success GPG 'verifying a forged tag with --format should fail silently' '
137 - >expect &&
137 test_must_fail git verify-tag --format="tagname : %(tag)" $(cat forged1.tag) >actual-forged &&
139 - test_cmp expect actual-forged
138 + test_must_be_empty actual-forged
139 '
140
141 test_done
t/t7063-status-untracked-cache.sh
+1 -2
@@ -26,9 +26,8 @@ avoid_racy() {
26 }
27
28 status_is_clean() {
29 - >../status.expect &&
29 git status --porcelain >../status.actual &&
31 - test_cmp ../status.expect ../status.actual
30 + test_must_be_empty ../status.actual
31 }
32
33 test_lazy_prereq UNTRACKED_CACHE '
t/t7102-reset.sh
+2 -4
@@ -549,8 +549,7 @@ test_expect_success 'reset -N keeps removed files as intent-to-add' '
549
550 tree=$(git write-tree) &&
551 git ls-tree $tree new-file >actual &&
552 - >expect &&
553 - test_cmp expect actual &&
552 + test_must_be_empty actual &&
553
554 git diff --name-only >actual &&
555 echo new-file >expect &&
@@ -563,9 +562,8 @@ test_expect_success 'reset --mixed sets up work tree' '
562 cd mixed_worktree &&
563 test_commit dummy
564 ) &&
566 - : >expect &&
565 git --git-dir=mixed_worktree/.git --work-tree=mixed_worktree reset >actual &&
568 - test_cmp expect actual
566 + test_must_be_empty actual
567 '
568
569 test_done
t/t7106-reset-unborn-branch.sh
+3 -6
@@ -12,9 +12,8 @@ test_expect_success 'reset' '
12 git add a b &&
13 git reset &&
14
15 - >expect &&
15 git ls-files >actual &&
17 - test_cmp expect actual
16 + test_must_be_empty actual
17 '
18
19 test_expect_success 'reset HEAD' '
@@ -39,9 +38,8 @@ test_expect_success PERL 'reset -p' '
38 echo y >yes &&
39 git reset -p <yes >output &&
40
42 - >expect &&
41 git ls-files >actual &&
44 - test_cmp expect actual &&
42 + test_must_be_empty actual &&
43 test_i18ngrep "Unstage" output
44 '
45
@@ -61,9 +59,8 @@ test_expect_success 'reset --hard' '
59 test_when_finished "echo a >a" &&
60 git reset --hard &&
61
64 - >expect &&
62 git ls-files >actual &&
66 - test_cmp expect actual &&
63 + test_must_be_empty actual &&
64 test_path_is_missing a
65 '
66
t/t7401-submodule-summary.sh
+1 -2
@@ -64,8 +64,7 @@ test_expect_success 'added submodule (subdirectory only)' "
64 cd sub &&
65 git submodule summary . >../actual
66 ) &&
67 - >expected &&
68 - test_cmp expected actual
67 + test_must_be_empty actual
68 "
69
70 test_expect_success 'added submodule (subdirectory with explicit path)' "
t/t7502-commit.sh
+1 -2
@@ -393,7 +393,6 @@ EOF
393
394 test_expect_success !AUTOIDENT 'do not fire editor when committer is bogus' '
395 >.git/result &&
396 - >expect &&
396
397 echo >>negative &&
398 (
@@ -403,7 +402,7 @@ test_expect_success !AUTOIDENT 'do not fire editor when committer is bogus' '
402 export GIT_EDITOR &&
403 test_must_fail git commit -e -m sample -a
404 ) &&
406 - test_cmp expect .git/result
405 + test_must_be_empty .git/result
406 '
407
408 test_expect_success 'do not fire editor if -m <msg> was given' '
t/t7610-mergetool.sh
+1 -2
@@ -620,8 +620,7 @@ test_expect_success 'file with no base' '
620 git checkout -b test$test_count branch1 &&
621 test_must_fail git merge master &&
622 git mergetool --no-prompt --tool mybase -- both &&
623 - >expected &&
624 - test_cmp expected both
623 + test_must_be_empty both
624 '
625
626 test_expect_success 'custom commands override built-ins' '
t/t7810-grep.sh
+1 -2
@@ -676,8 +676,7 @@ test_expect_success 'log grep (5)' '
676
677 test_expect_success 'log grep (6)' '
678 git log --author=-0700 --pretty=tformat:%s >actual &&
679 - >expect &&
680 - test_cmp expect actual
679 + test_must_be_empty actual
680 '
681
682 test_expect_success 'log grep (7)' '
t/t9001-send-email.sh
+1 -2
@@ -253,10 +253,9 @@ test_suppress_self () {
253
254 mv msgtxt1 msgtxt1-$3 &&
255 sed -e '/^$/q' msgtxt1-$3 >"msghdr1-$3" &&
256 - >"expected-no-cc-$3" &&
256
257 (grep '^Cc:' msghdr1-$3 >"actual-no-cc-$3";
259 - test_cmp expected-no-cc-$3 actual-no-cc-$3)
258 + test_must_be_empty actual-no-cc-$3)
259 }
260
261 test_suppress_self_unquoted () {
t/t9300-fast-import.sh
+2 -5
@@ -2191,12 +2191,11 @@ test_expect_success 'R: --import-marks-if-exists' '
2191
2192 test_expect_success 'R: feature import-marks-if-exists' '
2193 rm -f io.marks &&
2194 - >expect &&
2194
2195 git fast-import --export-marks=io.marks <<-\EOF &&
2196 feature import-marks-if-exists=not_io.marks
2197 EOF
2199 - test_cmp expect io.marks &&
2198 + test_must_be_empty io.marks &&
2199
2200 blob=$(echo hi | git hash-object --stdin) &&
2201
@@ -2227,13 +2226,11 @@ test_expect_success 'R: feature import-marks-if-exists' '
2226 EOF
2227 test_cmp expect io.marks &&
2228
2230 - >expect &&
2231 -
2229 git fast-import --import-marks-if-exists=not_io.marks \
2230 --export-marks=io.marks <<-\EOF &&
2231 feature import-marks-if-exists=io.marks
2232 EOF
2236 - test_cmp expect io.marks
2233 + test_must_be_empty io.marks
2234 '
2235
2236 test_expect_success 'R: import to output marks works without any content' '