tests: use 'test_must_be_empty' instead of '! test -s'

Using 'test_must_be_empty' is preferable to '! test -s', because it gives a helpful error message if the given file is unexpectedly not empty, while the latter remains completely silent. Furthermore, it also catches cases when the given file unexpectedly does not exist at all. This patch was basically created by: sed -i -e 's/! test -s/test_must_be_empty/' t[0-9]*.sh with the following notable exceptions: - The '! test -s' check in '.gitmodules ignore=dirty suppresses submodules with untracked content' in 't7508-status.sh' is left as-is, because it's bogus and, therefore, it's subject of a dedicated patch. - The '! test -s' checks in 't9131-git-svn-empty-symlink.sh' and 't9135-git-svn-moved-branch-empty-file.sh' are immediately preceeded by a 'test -f' to ensure that the files exist in the first place. 'test_must_be_empty' ensures that as well, so those 'test -f' commands are removed as well. Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

SZEDER Gábor committed Aug 19, 2018 at 23:57 UTC ec10b018e76b3f4f40db96a24202c6b8c056bd0f
25 files changed +98 -99
t/t0000-basic.sh
+1 -1
@@ -116,7 +116,7 @@ check_sub_test_lib_test () {
116 name="$1" # stdin is the expected output from the test
117 (
118 cd "$name" &&
119 - ! test -s err &&
119 + test_must_be_empty err &&
120 sed -e 's/^> //' -e 's/Z$//' >expect &&
121 test_cmp expect out
122 )
t/t0090-cache-tree.sh
+1 -1
@@ -239,7 +239,7 @@ test_expect_success 'no phantom error when switching trees' '
239 >newdir/one &&
240 git add newdir/one &&
241 git checkout 2>errors &&
242 - ! test -s errors
242 + test_must_be_empty errors
243 '
244
245 test_expect_success 'switching trees does not invalidate shared index' '
t/t0203-gettext-setlocale-sanity.sh
+2 -2
@@ -11,7 +11,7 @@ test_expect_success 'git show a ISO-8859-1 commit under C locale' '
11 . "$TEST_DIRECTORY"/t3901/8859-1.txt &&
12 test_commit "iso-c-commit" iso-under-c &&
13 git show >out 2>err &&
14 - ! test -s err &&
14 + test_must_be_empty err &&
15 grep -q "iso-c-commit" out
16 '
17
@@ -19,7 +19,7 @@ test_expect_success GETTEXT_LOCALE 'git show a ISO-8859-1 commit under a UTF-8 l
19 . "$TEST_DIRECTORY"/t3901/8859-1.txt &&
20 test_commit "iso-utf8-commit" iso-under-utf8 &&
21 LANGUAGE=is LC_ALL="$is_IS_locale" git show >out 2>err &&
22 - ! test -s err &&
22 + test_must_be_empty err &&
23 grep -q "iso-utf8-commit" out
24 '
25
t/t1501-work-tree.sh
+1 -1
@@ -41,7 +41,7 @@ test_expect_success 'setup: helper for testing rev-parse' '
41 # rev-parse --show-prefix should output
42 # a single newline when at the top of the work tree,
43 # but we test for that separately.
44 - test -z "$4" && ! test -s actual.prefix ||
44 + test -z "$4" && test_must_be_empty actual.prefix ||
45 test_cmp expected.prefix actual.prefix
46 fi
47 }
t/t1510-repo-setup.sh
+12 -12
@@ -234,14 +234,14 @@ test_expect_success '#0: nonbare repo, no explicit configuration' '
234 try_repo 0 unset unset unset "" unset \
235 .git "$here/0" "$here/0" "(null)" \
236 .git "$here/0" "$here/0" sub/ 2>message &&
237 - ! test -s message
237 + test_must_be_empty message
238 '
239
240 test_expect_success '#1: GIT_WORK_TREE without explicit GIT_DIR is accepted' '
241 try_repo 1 "$here" unset unset "" unset \
242 "$here/1/.git" "$here" "$here" 1/ \
243 "$here/1/.git" "$here" "$here" 1/sub/ 2>message &&
244 - ! test -s message
244 + test_must_be_empty message
245 '
246
247 test_expect_success '#2: worktree defaults to cwd with explicit GIT_DIR' '
@@ -268,7 +268,7 @@ test_expect_success '#4: core.worktree without GIT_DIR set is accepted' '
268 try_case 4 unset unset \
269 .git "$here/4/sub" "$here/4" "(null)" \
270 "$here/4/.git" "$here/4/sub" "$here/4/sub" "(null)" 2>message &&
271 - ! test -s message
271 + test_must_be_empty message
272 '
273
274 test_expect_success '#5: core.worktree + GIT_WORK_TREE is accepted' '
@@ -279,7 +279,7 @@ test_expect_success '#5: core.worktree + GIT_WORK_TREE is accepted' '
279 try_repo 5a .. unset "$here/5a" "" unset \
280 "$here/5a/.git" "$here" "$here" 5a/ \
281 "$here/5a/.git" "$here/5a" "$here/5a" sub/ &&
282 - ! test -s message
282 + test_must_be_empty message
283 '
284
285 test_expect_success '#6: setting GIT_DIR brings core.worktree to life' '
@@ -376,7 +376,7 @@ test_expect_success '#9: GIT_WORK_TREE accepted with gitfile' '
376 try_repo 9 wt unset unset gitfile unset \
377 "$here/9.git" "$here/9/wt" "$here/9" "(null)" \
378 "$here/9.git" "$here/9/sub/wt" "$here/9/sub" "(null)" 2>message &&
379 - ! test -s message
379 + test_must_be_empty message
380 '
381
382 test_expect_success '#10: GIT_DIR can point to gitfile' '
@@ -402,7 +402,7 @@ test_expect_success '#12: core.worktree with gitfile is accepted' '
402 try_repo 12 unset unset "$here/12" gitfile unset \
403 "$here/12.git" "$here/12" "$here/12" "(null)" \
404 "$here/12.git" "$here/12" "$here/12" sub/ 2>message &&
405 - ! test -s message
405 + test_must_be_empty message
406 '
407
408 test_expect_success '#13: core.worktree+GIT_WORK_TREE accepted (with gitfile)' '
@@ -410,7 +410,7 @@ test_expect_success '#13: core.worktree+GIT_WORK_TREE accepted (with gitfile)' '
410 try_repo 13 non-existent-too unset non-existent gitfile unset \
411 "$here/13.git" "$here/13/non-existent-too" "$here/13" "(null)" \
412 "$here/13.git" "$here/13/sub/non-existent-too" "$here/13/sub" "(null)" 2>message &&
413 - ! test -s message
413 + test_must_be_empty message
414 '
415
416 # case #14.
@@ -565,7 +565,7 @@ test_expect_success '#17: GIT_WORK_TREE without explicit GIT_DIR is accepted (ba
565 try_repo 17c "$here/17c" unset unset "" true \
566 .git "$here/17c" "$here/17c" "(null)" \
567 "$here/17c/.git" "$here/17c" "$here/17c" sub/ 2>message &&
568 - ! test -s message
568 + test_must_be_empty message
569 '
570
571 test_expect_success '#18: bare .git named by GIT_DIR has no worktree' '
@@ -594,7 +594,7 @@ test_expect_success '#20a: core.worktree without GIT_DIR accepted (inside .git)'
594 "$here/20a/.git" "$here/20a" "$here/20a" .git/wt/ &&
595 try_case 20a/.git/wt/sub unset unset \
596 "$here/20a/.git" "$here/20a" "$here/20a" .git/wt/sub/ &&
597 - ! test -s message
597 + test_must_be_empty message
598 '
599
600 test_expect_success '#20b/c: core.worktree and core.bare conflict' '
@@ -626,7 +626,7 @@ test_expect_success '#21: setup, core.worktree warns before overriding core.bare
626 export GIT_WORK_TREE &&
627 git status >/dev/null
628 ) 2>message &&
629 - ! test -s message
629 + test_must_be_empty message
630
631 '
632 run_wt_tests 21
@@ -742,7 +742,7 @@ test_expect_success '#25: GIT_WORK_TREE accepted if GIT_DIR unset (bare gitfile
742 try_repo 25 "$here/25" unset unset gitfile true \
743 "$here/25.git" "$here/25" "$here/25" "(null)" \
744 "$here/25.git" "$here/25" "$here/25" "sub/" 2>message &&
745 - ! test -s message
745 + test_must_be_empty message
746 '
747
748 test_expect_success '#26: bare repo has no worktree (GIT_DIR -> gitfile case)' '
@@ -780,7 +780,7 @@ test_expect_success '#29: setup' '
780 export GIT_WORK_TREE &&
781 git status
782 ) 2>message &&
783 - ! test -s message
783 + test_must_be_empty message
784 '
785 run_wt_tests 29 gitfile
786
t/t2013-checkout-submodule.sh
+3 -3
@@ -44,7 +44,7 @@ test_expect_success '"checkout <submodule>" honors diff.ignoreSubmodules' '
44 git config diff.ignoreSubmodules dirty &&
45 echo x> submodule/untracked &&
46 git checkout HEAD >actual 2>&1 &&
47 - ! test -s actual
47 + test_must_be_empty actual
48 '
49
50 test_expect_success '"checkout <submodule>" honors submodule.*.ignore from .gitmodules' '
@@ -52,7 +52,7 @@ test_expect_success '"checkout <submodule>" honors submodule.*.ignore from .gitm
52 git config -f .gitmodules submodule.submodule.path submodule &&
53 git config -f .gitmodules submodule.submodule.ignore untracked &&
54 git checkout HEAD >actual 2>&1 &&
55 - ! test -s actual
55 + test_must_be_empty actual
56 '
57
58 test_expect_success '"checkout <submodule>" honors submodule.*.ignore from .git/config' '
@@ -60,7 +60,7 @@ test_expect_success '"checkout <submodule>" honors submodule.*.ignore from .git/
60 git config submodule.submodule.path submodule &&
61 git config submodule.submodule.ignore all &&
62 git checkout HEAD >actual 2>&1 &&
63 - ! test -s actual
63 + test_must_be_empty actual
64 '
65
66 KNOWN_FAILURE_DIRECTORY_SUBMODULE_CONFLICTS=1
t/t2204-add-ignored.sh
+4 -4
@@ -31,7 +31,7 @@ do
31 rm -f .git/index &&
32 test_must_fail git add "$i" 2>err &&
33 git ls-files "$i" >out &&
34 - ! test -s out
34 + test_must_be_empty out
35 '
36
37 test_expect_success "complaints for ignored $i output" '
@@ -42,7 +42,7 @@ do
42 rm -f .git/index &&
43 test_must_fail git add "$i" file 2>err &&
44 git ls-files "$i" >out &&
45 - ! test -s out
45 + test_must_be_empty out
46 '
47 test_expect_success "complaints for ignored $i with unignored file output" '
48 test_i18ngrep -e "Use -f if" err
@@ -57,7 +57,7 @@ do
57 cd dir &&
58 test_must_fail git add "$i" 2>err &&
59 git ls-files "$i" >out &&
60 - ! test -s out
60 + test_must_be_empty out
61 )
62 '
63
@@ -77,7 +77,7 @@ do
77 cd sub &&
78 test_must_fail git add "$i" 2>err &&
79 git ls-files "$i" >out &&
80 - ! test -s out
80 + test_must_be_empty out
81 )
82 '
83
t/t3600-rm.sh
+3 -3
@@ -382,7 +382,7 @@ test_expect_success 'rm does not complain when no .gitmodules file is found' '
382 git submodule update &&
383 git rm .gitmodules &&
384 git rm submod >actual 2>actual.err &&
385 - ! test -s actual.err &&
385 + test_must_be_empty actual.err &&
386 ! test -d submod &&
387 ! test -f submod/.git &&
388 git status -s -uno >actual &&
@@ -400,7 +400,7 @@ test_expect_success 'rm will error out on a modified .gitmodules file unless sta
400 git diff-files --quiet -- submod &&
401 git add .gitmodules &&
402 git rm submod >actual 2>actual.err &&
403 - ! test -s actual.err &&
403 + test_must_be_empty actual.err &&
404 ! test -d submod &&
405 ! test -f submod/.git &&
406 git status -s -uno >actual &&
@@ -694,7 +694,7 @@ test_expect_success 'checking out a commit after submodule removal needs manual
694 test_cmp expected actual &&
695 rm -rf submod &&
696 git status -s -uno --ignore-submodules=none >actual &&
697 - ! test -s actual
697 + test_must_be_empty actual
698 '
699
700 test_expect_success 'rm of d/f when d has become a non-directory' '
t/t4011-diff-symlink.sh
+1 -1
@@ -126,7 +126,7 @@ test_expect_success SYMLINKS 'diff symlinks with non-existing targets' '
126 ln -s take\ over brain &&
127 test_must_fail git diff --no-index pinky brain >output 2>output.err &&
128 grep narf output &&
129 - ! test -s output.err
129 + test_must_be_empty output.err
130 '
131
132 test_expect_success SYMLINKS 'setup symlinks with attributes' '
t/t4019-diff-wserror.sh
+1 -1
@@ -260,7 +260,7 @@ test_expect_success 'trailing empty lines (2)' '
260
261 echo "F -whitespace" >.gitattributes &&
262 git diff --check >output &&
263 - ! test -s output
263 + test_must_be_empty output
264
265 '
266
t/t4027-diff-submodule.sh
+13 -13
@@ -104,19 +104,19 @@ test_expect_success 'git diff HEAD with dirty submodule (work tree, refs match)'
104 expect_from_to >expect.body $subprev $subprev-dirty &&
105 test_cmp expect.body actual.body &&
106 git diff --ignore-submodules HEAD >actual2 &&
107 - ! test -s actual2 &&
107 + test_must_be_empty actual2 &&
108 git diff --ignore-submodules=untracked HEAD >actual3 &&
109 sed -e "1,/^@@/d" actual3 >actual3.body &&
110 expect_from_to >expect.body $subprev $subprev-dirty &&
111 test_cmp expect.body actual3.body &&
112 git diff --ignore-submodules=dirty HEAD >actual4 &&
113 - ! test -s actual4
113 + test_must_be_empty actual4
114 '
115
116 test_expect_success 'git diff HEAD with dirty submodule (work tree, refs match) [.gitmodules]' '
117 git config diff.ignoreSubmodules dirty &&
118 git diff HEAD >actual &&
119 - ! test -s actual &&
119 + test_must_be_empty actual &&
120 git config --add -f .gitmodules submodule.subname.ignore none &&
121 git config --add -f .gitmodules submodule.subname.path sub &&
122 git diff HEAD >actual &&
@@ -126,7 +126,7 @@ test_expect_success 'git diff HEAD with dirty submodule (work tree, refs match)
126 git config -f .gitmodules submodule.subname.ignore all &&
127 git config -f .gitmodules submodule.subname.path sub &&
128 git diff HEAD >actual2 &&
129 - ! test -s actual2 &&
129 + test_must_be_empty actual2 &&
130 git config -f .gitmodules submodule.subname.ignore untracked &&
131 git diff HEAD >actual3 &&
132 sed -e "1,/^@@/d" actual3 >actual3.body &&
@@ -134,7 +134,7 @@ test_expect_success 'git diff HEAD with dirty submodule (work tree, refs match)
134 test_cmp expect.body actual3.body &&
135 git config -f .gitmodules submodule.subname.ignore dirty &&
136 git diff HEAD >actual4 &&
137 - ! test -s actual4 &&
137 + test_must_be_empty actual4 &&
138 git config submodule.subname.ignore none &&
139 git config submodule.subname.path sub &&
140 git diff HEAD >actual &&
@@ -172,24 +172,24 @@ test_expect_success 'git diff HEAD with dirty submodule (untracked, refs match)'
172 expect_from_to >expect.body $subprev $subprev-dirty &&
173 test_cmp expect.body actual.body &&
174 git diff --ignore-submodules=all HEAD >actual2 &&
175 - ! test -s actual2 &&
175 + test_must_be_empty actual2 &&
176 git diff --ignore-submodules=untracked HEAD >actual3 &&
177 - ! test -s actual3 &&
177 + test_must_be_empty actual3 &&
178 git diff --ignore-submodules=dirty HEAD >actual4 &&
179 - ! test -s actual4
179 + test_must_be_empty actual4
180 '
181
182 test_expect_success 'git diff HEAD with dirty submodule (untracked, refs match) [.gitmodules]' '
183 git config --add -f .gitmodules submodule.subname.ignore all &&
184 git config --add -f .gitmodules submodule.subname.path sub &&
185 git diff HEAD >actual2 &&
186 - ! test -s actual2 &&
186 + test_must_be_empty actual2 &&
187 git config -f .gitmodules submodule.subname.ignore untracked &&
188 git diff HEAD >actual3 &&
189 - ! test -s actual3 &&
189 + test_must_be_empty actual3 &&
190 git config -f .gitmodules submodule.subname.ignore dirty &&
191 git diff HEAD >actual4 &&
192 - ! test -s actual4 &&
192 + test_must_be_empty actual4 &&
193 git config submodule.subname.ignore none &&
194 git config submodule.subname.path sub &&
195 git diff HEAD >actual &&
@@ -211,7 +211,7 @@ test_expect_success 'git diff between submodule commits' '
211 expect_from_to >expect.body $subtip $subprev &&
212 test_cmp expect.body actual.body &&
213 git diff --ignore-submodules HEAD^..HEAD >actual &&
214 - ! test -s actual
214 + test_must_be_empty actual
215 '
216
217 test_expect_success 'git diff between submodule commits [.gitmodules]' '
@@ -227,7 +227,7 @@ test_expect_success 'git diff between submodule commits [.gitmodules]' '
227 test_cmp expect.body actual.body &&
228 git config -f .gitmodules submodule.subname.ignore all &&
229 git diff HEAD^..HEAD >actual &&
230 - ! test -s actual &&
230 + test_must_be_empty actual &&
231 git config submodule.subname.ignore dirty &&
232 git config submodule.subname.path sub &&
233 git diff HEAD^..HEAD >actual &&
t/t4041-diff-submodule-option.sh
+7 -7
@@ -273,17 +273,17 @@ test_expect_success 'submodule contains untracked content' '
273
274 test_expect_success 'submodule contains untracked content (untracked ignored)' '
275 git diff-index -p --ignore-submodules=untracked --submodule=log HEAD >actual &&
276 - ! test -s actual
276 + test_must_be_empty actual
277 '
278
279 test_expect_success 'submodule contains untracked content (dirty ignored)' '
280 git diff-index -p --ignore-submodules=dirty --submodule=log HEAD >actual &&
281 - ! test -s actual
281 + test_must_be_empty actual
282 '
283
284 test_expect_success 'submodule contains untracked content (all ignored)' '
285 git diff-index -p --ignore-submodules=all --submodule=log HEAD >actual &&
286 - ! test -s actual
286 + test_must_be_empty actual
287 '
288
289 test_expect_success 'submodule contains untracked and modifed content' '
@@ -308,13 +308,13 @@ test_expect_success 'submodule contains untracked and modifed content (untracked
308 test_expect_success 'submodule contains untracked and modifed content (dirty ignored)' '
309 echo new > sm1/foo6 &&
310 git diff-index -p --ignore-submodules=dirty --submodule=log HEAD >actual &&
311 - ! test -s actual
311 + test_must_be_empty actual
312 '
313
314 test_expect_success 'submodule contains untracked and modifed content (all ignored)' '
315 echo new > sm1/foo6 &&
316 git diff-index -p --ignore-submodules --submodule=log HEAD >actual &&
317 - ! test -s actual
317 + test_must_be_empty actual
318 '
319
320 test_expect_success 'submodule contains modifed content' '
@@ -368,7 +368,7 @@ test_expect_success 'modified submodule contains untracked content (dirty ignore
368
369 test_expect_success 'modified submodule contains untracked content (all ignored)' '
370 git diff-index -p --ignore-submodules=all --submodule=log HEAD >actual &&
371 - ! test -s actual
371 + test_must_be_empty actual
372 '
373
374 test_expect_success 'modified submodule contains untracked and modifed content' '
@@ -407,7 +407,7 @@ test_expect_success 'modified submodule contains untracked and modifed content (
407 test_expect_success 'modified submodule contains untracked and modifed content (all ignored)' '
408 echo modification >> sm1/foo6 &&
409 git diff-index -p --ignore-submodules --submodule=log HEAD >actual &&
410 - ! test -s actual
410 + test_must_be_empty actual
411 '
412
413 test_expect_success 'modified submodule contains modifed content' '
t/t4060-diff-submodule-option-diff-format.sh
+7 -7
@@ -408,17 +408,17 @@ test_expect_success 'submodule contains untracked content' '
408
409 test_expect_success 'submodule contains untracked content (untracked ignored)' '
410 git diff-index -p --ignore-submodules=untracked --submodule=diff HEAD >actual &&
411 - ! test -s actual
411 + test_must_be_empty actual
412 '
413
414 test_expect_success 'submodule contains untracked content (dirty ignored)' '
415 git diff-index -p --ignore-submodules=dirty --submodule=diff HEAD >actual &&
416 - ! test -s actual
416 + test_must_be_empty actual
417 '
418
419 test_expect_success 'submodule contains untracked content (all ignored)' '
420 git diff-index -p --ignore-submodules=all --submodule=diff HEAD >actual &&
421 - ! test -s actual
421 + test_must_be_empty actual
422 '
423
424 test_expect_success 'submodule contains untracked and modified content' '
@@ -458,13 +458,13 @@ test_expect_success 'submodule contains untracked and modified content (untracke
458 test_expect_success 'submodule contains untracked and modified content (dirty ignored)' '
459 echo new > sm1/foo6 &&
460 git diff-index -p --ignore-submodules=dirty --submodule=diff HEAD >actual &&
461 - ! test -s actual
461 + test_must_be_empty actual
462 '
463
464 test_expect_success 'submodule contains untracked and modified content (all ignored)' '
465 echo new > sm1/foo6 &&
466 git diff-index -p --ignore-submodules --submodule=diff HEAD >actual &&
467 - ! test -s actual
467 + test_must_be_empty actual
468 '
469
470 test_expect_success 'submodule contains modified content' '
@@ -549,7 +549,7 @@ test_expect_success 'modified submodule contains untracked content (dirty ignore
549
550 test_expect_success 'modified submodule contains untracked content (all ignored)' '
551 git diff-index -p --ignore-submodules=all --submodule=diff HEAD >actual &&
552 - ! test -s actual
552 + test_must_be_empty actual
553 '
554
555 test_expect_success 'modified submodule contains untracked and modified content' '
@@ -609,7 +609,7 @@ test_expect_success 'modified submodule contains untracked and modified content
609 test_expect_success 'modified submodule contains untracked and modified content (all ignored)' '
610 echo modification >> sm1/foo6 &&
611 git diff-index -p --ignore-submodules --submodule=diff HEAD >actual &&
612 - ! test -s actual
612 + test_must_be_empty actual
613 '
614
615 # NOT OK
t/t4124-apply-ws-rule.sh
+1 -1
@@ -100,7 +100,7 @@ test_expect_success 'whitespace=warn, default rule' '
100 test_expect_success 'whitespace=error-all, default rule' '
101
102 test_must_fail apply_patch --whitespace=error-all &&
103 - ! test -s target
103 + test_must_be_empty target
104
105 '
106
t/t4150-am.sh
+2 -2
@@ -651,7 +651,7 @@ test_expect_success 'am -3 -q is quiet' '
651 git checkout -f lorem2 &&
652 git reset base3way --hard &&
653 git am -3 -q lorem-move.patch >output.out 2>&1 &&
654 - ! test -s output.out
654 + test_must_be_empty output.out
655 '
656
657 test_expect_success 'am pauses on conflict' '
@@ -874,7 +874,7 @@ test_expect_success 'am -q is quiet' '
874 git checkout first &&
875 test_tick &&
876 git am -q <patch1 >output.out 2>&1 &&
877 - ! test -s output.out
877 + test_must_be_empty output.out
878 '
879
880 test_expect_success 'am empty-file does not infloop' '
t/t5401-update-hooks.sh
+5 -5
@@ -104,17 +104,17 @@ test_expect_success 'post-update hook arguments' '
104 '
105
106 test_expect_success 'all hook stdin is /dev/null' '
107 - ! test -s victim.git/update.stdin &&
108 - ! test -s victim.git/post-update.stdin
107 + test_must_be_empty victim.git/update.stdin &&
108 + test_must_be_empty victim.git/post-update.stdin
109 '
110
111 test_expect_success 'all *-receive hook args are empty' '
112 - ! test -s victim.git/pre-receive.args &&
113 - ! test -s victim.git/post-receive.args
112 + test_must_be_empty victim.git/pre-receive.args &&
113 + test_must_be_empty victim.git/post-receive.args
114 '
115
116 test_expect_success 'send-pack produced no output' '
117 - ! test -s send.out
117 + test_must_be_empty send.out
118 '
119
120 cat <<EOF >expect
t/t5500-fetch-pack.sh
+1 -1
@@ -161,7 +161,7 @@ test_expect_success 'clone shallow object count' '
161 test_expect_success 'clone shallow object count (part 2)' '
162 sed -e "/^in-pack:/d" -e "/^packs:/d" -e "/^size-pack:/d" \
163 -e "/: 0$/d" count.shallow > count_output &&
164 - ! test -s count_output
164 + test_must_be_empty count_output
165 '
166
167 test_expect_success 'fsck in shallow repo' '
t/t5526-fetch-submodules.sh
+21 -21
@@ -98,8 +98,8 @@ test_expect_success "fetch alone only fetches superproject" '
98 cd downstream &&
99 git fetch >../actual.out 2>../actual.err
100 ) &&
101 - ! test -s actual.out &&
102 - ! test -s actual.err
101 + test_must_be_empty actual.out &&
102 + test_must_be_empty actual.err
103 '
104
105 test_expect_success "fetch --no-recurse-submodules only fetches superproject" '
@@ -107,8 +107,8 @@ test_expect_success "fetch --no-recurse-submodules only fetches superproject" '
107 cd downstream &&
108 git fetch --no-recurse-submodules >../actual.out 2>../actual.err
109 ) &&
110 - ! test -s actual.out &&
111 - ! test -s actual.err
110 + test_must_be_empty actual.out &&
111 + test_must_be_empty actual.err
112 '
113
114 test_expect_success "using fetchRecurseSubmodules=true in .gitmodules recurses into submodules" '
@@ -127,8 +127,8 @@ test_expect_success "--no-recurse-submodules overrides .gitmodules config" '
127 cd downstream &&
128 git fetch --no-recurse-submodules >../actual.out 2>../actual.err
129 ) &&
130 - ! test -s actual.out &&
131 - ! test -s actual.err
130 + test_must_be_empty actual.out &&
131 + test_must_be_empty actual.err
132 '
133
134 test_expect_success "using fetchRecurseSubmodules=false in .git/config overrides setting in .gitmodules" '
@@ -137,8 +137,8 @@ test_expect_success "using fetchRecurseSubmodules=false in .git/config overrides
137 git config submodule.submodule.fetchRecurseSubmodules false &&
138 git fetch >../actual.out 2>../actual.err
139 ) &&
140 - ! test -s actual.out &&
141 - ! test -s actual.err
140 + test_must_be_empty actual.out &&
141 + test_must_be_empty actual.err
142 '
143
144 test_expect_success "--recurse-submodules overrides fetchRecurseSubmodules setting from .git/config" '
@@ -157,8 +157,8 @@ test_expect_success "--quiet propagates to submodules" '
157 cd downstream &&
158 git fetch --recurse-submodules --quiet >../actual.out 2>../actual.err
159 ) &&
160 - ! test -s actual.out &&
161 - ! test -s actual.err
160 + test_must_be_empty actual.out &&
161 + test_must_be_empty actual.err
162 '
163
164 test_expect_success "--quiet propagates to parallel submodules" '
@@ -166,8 +166,8 @@ test_expect_success "--quiet propagates to parallel submodules" '
166 cd downstream &&
167 git fetch --recurse-submodules -j 2 --quiet >../actual.out 2>../actual.err
168 ) &&
169 - ! test -s actual.out &&
170 - ! test -s actual.err
169 + test_must_be_empty actual.out &&
170 + test_must_be_empty actual.err
171 '
172
173 test_expect_success "--dry-run propagates to submodules" '
@@ -221,8 +221,8 @@ test_expect_success "--no-recurse-submodules overrides config setting" '
221 git config fetch.recurseSubmodules true &&
222 git fetch --no-recurse-submodules >../actual.out 2>../actual.err
223 ) &&
224 - ! test -s actual.out &&
225 - ! test -s actual.err
224 + test_must_be_empty actual.out &&
225 + test_must_be_empty actual.err
226 '
227
228 test_expect_success "Recursion doesn't happen when no new commits are fetched in the superproject" '
@@ -235,8 +235,8 @@ test_expect_success "Recursion doesn't happen when no new commits are fetched in
235 git config --unset fetch.recurseSubmodules &&
236 git fetch >../actual.out 2>../actual.err
237 ) &&
238 - ! test -s actual.out &&
239 - ! test -s actual.err
238 + test_must_be_empty actual.out &&
239 + test_must_be_empty actual.err
240 '
241
242 test_expect_success "Recursion stops when no new submodule commits are fetched" '
@@ -268,7 +268,7 @@ test_expect_success "Recursion doesn't happen when new superproject commits don'
268 cd downstream &&
269 git fetch >../actual.out 2>../actual.err
270 ) &&
271 - ! test -s actual.out &&
271 + test_must_be_empty actual.out &&
272 test_i18ncmp expect.err.file actual.err
273 '
274
@@ -357,8 +357,8 @@ test_expect_success "'--recurse-submodules=on-demand' doesn't recurse when no ne
357 git fetch --recurse-submodules=on-demand >../actual.out 2>../actual.err &&
358 git config --unset fetch.recurseSubmodules
359 ) &&
360 - ! test -s actual.out &&
361 - ! test -s actual.err
360 + test_must_be_empty actual.out &&
361 + test_must_be_empty actual.err
362 '
363
364 test_expect_success "'--recurse-submodules=on-demand' recurses as deep as necessary (and ignores config)" '
@@ -402,7 +402,7 @@ test_expect_success "'--recurse-submodules=on-demand' stops when no new submodul
402 cd downstream &&
403 git fetch --recurse-submodules=on-demand >../actual.out 2>../actual.err
404 ) &&
405 - ! test -s actual.out &&
405 + test_must_be_empty actual.out &&
406 test_i18ncmp expect.err.file actual.err
407 '
408
@@ -477,7 +477,7 @@ test_expect_success "don't fetch submodule when newly recorded commits are alrea
477 cd downstream &&
478 git fetch >../actual.out 2>../actual.err
479 ) &&
480 - ! test -s actual.out &&
480 + test_must_be_empty actual.out &&
481 test_i18ncmp expect.err actual.err &&
482 (
483 cd submodule &&
t/t5570-git-daemon.sh
+1 -1
@@ -51,7 +51,7 @@ test_expect_success 'no-op fetch -v stderr is as expected' '
51
52 test_expect_success 'no-op fetch without "-v" is quiet' '
53 (cd clone && git fetch 2>../stderr) &&
54 - ! test -s stderr
54 + test_must_be_empty stderr
55 '
56
57 test_expect_success 'remote detects correct HEAD' '
t/t7001-mv.sh
+3 -3
@@ -384,7 +384,7 @@ test_expect_success 'mv does not complain when no .gitmodules file is found' '
384 entry="$(git ls-files --stage sub | cut -f 1)" &&
385 mkdir mod &&
386 git mv sub mod/sub 2>actual.err &&
387 - ! test -s actual.err &&
387 + test_must_be_empty actual.err &&
388 ! test -e sub &&
389 [ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
390 (
@@ -408,7 +408,7 @@ test_expect_success 'mv will error out on a modified .gitmodules file unless sta
408 git diff-files --quiet -- sub &&
409 git add .gitmodules &&
410 git mv sub mod/sub 2>actual.err &&
411 - ! test -s actual.err &&
411 + test_must_be_empty actual.err &&
412 ! test -e sub &&
413 [ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
414 (
@@ -469,7 +469,7 @@ test_expect_success 'checking out a commit before submodule moved needs manual u
469 git update-index --refresh &&
470 git diff-files --quiet -- sub .gitmodules &&
471 git status -s sub2 >actual &&
472 - ! test -s actual
472 + test_must_be_empty actual
473 '
474
475 test_expect_success 'mv -k does not accidentally destroy submodules' '
t/t7201-co.sh
+2 -2
@@ -139,7 +139,7 @@ test_expect_success "checkout -m with dirty tree, renamed" '
139 test_cmp expect uno &&
140 ! test -f one &&
141 git diff --cached >current &&
142 - ! test -s current
142 + test_must_be_empty current
143
144 '
145
@@ -163,7 +163,7 @@ test_expect_success 'checkout -m with merge conflict' '
163 fill d2 aT d7 aS >expect &&
164 test_cmp current expect &&
165 git diff --cached two >current &&
166 - ! test -s current
166 + test_must_be_empty current
167 '
168
169 test_expect_success 'format of merge conflict from checkout -m' '
t/t7406-submodule-update.sh
+1 -1
@@ -174,7 +174,7 @@ test_expect_success 'submodule update does not fetch already present commits' '
174 git submodule update > ../actual 2> ../actual.err
175 ) &&
176 test_i18ncmp expected actual &&
177 - ! test -s actual.err
177 + test_must_be_empty actual.err
178 '
179
180 test_expect_success 'submodule update should fail due to local changes' '
t/t7810-grep.sh
+1 -1
@@ -941,7 +941,7 @@ test_expect_success 'grep from a subdirectory to search wider area (2)' '
941 (
942 cd s || exit 1
943 ( git grep xxyyzz .. >out ; echo $? >status )
944 - ! test -s out &&
944 + test_must_be_empty out &&
945 test 1 = $(cat status)
946 )
947 '
t/t9131-git-svn-empty-symlink.sh
+3 -3
@@ -85,7 +85,7 @@ EOF
85 test_expect_success 'clone using git svn' 'git svn clone -r1 "$svnrepo" x'
86 test_expect_success 'enable broken symlink workaround' \
87 '(cd x && git config svn.brokenSymlinkWorkaround true)'
88 -test_expect_success '"bar" is an empty file' 'test -f x/bar && ! test -s x/bar'
88 +test_expect_success '"bar" is an empty file' 'test_must_be_empty x/bar'
89 test_expect_success 'get "bar" => symlink fix from svn' \
90 '(cd x && git svn rebase)'
91 test_expect_success SYMLINKS '"bar" becomes a symlink' 'test -h x/bar'
@@ -94,14 +94,14 @@ test_expect_success SYMLINKS '"bar" becomes a symlink' 'test -h x/bar'
94 test_expect_success 'clone using git svn' 'git svn clone -r1 "$svnrepo" y'
95 test_expect_success 'disable broken symlink workaround' \
96 '(cd y && git config svn.brokenSymlinkWorkaround false)'
97 -test_expect_success '"bar" is an empty file' 'test -f y/bar && ! test -s y/bar'
97 +test_expect_success '"bar" is an empty file' 'test_must_be_empty y/bar'
98 test_expect_success 'get "bar" => symlink fix from svn' \
99 '(cd y && git svn rebase)'
100 test_expect_success '"bar" does not become a symlink' '! test -L y/bar'
101
102 # svn.brokenSymlinkWorkaround is unset
103 test_expect_success 'clone using git svn' 'git svn clone -r1 "$svnrepo" z'
104 -test_expect_success '"bar" is an empty file' 'test -f z/bar && ! test -s z/bar'
104 +test_expect_success '"bar" is an empty file' 'test_must_be_empty z/bar'
105 test_expect_success 'get "bar" => symlink fix from svn' \
106 '(cd z && git svn rebase)'
107 test_expect_success '"bar" does not become a symlink' '! test -L z/bar'
t/t9135-git-svn-moved-branch-empty-file.sh
+1 -2
@@ -13,8 +13,7 @@ test_expect_success 'test that b1 exists and is empty' '
13 (
14 cd x &&
15 git reset --hard origin/branch-c &&
16 - test -f b1 &&
17 - ! test -s b1
16 + test_must_be_empty b1
17 )
18 '
19