• Gábor Szeder's avatar
    tests: use 'test_must_be_empty' instead of '! test -s' · ec10b018
    Gábor Szeder authored
    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: Gábor Szeder's avatarSZEDER Gábor <szeder.dev@gmail.com>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    ec10b018
t0090-cache-tree.sh 5.86 KB