Test fixes.
* sg/test-must-be-empty:
tests: use 'test_must_be_empty' instead of 'test_cmp <empty> <out>'
tests: use 'test_must_be_empty' instead of 'test_cmp /dev/null <out>'
tests: use 'test_must_be_empty' instead of 'test ! -s'
tests: use 'test_must_be_empty' instead of '! test -s'
test_expect_success !MINGW 'run_command can run a script without a #! line' '
@ -34,7 +33,7 @@ test_expect_success !MINGW 'run_command can run a script without a #! line' '
@@ -34,7 +33,7 @@ test_expect_success !MINGW 'run_command can run a script without a #! line' '
test_expect_success 'run_command does not try to execute a directory' '
@ -47,7 +46,7 @@ test_expect_success 'run_command does not try to execute a directory' '
@@ -47,7 +46,7 @@ test_expect_success 'run_command does not try to execute a directory' '
@ -11,7 +11,7 @@ test_expect_success 'git show a ISO-8859-1 commit under C locale' '
@@ -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
@@ -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 &&
@ -290,9 +290,8 @@ test_expect_success 'stale dirs do not cause d/f conflicts (reflogs off)' '
@@ -290,9 +290,8 @@ test_expect_success 'stale dirs do not cause d/f conflicts (reflogs off)' '
# same as before, but we only create a reflog for "one" if
# it already exists, which it does not
git -c core.logallrefupdates=false branch one master &&
: >expect &&
git log -g --format="%gd %gs" one >actual &&
test_cmp expect actual
test_must_be_empty actual
'
# Triggering the bug detected by this test requires a newline to fall
test_expect_success 'loose objects borrowed from alternate are not missing' '
@ -29,12 +28,12 @@ test_expect_success 'loose objects borrowed from alternate are not missing' '
@@ -29,12 +28,12 @@ test_expect_success 'loose objects borrowed from alternate are not missing' '
test_commit C fileC one &&
git fsck --no-dangling >../actual 2>&1
) &&
test_cmp empty actual
test_must_be_empty actual
'
test_expect_success 'HEAD is part of refs, valid objects appear valid' '
git fsck >actual 2>&1 &&
test_cmp empty actual
test_must_be_empty actual
'
# Corruption tests follow. Make sure to remove all traces of the
@ -346,12 +345,12 @@ test_expect_success 'tag with NUL in header' '
@@ -346,12 +345,12 @@ test_expect_success 'tag with NUL in header' '
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,7 +268,7 @@ test_expect_success '#4: core.worktree without GIT_DIR set is accepted' '
@ -88,9 +88,8 @@ test_expect_success 'non-qualified update in subdir updates from the root' '
@@ -88,9 +88,8 @@ test_expect_success 'non-qualified update in subdir updates from the root' '
echo even more >>sub2 &&
git add -u
) &&
: >expect &&
git diff-files --name-only >actual &&
test_cmp expect actual
test_must_be_empty actual
'
test_expect_success 'replace a file with a symlink' '
@ -38,7 +37,7 @@ test_expect_success 'reset --hard works after the conflict' '
@@ -38,7 +37,7 @@ test_expect_success 'reset --hard works after the conflict' '
test_expect_success 'is reset properly' '
git status --porcelain -- modify_delete >out &&
test_cmp empty out &&
test_must_be_empty out &&
test_path_is_missing modify_delete
'
@ -52,7 +51,7 @@ test_expect_success 'Merge abort works after the conflict' '
@@ -52,7 +51,7 @@ test_expect_success 'Merge abort works after the conflict' '
@ -481,10 +481,8 @@ test_expect_success 'list specific note with "git notes list <object>"' '
@@ -481,10 +481,8 @@ test_expect_success 'list specific note with "git notes list <object>"' '
@ -380,7 +380,7 @@ test_expect_success 'rm does not complain when no .gitmodules file is found' '
@@ -380,7 +380,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 &&
@ -398,7 +398,7 @@ test_expect_success 'rm will error out on a modified .gitmodules file unless sta
@@ -398,7 +398,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 &&
@ -692,7 +692,7 @@ test_expect_success 'checking out a commit after submodule removal needs manual
@@ -692,7 +692,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' '
@ -101,7 +101,7 @@ test_expect_success '-L with --first-parent and a merge' '
@@ -101,7 +101,7 @@ test_expect_success '-L with --first-parent and a merge' '
@ -112,8 +112,7 @@ test_expect_success 'prune: do not prune detached HEAD with no reflog' '
@@ -112,8 +112,7 @@ test_expect_success 'prune: do not prune detached HEAD with no reflog' '
# (should be removed and disabled by previous test)
@ -44,7 +44,7 @@ test_expect_success 'pushing into a repository using a ref namespace' '
@@ -44,7 +44,7 @@ test_expect_success 'pushing into a repository using a ref namespace' '
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,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'
@@ -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
@@ -357,8 +357,8 @@ test_expect_success "'--recurse-submodules=on-demand' doesn't recurse when no ne
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,7 +402,7 @@ test_expect_success "'--recurse-submodules=on-demand' stops when no new submodul
@ -477,7 +477,7 @@ test_expect_success "don't fetch submodule when newly recorded commits are alrea
@@ -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 &&
@ -495,7 +495,6 @@ test_expect_success "'fetch.recurseSubmodules=on-demand' works also without .git
@@ -495,7 +495,6 @@ test_expect_success "'fetch.recurseSubmodules=on-demand' works also without .git
git add submodule &&
git rm .gitmodules &&
git commit -m "new submodule without .gitmodules" &&
@ -514,7 +513,7 @@ test_expect_success "'fetch.recurseSubmodules=on-demand' works also without .git
@@ -514,7 +513,7 @@ test_expect_success "'fetch.recurseSubmodules=on-demand' works also without .git
@ -121,10 +121,9 @@ test_expect_success 'describe --contains defaults to HEAD without commit-ish' '
@@ -121,10 +121,9 @@ test_expect_success 'describe --contains defaults to HEAD without commit-ish' '
test_cmp expect actual
'
: >err.expect
check_describe tags/A --all A^0
test_expect_success 'no warning was displayed for A' '
@ -384,7 +384,7 @@ test_expect_success 'mv does not complain when no .gitmodules file is found' '
@@ -384,7 +384,7 @@ test_expect_success 'mv does not complain when no .gitmodules file is found' '
@ -408,7 +408,7 @@ test_expect_success 'mv will error out on a modified .gitmodules file unless sta
@@ -408,7 +408,7 @@ test_expect_success 'mv will error out on a modified .gitmodules file unless sta
@ -469,7 +469,7 @@ test_expect_success 'checking out a commit before submodule moved needs manual u
@@ -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' '
'listing tags using v.* should print nothing because none have v.' '
git tag -l "v.*" > actual &&
test_cmp expect actual
test_must_be_empty actual
'
cat >expect <<EOF
@ -1511,12 +1510,9 @@ test_expect_success 'inverse of the last test, with --no-contains' "
@@ -1511,12 +1510,9 @@ test_expect_success 'inverse of the last test, with --no-contains' "
test_cmp expected actual
"
cat > expected <<EOF
EOF
test_expect_success 'checking that third commit has no tags' "
test_expect_success 'submodule add with /.. in path' '
echo "refs/heads/master" >expect &&
>empty &&
(
cd addtest &&
@ -270,12 +264,11 @@ test_expect_success 'submodule add with /.. in path' '
@@ -270,12 +264,11 @@ test_expect_success 'submodule add with /.. in path' '
inspect addtest/realsubmod ../.. &&
test_cmp expect heads &&
test_cmp expect head &&
test_cmp empty untracked
test_must_be_empty untracked
'
test_expect_success 'submodule add with ./, /.. and // in path' '
echo "refs/heads/master" >expect &&
>empty &&
(
cd addtest &&
@ -287,7 +280,7 @@ test_expect_success 'submodule add with ./, /.. and // in path' '
@@ -287,7 +280,7 @@ test_expect_success 'submodule add with ./, /.. and // in path' '
inspect addtest/realsubmod2 ../.. &&
test_cmp expect heads &&
test_cmp expect head &&
test_cmp empty untracked
test_must_be_empty untracked
'
test_expect_success !CYGWIN 'submodule add with \\ in path' '
@ -306,7 +299,6 @@ test_expect_success !CYGWIN 'submodule add with \\ in path' '
@@ -306,7 +299,6 @@ test_expect_success !CYGWIN 'submodule add with \\ in path' '
test_expect_success 'submodule add in subdirectory' '
echo "refs/heads/master" >expect &&
>empty &&
mkdir addtest/sub &&
(
@ -319,7 +311,7 @@ test_expect_success 'submodule add in subdirectory' '
@@ -319,7 +311,7 @@ test_expect_success 'submodule add in subdirectory' '
inspect addtest/realsubmod3 ../.. &&
test_cmp expect heads &&
test_cmp expect head &&
test_cmp empty untracked
test_must_be_empty untracked
'
test_expect_success 'submodule add in subdirectory with relative path should fail' '
@ -300,7 +300,7 @@ test_expect_success 'should not fail in an empty repo' "
@@ -300,7 +300,7 @@ test_expect_success 'should not fail in an empty repo' "
@ -328,9 +328,8 @@ test_expect_success 'mergetool produces no errors when keepBackup is used' '
@@ -328,9 +328,8 @@ test_expect_success 'mergetool produces no errors when keepBackup is used' '
@ -956,7 +949,7 @@ test_expect_success 'grep from a subdirectory to search wider area (2)' '
@@ -956,7 +949,7 @@ test_expect_success 'grep from a subdirectory to search wider area (2)' '
(
cd s &&
test_expect_code 1 git grep xxyyzz .. >out &&
! test -s out
test_must_be_empty out
)
'
@ -1065,13 +1058,12 @@ test_expect_success 'inside git repository but with --no-index' '
@@ -1065,13 +1058,12 @@ test_expect_success 'inside git repository but with --no-index' '
@ -96,15 +94,14 @@ test_expect_success 'git grep -O jumps to line in less' '
@@ -96,15 +94,14 @@ test_expect_success 'git grep -O jumps to line in less' '