path: root/t/
diff options
authorSZEDER Gábor <>2018-08-19 21:57:22 (GMT)
committerJunio C Hamano <>2018-08-21 18:48:29 (GMT)
commitec10b018e76b3f4f40db96a24202c6b8c056bd0f (patch)
treefca8ac2204c583b2aec884c7a87541f11d117735 /t/
parentd3c6751b18170276f80e3578d16877d43ad22709 (diff)
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 '' is left as-is, because it's bogus and, therefore, it's subject of a dedicated patch. - The '! test -s' checks in '' and '' 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 <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 't/')
1 files changed, 5 insertions, 5 deletions
diff --git a/t/ b/t/
index 7f278d8c..ce151e7 100755
--- a/t/
+++ b/t/
@@ -104,17 +104,17 @@ test_expect_success 'post-update hook arguments' '
test_expect_success 'all hook stdin is /dev/null' '
- ! test -s victim.git/update.stdin &&
- ! test -s victim.git/post-update.stdin
+ test_must_be_empty victim.git/update.stdin &&
+ test_must_be_empty victim.git/post-update.stdin
test_expect_success 'all *-receive hook args are empty' '
- ! test -s victim.git/pre-receive.args &&
- ! test -s victim.git/post-receive.args
+ test_must_be_empty victim.git/pre-receive.args &&
+ test_must_be_empty victim.git/post-receive.args
test_expect_success 'send-pack produced no output' '
- ! test -s send.out
+ test_must_be_empty send.out
cat <<EOF >expect