tests: make use of the test_must_be_empty function

Change various tests that use an idiom of the form:

    >expect &&
    test_cmp expect actual

To instead use:

    test_must_be_empty actual

The test_must_be_empty() wrapper was introduced in ca8d148daf ("test:
test_must_be_empty helper", 2013-06-09). Many of these tests have been
added after that time. This was mostly found with, and manually pruned
from:

    git grep '^\s+>.*expect.* &&$' t

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Ævar Arnfjörð Bjarmason 2018-07-27 17:48:11 +00:00 committed by Junio C Hamano
parent ffc6fa0e39
commit d3c6751b18
45 changed files with 111 additions and 205 deletions

View File

@ -807,10 +807,9 @@ test_expect_success 'trailing whitespace is ignored' '
cat >expect <<EOF &&
whitespace/untracked
EOF
: >err.expect &&
git ls-files -o -X ignore whitespace >actual 2>err &&
test_cmp expect actual &&
test_cmp err.expect err
test_must_be_empty err
'
test_expect_success !MINGW 'quoting allows trailing whitespace' '
@ -820,10 +819,9 @@ test_expect_success !MINGW 'quoting allows trailing whitespace' '
>whitespace/untracked &&
echo "whitespace/trailing\\ \\ " >ignore &&
echo whitespace/untracked >expect &&
: >err.expect &&
git ls-files -o -X ignore whitespace >actual 2>err &&
test_cmp expect actual &&
test_cmp err.expect err
test_must_be_empty err
'
test_expect_success !MINGW,!CYGWIN 'correct handling of backslashes' '
@ -845,10 +843,9 @@ test_expect_success !MINGW,!CYGWIN 'correct handling of backslashes' '
whitespace/trailing 6 \\a\\Z
EOF
echo whitespace/untracked >expect &&
>err.expect &&
git ls-files -o -X ignore whitespace >actual 2>err &&
test_cmp expect actual &&
test_cmp err.expect err
test_must_be_empty err
'
test_expect_success 'info/exclude trumps core.excludesfile' '

View File

@ -110,31 +110,30 @@ test_expect_success \
test_expect_success \
'only consecutive blank lines should be completely removed' '
> expect &&
printf "\n" | git stripspace >actual &&
test_cmp expect actual &&
test_must_be_empty actual &&
printf "\n\n\n" | git stripspace >actual &&
test_cmp expect actual &&
test_must_be_empty actual &&
printf "$sss\n$sss\n$sss\n" | git stripspace >actual &&
test_cmp expect actual &&
test_must_be_empty actual &&
printf "$sss$sss\n$sss\n\n" | git stripspace >actual &&
test_cmp expect actual &&
test_must_be_empty actual &&
printf "\n$sss\n$sss$sss\n" | git stripspace >actual &&
test_cmp expect actual &&
test_must_be_empty actual &&
printf "$sss$sss$sss$sss\n\n\n" | git stripspace >actual &&
test_cmp expect actual &&
test_must_be_empty actual &&
printf "\n$sss$sss$sss$sss\n\n" | git stripspace >actual &&
test_cmp expect actual &&
test_must_be_empty actual &&
printf "\n\n$sss$sss$sss$sss\n" | git stripspace >actual &&
test_cmp expect actual
test_must_be_empty actual
'
test_expect_success \

View File

@ -294,8 +294,7 @@ test_expect_success 'helpers can abort the process' '
-c credential.helper="!f() { echo quit=1; }; f" \
-c credential.helper="verbatim foo bar" \
credential fill >stdout &&
>expect &&
test_cmp expect stdout
test_must_be_empty stdout
'
test_expect_success 'empty helper spec resets helper list' '

View File

@ -227,12 +227,11 @@ test_expect_success 'index removal and worktree narrowing at the same time' '
'
test_expect_success 'read-tree --reset removes outside worktree' '
>empty &&
echo init.t >.git/info/sparse-checkout &&
git checkout -f top &&
git reset --hard removed &&
git ls-files sub/added >result &&
test_cmp empty result
test_must_be_empty result
'
test_expect_success 'print errors when failed to update worktree' '

View File

@ -114,11 +114,10 @@ test_expect_success 'Exclusion in a non-XDG global ignore file' '
'
test_expect_success 'Checking XDG ignore file when HOME is unset' '
>expected &&
(sane_unset HOME &&
git config --unset core.excludesfile &&
git ls-files --exclude-standard --ignored >actual) &&
test_cmp expected actual
test_must_be_empty actual
'
test_expect_success 'Checking attributes in the XDG attributes file' '
@ -132,10 +131,9 @@ test_expect_success 'Checking attributes in the XDG attributes file' '
'
test_expect_success 'Checking XDG attributes when HOME is unset' '
>expected &&
(sane_unset HOME &&
git check-attr -a f >actual) &&
test_cmp expected actual
test_must_be_empty actual
'
test_expect_success '$XDG_CONFIG_HOME overrides $HOME/.config/git/attributes' '

View File

@ -26,26 +26,22 @@ test_expect_success 'show-ref' '
git show-ref refs/tags/A >actual &&
test_cmp expect actual &&
>expect &&
test_must_fail git show-ref D >actual &&
test_cmp expect actual
test_must_be_empty actual
'
test_expect_success 'show-ref -q' '
>expect &&
git show-ref -q A >actual &&
test_cmp expect actual &&
test_must_be_empty actual &&
git show-ref -q tags/A >actual &&
test_cmp expect actual &&
test_must_be_empty actual &&
git show-ref -q refs/tags/A >actual &&
test_cmp expect actual &&
test_must_be_empty actual &&
test_must_fail git show-ref -q D >actual &&
test_cmp expect actual
test_must_be_empty actual
'
test_expect_success 'show-ref --verify' '
@ -54,32 +50,28 @@ test_expect_success 'show-ref --verify' '
git show-ref --verify refs/tags/A >actual &&
test_cmp expect actual &&
>expect &&
test_must_fail git show-ref --verify A >actual &&
test_cmp expect actual &&
test_must_be_empty actual &&
test_must_fail git show-ref --verify tags/A >actual &&
test_cmp expect actual &&
test_must_be_empty actual &&
test_must_fail git show-ref --verify D >actual &&
test_cmp expect actual
test_must_be_empty actual
'
test_expect_success 'show-ref --verify -q' '
>expect &&
git show-ref --verify -q refs/tags/A >actual &&
test_cmp expect actual &&
test_must_be_empty actual &&
test_must_fail git show-ref --verify -q A >actual &&
test_cmp expect actual &&
test_must_be_empty actual &&
test_must_fail git show-ref --verify -q tags/A >actual &&
test_cmp expect actual &&
test_must_be_empty actual &&
test_must_fail git show-ref --verify -q D >actual &&
test_cmp expect actual
test_must_be_empty actual
'
test_expect_success 'show-ref -d' '
@ -113,19 +105,17 @@ test_expect_success 'show-ref -d' '
git show-ref -d --verify refs/heads/master >actual &&
test_cmp expect actual &&
>expect &&
test_must_fail git show-ref -d --verify master >actual &&
test_cmp expect actual &&
test_must_be_empty actual &&
test_must_fail git show-ref -d --verify heads/master >actual &&
test_cmp expect actual &&
test_must_be_empty actual &&
test_must_fail git show-ref --verify -d A C >actual &&
test_cmp expect actual &&
test_must_be_empty actual &&
test_must_fail git show-ref --verify -d tags/A tags/C >actual &&
test_cmp expect actual
test_must_be_empty actual
'
@ -178,10 +168,8 @@ test_expect_success 'show-ref --verify HEAD' '
git show-ref --verify HEAD >actual &&
test_cmp expect actual &&
>expect &&
git show-ref --verify -q HEAD >actual &&
test_cmp expect actual
test_must_be_empty actual
'
test_expect_success 'show-ref --verify with dangling ref' '

View File

@ -138,8 +138,7 @@ test_expect_success 'branch -d other@{u}' '
git checkout -t -b other master &&
git branch -d @{u} &&
git for-each-ref refs/heads/master >actual &&
>expect &&
test_cmp expect actual
test_must_be_empty actual
'
test_expect_success 'checkout other@{u}' '

View File

@ -48,8 +48,7 @@ test_expect_success 'Just "git add" is a no-op' '
>will-not-be-added &&
git add &&
git diff-index --name-status --cached HEAD >actual &&
>expect &&
test_cmp expect actual
test_must_be_empty actual
'
test_done

View File

@ -210,8 +210,7 @@ test_expect_success 'subdirectory ignore (toplevel)' '
cd top &&
git ls-files -o --exclude-standard
) >actual &&
>expect &&
test_cmp expect actual
test_must_be_empty actual
'
test_expect_success 'subdirectory ignore (l1/l2)' '
@ -219,8 +218,7 @@ test_expect_success 'subdirectory ignore (l1/l2)' '
cd top/l1/l2 &&
git ls-files -o --exclude-standard
) >actual &&
>expect &&
test_cmp expect actual
test_must_be_empty actual
'
test_expect_success 'subdirectory ignore (l1)' '
@ -228,8 +226,7 @@ test_expect_success 'subdirectory ignore (l1)' '
cd top/l1 &&
git ls-files -o --exclude-standard
) >actual &&
>expect &&
test_cmp expect actual
test_must_be_empty actual
'
test_expect_success 'show/hide empty ignored directory (setup)' '
@ -251,8 +248,7 @@ test_expect_success 'hide empty ignored directory with --no-empty-directory' '
cd top &&
git ls-files -o -i --exclude l1 --directory --no-empty-directory
) >actual &&
>expect &&
test_cmp expect actual
test_must_be_empty actual
'
test_expect_success 'show/hide empty ignored sub-directory (setup)' '
@ -277,8 +273,7 @@ test_expect_success 'hide empty ignored sub-directory with --no-empty-directory'
cd top &&
git ls-files -o -i --exclude l1 --directory --no-empty-directory
) >actual &&
>expect &&
test_cmp expect actual
test_must_be_empty actual
'
test_expect_success 'pattern matches prefix completely' '

View File

@ -101,8 +101,7 @@ match_with_ls_files() {
match_stdout_stderr_cmp="
tr -d '\0' <actual.raw >actual &&
>expect.err &&
test_cmp expect.err actual.err &&
test_must_be_empty actual.err &&
test_cmp expect actual"
if test "$match_expect" = 'E'

View File

@ -48,16 +48,14 @@ test_expect_success 'branch --contains master' '
test_expect_success 'branch --no-contains=master' '
git branch --no-contains=master >actual &&
>expect &&
test_cmp expect actual
test_must_be_empty actual
'
test_expect_success 'branch --no-contains master' '
git branch --no-contains master >actual &&
>expect &&
test_cmp expect actual
test_must_be_empty actual
'
@ -94,8 +92,7 @@ test_expect_success 'branch --contains with pattern implies --list' '
test_expect_success 'branch --no-contains with pattern implies --list' '
git branch --no-contains=master master >actual &&
>expect &&
test_cmp expect actual
test_must_be_empty actual
'
@ -123,8 +120,7 @@ test_expect_success 'branch --merged with pattern implies --list' '
test_expect_success 'side: branch --no-merged' '
git branch --no-merged >actual &&
>expect &&
test_cmp expect actual
test_must_be_empty actual
'
@ -152,8 +148,7 @@ test_expect_success 'master: branch --no-merged' '
test_expect_success 'branch --no-merged with pattern implies --list' '
git branch --no-merged=master master >actual &&
>expect &&
test_cmp expect actual
test_must_be_empty actual
'

View File

@ -188,9 +188,8 @@ test_expect_success 'git add --refresh with pathspec' '
git add foo bar baz && H=$(git rev-parse :foo) && git rm -f foo &&
echo "100644 $H 3 foo" | git update-index --index-info &&
test-tool chmtime -60 bar baz &&
>expect &&
git add --refresh bar >actual &&
test_cmp expect actual &&
test_must_be_empty actual &&
git diff-files --name-only >actual &&
! grep bar actual&&

View File

@ -187,9 +187,8 @@ test_expect_failure 'handle existing decomposed filenames' '
echo content >"verbatim.$Adiarnfd" &&
git -c core.precomposeunicode=false add "verbatim.$Adiarnfd" &&
git commit -m "existing decomposed file" &&
>expect &&
git ls-files --exclude-standard -o "verbatim*" >untracked &&
test_cmp expect untracked
test_must_be_empty untracked
'
# Test if the global core.precomposeunicode stops autosensing

View File

@ -74,8 +74,7 @@ test_expect_success 'diff-tree pathspec' '
tree2=$(git write-tree) &&
echo "$tree2" &&
git diff-tree -r --name-only $tree $tree2 -- pa path1/a >current &&
>expected &&
test_cmp expected current
test_must_be_empty current
'
test_expect_success 'diff-tree with wildcard shows dir also matches' '

View File

@ -93,21 +93,20 @@ test_expect_success 'another test, without options' '
git diff >out &&
test_cmp expect out &&
>expect &&
git diff -w >out &&
test_cmp expect out &&
test_must_be_empty out &&
git diff -w -b >out &&
test_cmp expect out &&
test_must_be_empty out &&
git diff -w --ignore-space-at-eol >out &&
test_cmp expect out &&
test_must_be_empty out &&
git diff -w -b --ignore-space-at-eol >out &&
test_cmp expect out &&
test_must_be_empty out &&
git diff -w --ignore-cr-at-eol >out &&
test_cmp expect out &&
test_must_be_empty out &&
tr "Q_" "\015 " <<-\EOF >expect &&
diff --git a/x b/x
@ -182,8 +181,7 @@ test_expect_success 'ignore-blank-lines: only new lines' '
test_seq 5 | sed "/3/i\\
" >x &&
git diff --ignore-blank-lines >out &&
>expect &&
test_cmp expect out
test_must_be_empty out
'
test_expect_success 'ignore-blank-lines: only new lines with space' '
@ -192,8 +190,7 @@ test_expect_success 'ignore-blank-lines: only new lines with space' '
test_seq 5 | sed "/3/i\\
" >x &&
git diff -w --ignore-blank-lines >out &&
>expect &&
test_cmp expect out
test_must_be_empty out
'
test_expect_success 'ignore-blank-lines: after change' '

View File

@ -34,9 +34,8 @@ test_expect_success POSIXPERM 'find-copies-harder is not confused by mode bits'
git add exec &&
git commit -m exec &&
git update-index --assume-unchanged exec &&
>expect &&
git diff-files --find-copies-harder -- exec >actual &&
test_cmp expect actual
test_must_be_empty actual
'
test_done

View File

@ -267,8 +267,7 @@ rerere_gc_custom_expiry_test () {
git -c "gc.rerereresolved=$right_now" \
-c "gc.rerereunresolved=$right_now" rerere gc &&
find .git/rr-cache -type f | sort >actual &&
>expect &&
test_cmp expect actual
test_must_be_empty actual
'
}
@ -536,9 +535,8 @@ test_expect_success 'multiple identical conflicts' '
# We resolved file1 and file2
git rerere &&
>expect &&
git rerere remaining >actual &&
test_cmp expect actual &&
test_must_be_empty actual &&
# We must have recorded both of them
count_pre_post 2 2 &&
@ -548,9 +546,8 @@ test_expect_success 'multiple identical conflicts' '
test_must_fail git merge six.1 &&
git rerere &&
>expect &&
git rerere remaining >actual &&
test_cmp expect actual &&
test_must_be_empty actual &&
concat_insert short 6.1 6.2 >file1.expect &&
concat_insert long 6.1 6.2 >file2.expect &&

View File

@ -340,10 +340,9 @@ test_expect_success PCRE 'log -F -E --perl-regexp --grep=<pcre> uses PCRE' '
'
test_expect_success 'log with grep.patternType configuration' '
>expect &&
git -c grep.patterntype=fixed \
log -1 --pretty=tformat:%s --grep=s.c.nd >actual &&
test_cmp expect actual
test_must_be_empty actual
'
test_expect_success 'log with grep.patternType configuration and command line' '
@ -1625,9 +1624,8 @@ test_expect_success 'log diagnoses bogus HEAD' '
'
test_expect_success 'log does not default to HEAD when rev input is given' '
>expect &&
git log --branches=does-not-exist >actual &&
test_cmp expect actual
test_must_be_empty actual
'
test_expect_success 'set up --source tests' '

View File

@ -44,15 +44,13 @@ test_expect_success !MINGW 'log --grep searches in log output encoding (latin1)'
'
test_expect_success !MINGW 'log --grep does not find non-reencoded values (utf8)' '
>expect &&
git log --encoding=utf8 --format=%s --grep=$latin1_e >actual &&
test_cmp expect actual
test_must_be_empty actual
'
test_expect_success 'log --grep does not find non-reencoded values (latin1)' '
>expect &&
git log --encoding=ISO-8859-1 --format=%s --grep=$utf8_e >actual &&
test_cmp expect actual
test_must_be_empty actual
'
test_done

View File

@ -309,9 +309,8 @@ test_expect_success 'pack reuse respects --honor-pack-keep' '
done &&
reusable_pack --honor-pack-keep >empty.pack &&
git index-pack empty.pack &&
>expect &&
git show-index <empty.idx >actual &&
test_cmp expect actual
test_must_be_empty actual
'
test_expect_success 'pack reuse respects --local' '
@ -319,17 +318,15 @@ test_expect_success 'pack reuse respects --local' '
test_when_finished "mv alt.git/objects/pack/* .git/objects/pack/" &&
reusable_pack --local >empty.pack &&
git index-pack empty.pack &&
>expect &&
git show-index <empty.idx >actual &&
test_cmp expect actual
test_must_be_empty actual
'
test_expect_success 'pack reuse respects --incremental' '
reusable_pack --incremental >empty.pack &&
git index-pack empty.pack &&
>expect &&
git show-index <empty.idx >actual &&
test_cmp expect actual
test_must_be_empty actual
'
test_expect_success 'truncated bitmap fails gracefully' '

View File

@ -90,9 +90,8 @@ test_expect_success 'matched bogus object count' '
# Unlike above, we should notice early that the .idx is totally
# bogus, and not even enumerate its contents.
>expect &&
git cat-file --batch-all-objects --batch-check >actual &&
test_cmp expect actual &&
test_must_be_empty actual &&
# But as before, we can do the same object-access checks.
test_must_fail git cat-file blob $object &&

View File

@ -74,8 +74,7 @@ test_expect_success 'add another remote' '
git for-each-ref "--format=%(refname)" refs/remotes |
sed -e "/^refs\/remotes\/origin\//d" \
-e "/^refs\/remotes\/second\//d" >actual &&
>expect &&
test_cmp expect actual
test_must_be_empty actual
)
'
@ -112,8 +111,7 @@ test_expect_success C_LOCALE_OUTPUT 'remove remote' '
check_remote_track origin master side &&
git for-each-ref "--format=%(refname)" refs/remotes |
sed -e "/^refs\/remotes\/origin\//d" >actual &&
>expect &&
test_cmp expect actual
test_must_be_empty actual
)
'

View File

@ -155,14 +155,12 @@ test_expect_success 'die with non-2 for wrong repository even with --exit-code'
test_expect_success 'Report success even when nothing matches' '
git ls-remote other.git "refs/nsn/*" >actual &&
>expect &&
test_cmp expect actual
test_must_be_empty actual
'
test_expect_success 'Report no-match with --exit-code' '
test_expect_code 2 git ls-remote --exit-code other.git "refs/nsn/*" >actual &&
>expect &&
test_cmp expect actual
test_must_be_empty actual
'
test_expect_success 'Report match with --exit-code' '

View File

@ -152,7 +152,6 @@ test_expect_success 'git fetch --multiple (ignoring skipFetchAll)' '
'
test_expect_success 'git fetch --all --no-tags' '
>expect &&
git clone one test5 &&
git clone test5 test6 &&
(cd test5 && git tag test-tag) &&
@ -161,7 +160,7 @@ test_expect_success 'git fetch --all --no-tags' '
git fetch --all --no-tags &&
git tag >output
) &&
test_cmp expect test6/output
test_must_be_empty test6/output
'
test_expect_success 'git fetch --all --tags' '

View File

@ -142,9 +142,8 @@ test_expect_success 'push to delete (protected, forced)' '
cd dst &&
git push --force --force-with-lease=master:master^ origin :master
) &&
>expect &&
git ls-remote src refs/heads/master >actual &&
test_cmp expect actual
test_must_be_empty actual
'
test_expect_success 'push to delete (allowed)' '
@ -154,9 +153,8 @@ test_expect_success 'push to delete (allowed)' '
git push --force-with-lease=master origin :master 2>err &&
grep deleted err
) &&
>expect &&
git ls-remote src refs/heads/master >actual &&
test_cmp expect actual
test_must_be_empty actual
'
test_expect_success 'cover everything with default force-with-lease (protected)' '

View File

@ -97,8 +97,7 @@ test_expect_success 'clone with --no-tags' '
git fetch &&
git for-each-ref refs/tags >../actual
) &&
>expect &&
test_cmp expect actual
test_must_be_empty actual
'
test_expect_success '--single-branch while HEAD pointing at master' '
@ -140,8 +139,7 @@ test_expect_success '--single-branch while HEAD pointing at master and --no-tags
git fetch &&
git for-each-ref refs/tags >../actual
) &&
>expect &&
test_cmp expect actual &&
test_must_be_empty actual &&
test_line_count = 0 actual &&
# get tags with --tags overrides tagOpt
(
@ -230,8 +228,7 @@ test_expect_success '--single-branch with detached' '
-e "s|/remotes/origin/|/heads/|" >../actual
) &&
# nothing
>expect &&
test_cmp expect actual
test_must_be_empty actual
'
test_done

View File

@ -58,8 +58,7 @@ test_expect_success 'rev-list A..B and rev-list ^A B are the same' '
test_expect_success 'propagate uninteresting flag down correctly' '
git rev-list --objects ^HEAD^{tree} HEAD^{tree} >actual &&
>expect &&
test_cmp expect actual
test_must_be_empty actual
'
test_expect_success 'symleft flag bit is propagated down from tag' '

View File

@ -31,8 +31,7 @@ test_expect_success setup '
test_expect_success 'one is ancestor of others and should not be shown' '
git rev-list one --not four >result &&
>expect &&
test_cmp expect result
test_must_be_empty result
'
@ -144,8 +143,7 @@ test_expect_success 'ancestors with the same commit time' '
test_commit t$i
done &&
git rev-list t1^! --not t$i >result &&
>expect &&
test_cmp expect result
test_must_be_empty result
'
test_done

View File

@ -256,31 +256,27 @@ test_expect_success 'rev-list accumulates multiple --exclude' '
'
test_expect_failure 'rev-list should succeed with empty output on empty stdin' '
>expect &&
git rev-list --stdin <expect >actual &&
test_cmp expect actual
test_must_be_empty actual
'
test_expect_success 'rev-list should succeed with empty output with all refs excluded' '
>expect &&
git rev-list --exclude=* --all >actual &&
test_cmp expect actual
test_must_be_empty actual
'
test_expect_success 'rev-list should succeed with empty output with empty --all' '
(
test_create_repo empty &&
cd empty &&
>expect &&
git rev-list --all >actual &&
test_cmp expect actual
test_must_be_empty actual
)
'
test_expect_success 'rev-list should succeed with empty output with empty glob' '
>expect &&
git rev-list --glob=does-not-match-anything >actual &&
test_cmp expect actual
test_must_be_empty actual
'
test_expect_success 'shortlog accepts --glob/--tags/--remotes' '

View File

@ -95,10 +95,9 @@ test_expect_success 'rev-list --ancestry-path F...I' '
# G.t is dropped in an "-s ours" merge
test_expect_success 'rev-list G..M -- G.t' '
>expect &&
git rev-list --format=%s G..M -- G.t |
sed -e "/^commit /d" >actual &&
test_cmp expect actual
test_must_be_empty actual
'
test_expect_success 'rev-list --ancestry-path G..M -- G.t' '

View File

@ -893,8 +893,7 @@ test_expect_success 'do not follow renames for empty files' '
git mv empty1 empty2 &&
git commit -m rename &&
test_must_fail git merge empty-base &&
>expect &&
test_cmp expect empty2
test_must_be_empty empty2
'
test_done

View File

@ -44,8 +44,7 @@ test_expect_success 'read-tree does not resolve content merge' '
test_expect_success 'git merge-index git-merge-one-file resolves' '
git merge-index git-merge-one-file -a &&
git diff-files --name-only --diff-filter=U >unmerged &&
>expect &&
test_cmp expect unmerged &&
test_must_be_empty unmerged &&
test_cmp expect-merged file &&
git cat-file blob :file >file-index &&
test_cmp expect-merged file-index

View File

@ -796,9 +796,8 @@ test_expect_success ':remotename and :remoteref' '
'
test_expect_success 'for-each-ref --ignore-case ignores case' '
>expect &&
git for-each-ref --format="%(refname)" refs/heads/MASTER >actual &&
test_cmp expect actual &&
test_must_be_empty actual &&
echo refs/heads/master >expect &&
git for-each-ref --format="%(refname)" --ignore-case \

View File

@ -693,9 +693,8 @@ test_expect_success \
'
test_expect_success 'The -n 100 invocation means -n --list 100, not -n100' '
>expect &&
git tag -n 100 >actual &&
test_cmp expect actual &&
test_must_be_empty actual &&
git tag -m "A msg" 100 &&
echo "100 A msg" >expect &&
@ -974,9 +973,8 @@ test_expect_success GPG 'verifying a proper tag with --format pass and format ac
'
test_expect_success GPG 'verifying a forged tag with --format should fail silently' '
>expect &&
test_must_fail git tag -v --format="tagname : %(tag)" "forged-tag" >actual &&
test_cmp expect actual
test_must_be_empty actual
'
# blank and empty messages for signed tags:
@ -1382,9 +1380,8 @@ test_expect_success 'message in editor has initial comment: first line' '
test_expect_success \
'message in editor has initial comment: remainder' '
# remove commented lines from the remainder -- should be empty
>rest.expect &&
sed -e 1d -e "/^#/d" <actual >rest.actual &&
test_cmp rest.expect rest.actual
test_must_be_empty rest.actual
'
get_tag_header reuse $commit commit $time >expect
@ -1466,19 +1463,18 @@ test_expect_success 'checking that first commit is in all tags (relative)' "
# All the --contains tests above, but with --no-contains
test_expect_success 'checking that first commit is not listed in any tag with --no-contains (hash)' "
>expected &&
git tag -l --no-contains $hash1 v* >actual &&
test_cmp expected actual
test_must_be_empty actual
"
test_expect_success 'checking that first commit is in all tags (tag)' "
git tag -l --no-contains v1.0 v* >actual &&
test_cmp expected actual
test_must_be_empty actual
"
test_expect_success 'checking that first commit is in all tags (relative)' "
git tag -l --no-contains HEAD~2 v* >actual &&
test_cmp expected actual
test_must_be_empty actual
"
cat > expected <<EOF
@ -1606,9 +1602,8 @@ test_expect_success 'checking that --contains can be used in non-list mode' '
'
test_expect_success 'checking that initial commit is in all tags with --no-contains' "
>expected &&
git tag -l --no-contains $hash1 v* >actual &&
test_cmp expected actual
test_must_be_empty actual
"
# mixing modes and options:
@ -1905,7 +1900,6 @@ test_expect_success 'version sort with very long prerelease suffix' '
'
test_expect_success ULIMIT_STACK_SIZE '--contains and --no-contains work in a deep repo' '
>expect &&
i=1 &&
while test $i -lt 8000
do
@ -1920,7 +1914,7 @@ EOF"
git checkout master &&
git tag far-far-away HEAD^ &&
run_with_limited_stack git tag --contains HEAD >actual &&
test_cmp expect actual &&
test_must_be_empty actual &&
run_with_limited_stack git tag --no-contains HEAD >actual &&
test_line_count "-gt" 10 actual
'

View File

@ -626,12 +626,11 @@ test_expect_success TTY 'sub-commands of externals use their own pager' '
test_expect_success TTY 'external command pagers override sub-commands' '
sane_unset PAGER GIT_PAGER &&
>expect &&
>actual &&
test_config pager.external false &&
test_config pager.log "sed s/^/log:/ >actual" &&
test_terminal git --exec-path=. external log --format=%s -1 &&
test_cmp expect actual
test_must_be_empty actual
'
test_expect_success 'command with underscores does not complain' '

View File

@ -134,9 +134,8 @@ test_expect_success GPG 'verifying tag with --format' '
'
test_expect_success GPG 'verifying a forged tag with --format should fail silently' '
>expect &&
test_must_fail git verify-tag --format="tagname : %(tag)" $(cat forged1.tag) >actual-forged &&
test_cmp expect actual-forged
test_must_be_empty actual-forged
'
test_done

View File

@ -26,9 +26,8 @@ avoid_racy() {
}
status_is_clean() {
>../status.expect &&
git status --porcelain >../status.actual &&
test_cmp ../status.expect ../status.actual
test_must_be_empty ../status.actual
}
test_lazy_prereq UNTRACKED_CACHE '

View File

@ -549,8 +549,7 @@ test_expect_success 'reset -N keeps removed files as intent-to-add' '
tree=$(git write-tree) &&
git ls-tree $tree new-file >actual &&
>expect &&
test_cmp expect actual &&
test_must_be_empty actual &&
git diff --name-only >actual &&
echo new-file >expect &&
@ -563,9 +562,8 @@ test_expect_success 'reset --mixed sets up work tree' '
cd mixed_worktree &&
test_commit dummy
) &&
: >expect &&
git --git-dir=mixed_worktree/.git --work-tree=mixed_worktree reset >actual &&
test_cmp expect actual
test_must_be_empty actual
'
test_done

View File

@ -12,9 +12,8 @@ test_expect_success 'reset' '
git add a b &&
git reset &&
>expect &&
git ls-files >actual &&
test_cmp expect actual
test_must_be_empty actual
'
test_expect_success 'reset HEAD' '
@ -39,9 +38,8 @@ test_expect_success PERL 'reset -p' '
echo y >yes &&
git reset -p <yes >output &&
>expect &&
git ls-files >actual &&
test_cmp expect actual &&
test_must_be_empty actual &&
test_i18ngrep "Unstage" output
'
@ -61,9 +59,8 @@ test_expect_success 'reset --hard' '
test_when_finished "echo a >a" &&
git reset --hard &&
>expect &&
git ls-files >actual &&
test_cmp expect actual &&
test_must_be_empty actual &&
test_path_is_missing a
'

View File

@ -64,8 +64,7 @@ test_expect_success 'added submodule (subdirectory only)' "
cd sub &&
git submodule summary . >../actual
) &&
>expected &&
test_cmp expected actual
test_must_be_empty actual
"
test_expect_success 'added submodule (subdirectory with explicit path)' "

View File

@ -393,7 +393,6 @@ EOF
test_expect_success !AUTOIDENT 'do not fire editor when committer is bogus' '
>.git/result &&
>expect &&
echo >>negative &&
(
@ -403,7 +402,7 @@ test_expect_success !AUTOIDENT 'do not fire editor when committer is bogus' '
export GIT_EDITOR &&
test_must_fail git commit -e -m sample -a
) &&
test_cmp expect .git/result
test_must_be_empty .git/result
'
test_expect_success 'do not fire editor if -m <msg> was given' '

View File

@ -620,8 +620,7 @@ test_expect_success 'file with no base' '
git checkout -b test$test_count branch1 &&
test_must_fail git merge master &&
git mergetool --no-prompt --tool mybase -- both &&
>expected &&
test_cmp expected both
test_must_be_empty both
'
test_expect_success 'custom commands override built-ins' '

View File

@ -676,8 +676,7 @@ test_expect_success 'log grep (5)' '
test_expect_success 'log grep (6)' '
git log --author=-0700 --pretty=tformat:%s >actual &&
>expect &&
test_cmp expect actual
test_must_be_empty actual
'
test_expect_success 'log grep (7)' '

View File

@ -253,10 +253,9 @@ test_suppress_self () {
mv msgtxt1 msgtxt1-$3 &&
sed -e '/^$/q' msgtxt1-$3 >"msghdr1-$3" &&
>"expected-no-cc-$3" &&
(grep '^Cc:' msghdr1-$3 >"actual-no-cc-$3";
test_cmp expected-no-cc-$3 actual-no-cc-$3)
test_must_be_empty actual-no-cc-$3)
}
test_suppress_self_unquoted () {

View File

@ -2191,12 +2191,11 @@ test_expect_success 'R: --import-marks-if-exists' '
test_expect_success 'R: feature import-marks-if-exists' '
rm -f io.marks &&
>expect &&
git fast-import --export-marks=io.marks <<-\EOF &&
feature import-marks-if-exists=not_io.marks
EOF
test_cmp expect io.marks &&
test_must_be_empty io.marks &&
blob=$(echo hi | git hash-object --stdin) &&
@ -2227,13 +2226,11 @@ test_expect_success 'R: feature import-marks-if-exists' '
EOF
test_cmp expect io.marks &&
>expect &&
git fast-import --import-marks-if-exists=not_io.marks \
--export-marks=io.marks <<-\EOF &&
feature import-marks-if-exists=io.marks
EOF
test_cmp expect io.marks
test_must_be_empty io.marks
'
test_expect_success 'R: import to output marks works without any content' '