1
0
mirror of https://github.com/git/git.git synced 2024-09-28 07:40:44 +02:00

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>
This commit is contained in:
SZEDER Gábor 2018-08-19 23:57:22 +02:00 committed by Junio C Hamano
parent d3c6751b18
commit ec10b018e7
25 changed files with 98 additions and 99 deletions

View File

@ -116,7 +116,7 @@ check_sub_test_lib_test () {
name="$1" # stdin is the expected output from the test
(
cd "$name" &&
! test -s err &&
test_must_be_empty err &&
sed -e 's/^> //' -e 's/Z$//' >expect &&
test_cmp expect out
)

View File

@ -239,7 +239,7 @@ test_expect_success 'no phantom error when switching trees' '
>newdir/one &&
git add newdir/one &&
git checkout 2>errors &&
! test -s errors
test_must_be_empty errors
'
test_expect_success 'switching trees does not invalidate shared index' '

View File

@ -11,7 +11,7 @@ test_expect_success 'git show a ISO-8859-1 commit under C locale' '
. "$TEST_DIRECTORY"/t3901/8859-1.txt &&
test_commit "iso-c-commit" iso-under-c &&
git show >out 2>err &&
! test -s err &&
test_must_be_empty err &&
grep -q "iso-c-commit" out
'
@ -19,7 +19,7 @@ test_expect_success GETTEXT_LOCALE 'git show a ISO-8859-1 commit under a UTF-8 l
. "$TEST_DIRECTORY"/t3901/8859-1.txt &&
test_commit "iso-utf8-commit" iso-under-utf8 &&
LANGUAGE=is LC_ALL="$is_IS_locale" git show >out 2>err &&
! test -s err &&
test_must_be_empty err &&
grep -q "iso-utf8-commit" out
'

View File

@ -41,7 +41,7 @@ test_expect_success 'setup: helper for testing rev-parse' '
# rev-parse --show-prefix should output
# a single newline when at the top of the work tree,
# but we test for that separately.
test -z "$4" && ! test -s actual.prefix ||
test -z "$4" && test_must_be_empty actual.prefix ||
test_cmp expected.prefix actual.prefix
fi
}

View File

@ -234,14 +234,14 @@ test_expect_success '#0: nonbare repo, no explicit configuration' '
try_repo 0 unset unset unset "" unset \
.git "$here/0" "$here/0" "(null)" \
.git "$here/0" "$here/0" sub/ 2>message &&
! test -s message
test_must_be_empty message
'
test_expect_success '#1: GIT_WORK_TREE without explicit GIT_DIR is accepted' '
try_repo 1 "$here" unset unset "" unset \
"$here/1/.git" "$here" "$here" 1/ \
"$here/1/.git" "$here" "$here" 1/sub/ 2>message &&
! test -s message
test_must_be_empty message
'
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' '
try_case 4 unset unset \
.git "$here/4/sub" "$here/4" "(null)" \
"$here/4/.git" "$here/4/sub" "$here/4/sub" "(null)" 2>message &&
! test -s message
test_must_be_empty message
'
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' '
try_repo 5a .. unset "$here/5a" "" unset \
"$here/5a/.git" "$here" "$here" 5a/ \
"$here/5a/.git" "$here/5a" "$here/5a" sub/ &&
! test -s message
test_must_be_empty message
'
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' '
try_repo 9 wt unset unset gitfile unset \
"$here/9.git" "$here/9/wt" "$here/9" "(null)" \
"$here/9.git" "$here/9/sub/wt" "$here/9/sub" "(null)" 2>message &&
! test -s message
test_must_be_empty message
'
test_expect_success '#10: GIT_DIR can point to gitfile' '
@ -402,7 +402,7 @@ test_expect_success '#12: core.worktree with gitfile is accepted' '
try_repo 12 unset unset "$here/12" gitfile unset \
"$here/12.git" "$here/12" "$here/12" "(null)" \
"$here/12.git" "$here/12" "$here/12" sub/ 2>message &&
! test -s message
test_must_be_empty message
'
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)' '
try_repo 13 non-existent-too unset non-existent gitfile unset \
"$here/13.git" "$here/13/non-existent-too" "$here/13" "(null)" \
"$here/13.git" "$here/13/sub/non-existent-too" "$here/13/sub" "(null)" 2>message &&
! test -s message
test_must_be_empty message
'
# case #14.
@ -565,7 +565,7 @@ test_expect_success '#17: GIT_WORK_TREE without explicit GIT_DIR is accepted (ba
try_repo 17c "$here/17c" unset unset "" true \
.git "$here/17c" "$here/17c" "(null)" \
"$here/17c/.git" "$here/17c" "$here/17c" sub/ 2>message &&
! test -s message
test_must_be_empty message
'
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)'
"$here/20a/.git" "$here/20a" "$here/20a" .git/wt/ &&
try_case 20a/.git/wt/sub unset unset \
"$here/20a/.git" "$here/20a" "$here/20a" .git/wt/sub/ &&
! test -s message
test_must_be_empty message
'
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
export GIT_WORK_TREE &&
git status >/dev/null
) 2>message &&
! test -s message
test_must_be_empty message
'
run_wt_tests 21
@ -742,7 +742,7 @@ test_expect_success '#25: GIT_WORK_TREE accepted if GIT_DIR unset (bare gitfile
try_repo 25 "$here/25" unset unset gitfile true \
"$here/25.git" "$here/25" "$here/25" "(null)" \
"$here/25.git" "$here/25" "$here/25" "sub/" 2>message &&
! test -s message
test_must_be_empty message
'
test_expect_success '#26: bare repo has no worktree (GIT_DIR -> gitfile case)' '
@ -780,7 +780,7 @@ test_expect_success '#29: setup' '
export GIT_WORK_TREE &&
git status
) 2>message &&
! test -s message
test_must_be_empty message
'
run_wt_tests 29 gitfile

View File

@ -44,7 +44,7 @@ test_expect_success '"checkout <submodule>" honors diff.ignoreSubmodules' '
git config diff.ignoreSubmodules dirty &&
echo x> submodule/untracked &&
git checkout HEAD >actual 2>&1 &&
! test -s actual
test_must_be_empty actual
'
test_expect_success '"checkout <submodule>" honors submodule.*.ignore from .gitmodules' '
@ -52,7 +52,7 @@ test_expect_success '"checkout <submodule>" honors submodule.*.ignore from .gitm
git config -f .gitmodules submodule.submodule.path submodule &&
git config -f .gitmodules submodule.submodule.ignore untracked &&
git checkout HEAD >actual 2>&1 &&
! test -s actual
test_must_be_empty actual
'
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/
git config submodule.submodule.path submodule &&
git config submodule.submodule.ignore all &&
git checkout HEAD >actual 2>&1 &&
! test -s actual
test_must_be_empty actual
'
KNOWN_FAILURE_DIRECTORY_SUBMODULE_CONFLICTS=1

View File

@ -31,7 +31,7 @@ do
rm -f .git/index &&
test_must_fail git add "$i" 2>err &&
git ls-files "$i" >out &&
! test -s out
test_must_be_empty out
'
test_expect_success "complaints for ignored $i output" '
@ -42,7 +42,7 @@ do
rm -f .git/index &&
test_must_fail git add "$i" file 2>err &&
git ls-files "$i" >out &&
! test -s out
test_must_be_empty out
'
test_expect_success "complaints for ignored $i with unignored file output" '
test_i18ngrep -e "Use -f if" err
@ -57,7 +57,7 @@ do
cd dir &&
test_must_fail git add "$i" 2>err &&
git ls-files "$i" >out &&
! test -s out
test_must_be_empty out
)
'
@ -77,7 +77,7 @@ do
cd sub &&
test_must_fail git add "$i" 2>err &&
git ls-files "$i" >out &&
! test -s out
test_must_be_empty out
)
'

View File

@ -382,7 +382,7 @@ test_expect_success 'rm does not complain when no .gitmodules file is found' '
git submodule update &&
git rm .gitmodules &&
git rm submod >actual 2>actual.err &&
! test -s actual.err &&
test_must_be_empty actual.err &&
! test -d submod &&
! test -f submod/.git &&
git status -s -uno >actual &&
@ -400,7 +400,7 @@ test_expect_success 'rm will error out on a modified .gitmodules file unless sta
git diff-files --quiet -- submod &&
git add .gitmodules &&
git rm submod >actual 2>actual.err &&
! test -s actual.err &&
test_must_be_empty actual.err &&
! test -d submod &&
! test -f submod/.git &&
git status -s -uno >actual &&
@ -694,7 +694,7 @@ test_expect_success 'checking out a commit after submodule removal needs manual
test_cmp expected actual &&
rm -rf submod &&
git status -s -uno --ignore-submodules=none >actual &&
! test -s actual
test_must_be_empty actual
'
test_expect_success 'rm of d/f when d has become a non-directory' '

View File

@ -126,7 +126,7 @@ test_expect_success SYMLINKS 'diff symlinks with non-existing targets' '
ln -s take\ over brain &&
test_must_fail git diff --no-index pinky brain >output 2>output.err &&
grep narf output &&
! test -s output.err
test_must_be_empty output.err
'
test_expect_success SYMLINKS 'setup symlinks with attributes' '

View File

@ -260,7 +260,7 @@ test_expect_success 'trailing empty lines (2)' '
echo "F -whitespace" >.gitattributes &&
git diff --check >output &&
! test -s output
test_must_be_empty output
'

View File

@ -104,19 +104,19 @@ test_expect_success 'git diff HEAD with dirty submodule (work tree, refs match)'
expect_from_to >expect.body $subprev $subprev-dirty &&
test_cmp expect.body actual.body &&
git diff --ignore-submodules HEAD >actual2 &&
! test -s actual2 &&
test_must_be_empty actual2 &&
git diff --ignore-submodules=untracked HEAD >actual3 &&
sed -e "1,/^@@/d" actual3 >actual3.body &&
expect_from_to >expect.body $subprev $subprev-dirty &&
test_cmp expect.body actual3.body &&
git diff --ignore-submodules=dirty HEAD >actual4 &&
! test -s actual4
test_must_be_empty actual4
'
test_expect_success 'git diff HEAD with dirty submodule (work tree, refs match) [.gitmodules]' '
git config diff.ignoreSubmodules dirty &&
git diff HEAD >actual &&
! test -s actual &&
test_must_be_empty actual &&
git config --add -f .gitmodules submodule.subname.ignore none &&
git config --add -f .gitmodules submodule.subname.path sub &&
git diff HEAD >actual &&
@ -126,7 +126,7 @@ test_expect_success 'git diff HEAD with dirty submodule (work tree, refs match)
git config -f .gitmodules submodule.subname.ignore all &&
git config -f .gitmodules submodule.subname.path sub &&
git diff HEAD >actual2 &&
! test -s actual2 &&
test_must_be_empty actual2 &&
git config -f .gitmodules submodule.subname.ignore untracked &&
git diff HEAD >actual3 &&
sed -e "1,/^@@/d" actual3 >actual3.body &&
@ -134,7 +134,7 @@ test_expect_success 'git diff HEAD with dirty submodule (work tree, refs match)
test_cmp expect.body actual3.body &&
git config -f .gitmodules submodule.subname.ignore dirty &&
git diff HEAD >actual4 &&
! test -s actual4 &&
test_must_be_empty actual4 &&
git config submodule.subname.ignore none &&
git config submodule.subname.path sub &&
git diff HEAD >actual &&
@ -172,24 +172,24 @@ test_expect_success 'git diff HEAD with dirty submodule (untracked, refs match)'
expect_from_to >expect.body $subprev $subprev-dirty &&
test_cmp expect.body actual.body &&
git diff --ignore-submodules=all HEAD >actual2 &&
! test -s actual2 &&
test_must_be_empty actual2 &&
git diff --ignore-submodules=untracked HEAD >actual3 &&
! test -s actual3 &&
test_must_be_empty actual3 &&
git diff --ignore-submodules=dirty HEAD >actual4 &&
! test -s actual4
test_must_be_empty actual4
'
test_expect_success 'git diff HEAD with dirty submodule (untracked, refs match) [.gitmodules]' '
git config --add -f .gitmodules submodule.subname.ignore all &&
git config --add -f .gitmodules submodule.subname.path sub &&
git diff HEAD >actual2 &&
! test -s actual2 &&
test_must_be_empty actual2 &&
git config -f .gitmodules submodule.subname.ignore untracked &&
git diff HEAD >actual3 &&
! test -s actual3 &&
test_must_be_empty actual3 &&
git config -f .gitmodules submodule.subname.ignore dirty &&
git diff HEAD >actual4 &&
! test -s actual4 &&
test_must_be_empty actual4 &&
git config submodule.subname.ignore none &&
git config submodule.subname.path sub &&
git diff HEAD >actual &&
@ -211,7 +211,7 @@ test_expect_success 'git diff between submodule commits' '
expect_from_to >expect.body $subtip $subprev &&
test_cmp expect.body actual.body &&
git diff --ignore-submodules HEAD^..HEAD >actual &&
! test -s actual
test_must_be_empty actual
'
test_expect_success 'git diff between submodule commits [.gitmodules]' '
@ -227,7 +227,7 @@ test_expect_success 'git diff between submodule commits [.gitmodules]' '
test_cmp expect.body actual.body &&
git config -f .gitmodules submodule.subname.ignore all &&
git diff HEAD^..HEAD >actual &&
! test -s actual &&
test_must_be_empty actual &&
git config submodule.subname.ignore dirty &&
git config submodule.subname.path sub &&
git diff HEAD^..HEAD >actual &&

View File

@ -273,17 +273,17 @@ test_expect_success 'submodule contains untracked content' '
test_expect_success 'submodule contains untracked content (untracked ignored)' '
git diff-index -p --ignore-submodules=untracked --submodule=log HEAD >actual &&
! test -s actual
test_must_be_empty actual
'
test_expect_success 'submodule contains untracked content (dirty ignored)' '
git diff-index -p --ignore-submodules=dirty --submodule=log HEAD >actual &&
! test -s actual
test_must_be_empty actual
'
test_expect_success 'submodule contains untracked content (all ignored)' '
git diff-index -p --ignore-submodules=all --submodule=log HEAD >actual &&
! test -s actual
test_must_be_empty actual
'
test_expect_success 'submodule contains untracked and modifed content' '
@ -308,13 +308,13 @@ test_expect_success 'submodule contains untracked and modifed content (untracked
test_expect_success 'submodule contains untracked and modifed content (dirty ignored)' '
echo new > sm1/foo6 &&
git diff-index -p --ignore-submodules=dirty --submodule=log HEAD >actual &&
! test -s actual
test_must_be_empty actual
'
test_expect_success 'submodule contains untracked and modifed content (all ignored)' '
echo new > sm1/foo6 &&
git diff-index -p --ignore-submodules --submodule=log HEAD >actual &&
! test -s actual
test_must_be_empty actual
'
test_expect_success 'submodule contains modifed content' '
@ -368,7 +368,7 @@ test_expect_success 'modified submodule contains untracked content (dirty ignore
test_expect_success 'modified submodule contains untracked content (all ignored)' '
git diff-index -p --ignore-submodules=all --submodule=log HEAD >actual &&
! test -s actual
test_must_be_empty actual
'
test_expect_success 'modified submodule contains untracked and modifed content' '
@ -407,7 +407,7 @@ test_expect_success 'modified submodule contains untracked and modifed content (
test_expect_success 'modified submodule contains untracked and modifed content (all ignored)' '
echo modification >> sm1/foo6 &&
git diff-index -p --ignore-submodules --submodule=log HEAD >actual &&
! test -s actual
test_must_be_empty actual
'
test_expect_success 'modified submodule contains modifed content' '

View File

@ -408,17 +408,17 @@ test_expect_success 'submodule contains untracked content' '
test_expect_success 'submodule contains untracked content (untracked ignored)' '
git diff-index -p --ignore-submodules=untracked --submodule=diff HEAD >actual &&
! test -s actual
test_must_be_empty actual
'
test_expect_success 'submodule contains untracked content (dirty ignored)' '
git diff-index -p --ignore-submodules=dirty --submodule=diff HEAD >actual &&
! test -s actual
test_must_be_empty actual
'
test_expect_success 'submodule contains untracked content (all ignored)' '
git diff-index -p --ignore-submodules=all --submodule=diff HEAD >actual &&
! test -s actual
test_must_be_empty actual
'
test_expect_success 'submodule contains untracked and modified content' '
@ -458,13 +458,13 @@ test_expect_success 'submodule contains untracked and modified content (untracke
test_expect_success 'submodule contains untracked and modified content (dirty ignored)' '
echo new > sm1/foo6 &&
git diff-index -p --ignore-submodules=dirty --submodule=diff HEAD >actual &&
! test -s actual
test_must_be_empty actual
'
test_expect_success 'submodule contains untracked and modified content (all ignored)' '
echo new > sm1/foo6 &&
git diff-index -p --ignore-submodules --submodule=diff HEAD >actual &&
! test -s actual
test_must_be_empty actual
'
test_expect_success 'submodule contains modified content' '
@ -549,7 +549,7 @@ test_expect_success 'modified submodule contains untracked content (dirty ignore
test_expect_success 'modified submodule contains untracked content (all ignored)' '
git diff-index -p --ignore-submodules=all --submodule=diff HEAD >actual &&
! test -s actual
test_must_be_empty actual
'
test_expect_success 'modified submodule contains untracked and modified content' '
@ -609,7 +609,7 @@ test_expect_success 'modified submodule contains untracked and modified content
test_expect_success 'modified submodule contains untracked and modified content (all ignored)' '
echo modification >> sm1/foo6 &&
git diff-index -p --ignore-submodules --submodule=diff HEAD >actual &&
! test -s actual
test_must_be_empty actual
'
# NOT OK

View File

@ -100,7 +100,7 @@ test_expect_success 'whitespace=warn, default rule' '
test_expect_success 'whitespace=error-all, default rule' '
test_must_fail apply_patch --whitespace=error-all &&
! test -s target
test_must_be_empty target
'

View File

@ -651,7 +651,7 @@ test_expect_success 'am -3 -q is quiet' '
git checkout -f lorem2 &&
git reset base3way --hard &&
git am -3 -q lorem-move.patch >output.out 2>&1 &&
! test -s output.out
test_must_be_empty output.out
'
test_expect_success 'am pauses on conflict' '
@ -874,7 +874,7 @@ test_expect_success 'am -q is quiet' '
git checkout first &&
test_tick &&
git am -q <patch1 >output.out 2>&1 &&
! test -s output.out
test_must_be_empty output.out
'
test_expect_success 'am empty-file does not infloop' '

View File

@ -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

View File

@ -161,7 +161,7 @@ test_expect_success 'clone shallow object count' '
test_expect_success 'clone shallow object count (part 2)' '
sed -e "/^in-pack:/d" -e "/^packs:/d" -e "/^size-pack:/d" \
-e "/: 0$/d" count.shallow > count_output &&
! test -s count_output
test_must_be_empty count_output
'
test_expect_success 'fsck in shallow repo' '

View File

@ -98,8 +98,8 @@ test_expect_success "fetch alone only fetches superproject" '
cd downstream &&
git fetch >../actual.out 2>../actual.err
) &&
! test -s actual.out &&
! test -s actual.err
test_must_be_empty actual.out &&
test_must_be_empty actual.err
'
test_expect_success "fetch --no-recurse-submodules only fetches superproject" '
@ -107,8 +107,8 @@ test_expect_success "fetch --no-recurse-submodules only fetches superproject" '
cd downstream &&
git fetch --no-recurse-submodules >../actual.out 2>../actual.err
) &&
! test -s actual.out &&
! test -s actual.err
test_must_be_empty actual.out &&
test_must_be_empty actual.err
'
test_expect_success "using fetchRecurseSubmodules=true in .gitmodules recurses into submodules" '
@ -127,8 +127,8 @@ test_expect_success "--no-recurse-submodules overrides .gitmodules config" '
cd downstream &&
git fetch --no-recurse-submodules >../actual.out 2>../actual.err
) &&
! test -s actual.out &&
! test -s actual.err
test_must_be_empty actual.out &&
test_must_be_empty actual.err
'
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
git config submodule.submodule.fetchRecurseSubmodules false &&
git fetch >../actual.out 2>../actual.err
) &&
! test -s actual.out &&
! test -s actual.err
test_must_be_empty actual.out &&
test_must_be_empty actual.err
'
test_expect_success "--recurse-submodules overrides fetchRecurseSubmodules setting from .git/config" '
@ -157,8 +157,8 @@ test_expect_success "--quiet propagates to submodules" '
cd downstream &&
git fetch --recurse-submodules --quiet >../actual.out 2>../actual.err
) &&
! test -s actual.out &&
! test -s actual.err
test_must_be_empty actual.out &&
test_must_be_empty actual.err
'
test_expect_success "--quiet propagates to parallel submodules" '
@ -166,8 +166,8 @@ test_expect_success "--quiet propagates to parallel submodules" '
cd downstream &&
git fetch --recurse-submodules -j 2 --quiet >../actual.out 2>../actual.err
) &&
! test -s actual.out &&
! test -s actual.err
test_must_be_empty actual.out &&
test_must_be_empty actual.err
'
test_expect_success "--dry-run propagates to submodules" '
@ -221,8 +221,8 @@ test_expect_success "--no-recurse-submodules overrides config setting" '
git config fetch.recurseSubmodules true &&
git fetch --no-recurse-submodules >../actual.out 2>../actual.err
) &&
! test -s actual.out &&
! test -s actual.err
test_must_be_empty actual.out &&
test_must_be_empty actual.err
'
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
git config --unset fetch.recurseSubmodules &&
git fetch >../actual.out 2>../actual.err
) &&
! test -s actual.out &&
! test -s actual.err
test_must_be_empty actual.out &&
test_must_be_empty actual.err
'
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'
cd downstream &&
git fetch >../actual.out 2>../actual.err
) &&
! test -s actual.out &&
test_must_be_empty actual.out &&
test_i18ncmp expect.err.file actual.err
'
@ -357,8 +357,8 @@ test_expect_success "'--recurse-submodules=on-demand' doesn't recurse when no ne
git fetch --recurse-submodules=on-demand >../actual.out 2>../actual.err &&
git config --unset fetch.recurseSubmodules
) &&
! test -s actual.out &&
! test -s actual.err
test_must_be_empty actual.out &&
test_must_be_empty actual.err
'
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
cd downstream &&
git fetch --recurse-submodules=on-demand >../actual.out 2>../actual.err
) &&
! test -s actual.out &&
test_must_be_empty actual.out &&
test_i18ncmp expect.err.file actual.err
'
@ -477,7 +477,7 @@ test_expect_success "don't fetch submodule when newly recorded commits are alrea
cd downstream &&
git fetch >../actual.out 2>../actual.err
) &&
! test -s actual.out &&
test_must_be_empty actual.out &&
test_i18ncmp expect.err actual.err &&
(
cd submodule &&

View File

@ -51,7 +51,7 @@ test_expect_success 'no-op fetch -v stderr is as expected' '
test_expect_success 'no-op fetch without "-v" is quiet' '
(cd clone && git fetch 2>../stderr) &&
! test -s stderr
test_must_be_empty stderr
'
test_expect_success 'remote detects correct HEAD' '

View File

@ -384,7 +384,7 @@ test_expect_success 'mv does not complain when no .gitmodules file is found' '
entry="$(git ls-files --stage sub | cut -f 1)" &&
mkdir mod &&
git mv sub mod/sub 2>actual.err &&
! test -s actual.err &&
test_must_be_empty actual.err &&
! test -e sub &&
[ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
(
@ -408,7 +408,7 @@ test_expect_success 'mv will error out on a modified .gitmodules file unless sta
git diff-files --quiet -- sub &&
git add .gitmodules &&
git mv sub mod/sub 2>actual.err &&
! test -s actual.err &&
test_must_be_empty actual.err &&
! test -e sub &&
[ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
(
@ -469,7 +469,7 @@ test_expect_success 'checking out a commit before submodule moved needs manual u
git update-index --refresh &&
git diff-files --quiet -- sub .gitmodules &&
git status -s sub2 >actual &&
! test -s actual
test_must_be_empty actual
'
test_expect_success 'mv -k does not accidentally destroy submodules' '

View File

@ -139,7 +139,7 @@ test_expect_success "checkout -m with dirty tree, renamed" '
test_cmp expect uno &&
! test -f one &&
git diff --cached >current &&
! test -s current
test_must_be_empty current
'
@ -163,7 +163,7 @@ test_expect_success 'checkout -m with merge conflict' '
fill d2 aT d7 aS >expect &&
test_cmp current expect &&
git diff --cached two >current &&
! test -s current
test_must_be_empty current
'
test_expect_success 'format of merge conflict from checkout -m' '

View File

@ -174,7 +174,7 @@ test_expect_success 'submodule update does not fetch already present commits' '
git submodule update > ../actual 2> ../actual.err
) &&
test_i18ncmp expected actual &&
! test -s actual.err
test_must_be_empty actual.err
'
test_expect_success 'submodule update should fail due to local changes' '

View File

@ -941,7 +941,7 @@ test_expect_success 'grep from a subdirectory to search wider area (2)' '
(
cd s || exit 1
( git grep xxyyzz .. >out ; echo $? >status )
! test -s out &&
test_must_be_empty out &&
test 1 = $(cat status)
)
'

View File

@ -85,7 +85,7 @@ EOF
test_expect_success 'clone using git svn' 'git svn clone -r1 "$svnrepo" x'
test_expect_success 'enable broken symlink workaround' \
'(cd x && git config svn.brokenSymlinkWorkaround true)'
test_expect_success '"bar" is an empty file' 'test -f x/bar && ! test -s x/bar'
test_expect_success '"bar" is an empty file' 'test_must_be_empty x/bar'
test_expect_success 'get "bar" => symlink fix from svn' \
'(cd x && git svn rebase)'
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'
test_expect_success 'clone using git svn' 'git svn clone -r1 "$svnrepo" y'
test_expect_success 'disable broken symlink workaround' \
'(cd y && git config svn.brokenSymlinkWorkaround false)'
test_expect_success '"bar" is an empty file' 'test -f y/bar && ! test -s y/bar'
test_expect_success '"bar" is an empty file' 'test_must_be_empty y/bar'
test_expect_success 'get "bar" => symlink fix from svn' \
'(cd y && git svn rebase)'
test_expect_success '"bar" does not become a symlink' '! test -L y/bar'
# svn.brokenSymlinkWorkaround is unset
test_expect_success 'clone using git svn' 'git svn clone -r1 "$svnrepo" z'
test_expect_success '"bar" is an empty file' 'test -f z/bar && ! test -s z/bar'
test_expect_success '"bar" is an empty file' 'test_must_be_empty z/bar'
test_expect_success 'get "bar" => symlink fix from svn' \
'(cd z && git svn rebase)'
test_expect_success '"bar" does not become a symlink' '! test -L z/bar'

View File

@ -13,8 +13,7 @@ test_expect_success 'test that b1 exists and is empty' '
(
cd x &&
git reset --hard origin/branch-c &&
test -f b1 &&
! test -s b1
test_must_be_empty b1
)
'