]> git.ipfire.org Git - thirdparty/git.git/commit - t/t7001-mv.sh
tests: use 'test_must_be_empty' instead of '! test -s'
authorSZEDER Gábor <szeder.dev@gmail.com>
Sun, 19 Aug 2018 21:57:22 +0000 (23:57 +0200)
committerJunio C Hamano <gitster@pobox.com>
Tue, 21 Aug 2018 18:48:29 +0000 (11:48 -0700)
commitec10b018e76b3f4f40db96a24202c6b8c056bd0f
treefca8ac2204c583b2aec884c7a87541f11d117735
parentd3c6751b18170276f80e3578d16877d43ad22709
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>
25 files changed:
t/t0000-basic.sh
t/t0090-cache-tree.sh
t/t0203-gettext-setlocale-sanity.sh
t/t1501-work-tree.sh
t/t1510-repo-setup.sh
t/t2013-checkout-submodule.sh
t/t2204-add-ignored.sh
t/t3600-rm.sh
t/t4011-diff-symlink.sh
t/t4019-diff-wserror.sh
t/t4027-diff-submodule.sh
t/t4041-diff-submodule-option.sh
t/t4060-diff-submodule-option-diff-format.sh
t/t4124-apply-ws-rule.sh
t/t4150-am.sh
t/t5401-update-hooks.sh
t/t5500-fetch-pack.sh
t/t5526-fetch-submodules.sh
t/t5570-git-daemon.sh
t/t7001-mv.sh
t/t7201-co.sh
t/t7406-submodule-update.sh
t/t7810-grep.sh
t/t9131-git-svn-empty-symlink.sh
t/t9135-git-svn-moved-branch-empty-file.sh