]> git.ipfire.org Git - thirdparty/git.git/commitdiff
tests: make use of the test_must_be_empty function
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Fri, 27 Jul 2018 17:48:11 +0000 (17:48 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 30 Jul 2018 18:18:41 +0000 (11:18 -0700)
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>
45 files changed:
t/t0008-ignores.sh
t/t0030-stripspace.sh
t/t0300-credentials.sh
t/t1011-read-tree-sparse-checkout.sh
t/t1306-xdg-files.sh
t/t1403-show-ref.sh
t/t1507-rev-parse-upstream.sh
t/t2202-add-addremove.sh
t/t3001-ls-files-others-exclude.sh
t/t3070-wildmatch.sh
t/t3201-branch-contains.sh
t/t3700-add.sh
t/t3910-mac-os-precompose.sh
t/t4010-diff-pathspec.sh
t/t4015-diff-whitespace.sh
t/t4039-diff-assume-unchanged.sh
t/t4200-rerere.sh
t/t4202-log.sh
t/t4210-log-i18n.sh
t/t5310-pack-bitmaps.sh
t/t5313-pack-bounds-checks.sh
t/t5505-remote.sh
t/t5512-ls-remote.sh
t/t5514-fetch-multiple.sh
t/t5533-push-cas.sh
t/t5612-clone-refspec.sh
t/t6000-rev-list-misc.sh
t/t6009-rev-list-parent.sh
t/t6018-rev-list-glob.sh
t/t6019-rev-list-ancestry-path.sh
t/t6022-merge-rename.sh
t/t6060-merge-index.sh
t/t6300-for-each-ref.sh
t/t7004-tag.sh
t/t7006-pager.sh
t/t7030-verify-tag.sh
t/t7063-status-untracked-cache.sh
t/t7102-reset.sh
t/t7106-reset-unborn-branch.sh
t/t7401-submodule-summary.sh
t/t7502-commit.sh
t/t7610-mergetool.sh
t/t7810-grep.sh
t/t9001-send-email.sh
t/t9300-fast-import.sh

index c03f155a357446338fa831e061dc58d8e5f4c657..1744cee5e996fe4e03149de3a0fb8065d2aa6d67 100755 (executable)
@@ -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' '
index bbf3e39e3d229fbda5b7e40e9caca3aba2e1f52b..b77948c618ecdd3ac654500ae2143863eccf4f9f 100755 (executable)
@@ -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 \
index 03bd31e9f22a1964551cb07d76c45ce90a3cd17e..82eaaea0f4954d22861a4733b80aebcc361aca9a 100755 (executable)
@@ -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' '
index 0c6f48f3024c81de765a8acb489e2d5e3ec42a56..ba71b159ba8ce1aae9c13d470bdceb7963da58da 100755 (executable)
@@ -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' '
index 8b14ab187c5e01a27bbc4964e3ac9d89e2eb8934..21e139a313bed1d91121044f64a5e7ce5078002c 100755 (executable)
@@ -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' '
index 30354fd26c0cf6b6e2a6c01bc2bcbef48168e562..5d955c3bff2ce9c276acd363f7c906565333da79 100755 (executable)
@@ -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' '
index 93c77eac45321cb24823431c4d89dc393049edbf..f121890cc24e16948eb185de7c495898cbd4d9f3 100755 (executable)
@@ -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}' '
index 6a5a3166b1823e751dfe19a28bf54c147dd798b3..e84079d81fb75da12b8e3098c803b503247a3706 100755 (executable)
@@ -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
index 3fc484e8c3f8d910f02e409baf7bf1d5682b4f2f..3b47647ed56aa88b35227ef295e6a3432e5ab8f1 100755 (executable)
@@ -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' '
index dce102130fb77ddda7cdc9aa9211507d9c2f2e09..46aca0af102e863f8c46f160d3f2022aee5ba29e 100755 (executable)
@@ -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'
index 0ef1b6fdcc420d6fac2cbe0abd5f1ec6ebec90c6..0ea4fc46949daf8d9522ff9ae52d8583ca5e9754 100755 (executable)
@@ -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
 
 '
 
index 07af05d7aee65c51245431292a21ec38eef19f53..0dc87594471e056a71ddab0784a64727954906a8 100755 (executable)
@@ -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&&
index 26dd5b7f78a7f7e65ddda24c4686d2ae26fc30de..54ce19e353d924de08d4242f519fef7a44ce4787 100755 (executable)
@@ -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
index 35b35a81c8ce38b3fe29f33412d2e7c9ff1bf68d..b95cc91a3f70f6621d3b3a32ef1325ab831f7f91 100755 (executable)
@@ -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' '
index 17df491a3abe84fca63bb899d1162832d13e1847..5659c2612da5a63ba48e6651ef25e8c549f2c954 100755 (executable)
@@ -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' '
index 23c0e357a765f00d807938fccf81a250c371ec4f..53ac44b0f0036803b48979c3c5f343ca02b1b80a 100755 (executable)
@@ -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
index 8417e5a4b105a54a8de23af8bae2bdaf28c257cb..65da74c76683c0ccd109fdec63766ab6bdfb08f0 100755 (executable)
@@ -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 &&
index 25b1f8cc73bc35bedaaffeacbb75a1329d725c3b..0b1cd3408b8127c267503482af82a699954b3719 100755 (executable)
@@ -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' '
index e585fe6129b7af264427d8af46de21cb08efad7f..7c519436ef3d2ed4843d173948c8fcac1069cffe 100755 (executable)
@@ -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
index 2d22a17c4a7f9dcc402e89e73ce01c97ebd4ba48..6ee4d3f2d91f435ad29010b16523ea4417dc625d 100755 (executable)
@@ -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' '
index 4fe4ad9d6166d9a82cb944fadfc0317b5052b973..f1708d415e55c25be441ae47f865fbe7f5973c93 100755 (executable)
@@ -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 &&
index a6c0178f3af6c3e3f01816197e51e9bca546b00a..6f8c2442bf93001167c394f1c5d4f68b294801c4 100755 (executable)
@@ -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
        )
 '
 
index 6a949484d090ea2df02603f9d82bf4f203a799e9..f2c05ae0b4e5149b9d1b05a8a3dd11b44d1bb2c0 100755 (executable)
@@ -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' '
index 4b4b6673b8fe25d96044cdc5d1196b191a7ae0e9..0030c92e1afa2a83066944272fcf3925f821bc54 100755 (executable)
@@ -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' '
index d38ecee2172a6e5599cfbeb18e472816e98e553c..0b0eb1d0259f314261c131db8e089e6859a7f3ba 100755 (executable)
@@ -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)' '
index fac5a738519fe4aec0c3b2328c410db693c11f63..5582b3d5fd7118398bad00e43864d9e73c055f01 100755 (executable)
@@ -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
index 969e4e9e5261640dc690806ed06f8e58e760633f..fb4d295aa0f17c6aa967555ed92b4bc02884a9b3 100755 (executable)
@@ -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' '
index 20e3e2554a132552b5e398a2c449cedbef6ccb1e..916d9692bc05fdc87b28b7dbd4afdb173dd1d244 100755 (executable)
@@ -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
index d3453c583c1921a10409c16b5e2cf949edde6cd2..02936c2f24aeaa3961bc11c623b7fd25d3280c43 100755 (executable)
@@ -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' '
index dabebaee0b7b474387d4bc9b466b969624822d6d..beadaf6cca054bc2d821be19b4358286c6107165 100755 (executable)
@@ -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' '
index b760c223c6a56609b7dace5353671aec8243b85d..53cc9b2ffbdbc551c358c8d5d1d4185ef63f0c0b 100755 (executable)
@@ -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
index debadbd299c02630097a3f476729719d4d71a10c..ddf34f0115b08b401a8981099459d10e1b1c4a02 100755 (executable)
@@ -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
index e0496da812f34df16ef7c3417788f9096ddc1e0f..024f8c06f7c58a424204d6fca69021ace2de3cbf 100755 (executable)
@@ -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 \
index d7b319e919c83ca677737840f70075c173364209..93a6694f0e0c45fb7a52abb0b547327636f0f0e6 100755 (executable)
@@ -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
 '
index 7541ba5edbcae1f1555c367b7f8bfc795913ff60..00e09a375c2e6e3bfce2c2f8ce93493513082b2d 100755 (executable)
@@ -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' '
index 291a1e2b07417559d3f3defd6a60043b505eb3c7..1f068714c5dd36b61158342af30152b133e2c842 100755 (executable)
@@ -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
index c61e304e97376b09de51299a797dfb388335a365..6d8256a424dd28f2b17ff336e75dd5b01c59a000 100755 (executable)
@@ -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 '
index 95653a08cade25fb6edd7dcc479fb102d800f534..97be0d968dbcedba226b39862faddd23da39d863 100755 (executable)
@@ -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
index 0f95f004777ac3db191264fc5760c17bc1bdf77b..ecb85c3b823275efc68fb64643a4304a3cbf28b2 100755 (executable)
@@ -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
 '
 
index 4e4c45550262ca75b36d15e80aa1f4bffc45465f..1cd12b38c53c7fdfedb937151d961527aa990dbd 100755 (executable)
@@ -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)' "
index d33a3cb331b6c022343aff0bb7091cf8219b40df..ca4a740da0258b5522f29051c3d18632d1bafa1b 100755 (executable)
@@ -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' '
index 1a430b9c40d477dd7a399c165585444818f471cf..4d46c599f8493860b9f4bcf72242b832bf7f7913 100755 (executable)
@@ -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' '
index 9312c8daf523abd3da1681e8777648c71401e2ae..fc44ec96aacbd9ed03341448a9b3bff44bce8c45 100755 (executable)
@@ -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)' '
index 1da282c415b81215ddb149f6230ff2a5a8eb4c95..b73422449460febab9275d74449eb2b6da03257c 100755 (executable)
@@ -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 () {
index 9e7f96223dc2222c48b172711b4b469ff08190c8..f8f869e26a4caf7ec10f6f7f0c447b0cd179d9e6 100755 (executable)
@@ -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' '