Merge branch 'ab/test-must-be-empty-for-master'
authorJunio C Hamano <gitster@pobox.com>
Mon, 20 Aug 2018 18:33:48 +0000 (11:33 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 20 Aug 2018 18:33:48 +0000 (11:33 -0700)
Test updates.

* ab/test-must-be-empty-for-master:
tests: make use of the test_must_be_empty function

15 files changed:
1  2 
t/t1507-rev-parse-upstream.sh
t/t2202-add-addremove.sh
t/t3700-add.sh
t/t4010-diff-pathspec.sh
t/t4015-diff-whitespace.sh
t/t4202-log.sh
t/t5505-remote.sh
t/t5512-ls-remote.sh
t/t7004-tag.sh
t/t7030-verify-tag.sh
t/t7063-status-untracked-cache.sh
t/t7610-mergetool.sh
t/t7810-grep.sh
t/t9001-send-email.sh
t/t9300-fast-import.sh
index 349f6e10af9ea64a0e874b863f784feab4d12386,f121890cc24e16948eb185de7c495898cbd4d9f3..fa3e4996418d6d78afa31e9be19b6c77b22cd819
@@@ -123,9 -123,9 +123,9 @@@ test_expect_success 'checkout -b new my
  
  test_expect_success 'merge my-side@{u} records the correct name' '
  (
 -      cd clone || exit
 -      git checkout master || exit
 -      git branch -D new ;# can fail but is ok
 +      cd clone &&
 +      git checkout master &&
 +      test_might_fail git branch -D new &&
        git branch -t new my-side@{u} &&
        git merge -s ours new@{u} &&
        git show -s --pretty=tformat:%s >actual &&
@@@ -138,8 -138,7 +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}' '
diff --combined t/t2202-add-addremove.sh
index 17744e8c57b8adbe976e9abe5a8c8350429e4c19,e84079d81fb75da12b8e3098c803b503247a3706..9ee659098c45fbc18dfb5ccc2292f978320c1ebb
@@@ -6,12 -6,12 +6,12 @@@ test_description='git add --all
  
  test_expect_success setup '
        (
 -              echo .gitignore
 +              echo .gitignore &&
                echo will-remove
        ) >expect &&
        (
 -              echo actual
 -              echo expect
 +              echo actual &&
 +              echo expect &&
                echo ignored
        ) >.gitignore &&
        git --literal-pathspecs add --all &&
  
  test_expect_success 'git add --all' '
        (
 -              echo .gitignore
 -              echo not-ignored
 -              echo "M .gitignore"
 -              echo "A not-ignored"
 +              echo .gitignore &&
 +              echo not-ignored &&
 +              echo "M .gitignore" &&
 +              echo "A not-ignored" &&
                echo "D will-remove"
        ) >expect &&
        >ignored &&
@@@ -48,8 -48,7 +48,7 @@@ test_expect_success 'Just "git add" is 
        >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
diff --combined t/t3700-add.sh
index 618750167aed8d99a57b2642713d12406cd2e5f6,0dc87594471e056a71ddab0784a64727954906a8..37729ba2582119047d559d22df8c522f9c0ab0f1
@@@ -156,9 -156,9 +156,9 @@@ test_expect_success 'git add with filem
  test_expect_success 'git add with filemode=0, symlinks=0 prefers stage 2 over stage 1' '
        git rm --cached -f file symlink &&
        (
 -              echo "100644 $(git hash-object -w stage1) 1     file"
 -              echo "100755 $(git hash-object -w stage2) 2     file"
 -              echo "100644 $(printf 1 | git hash-object -w -t blob --stdin) 1 symlink"
 +              echo "100644 $(git hash-object -w stage1) 1     file" &&
 +              echo "100755 $(git hash-object -w stage2) 2     file" &&
 +              echo "100644 $(printf 1 | git hash-object -w -t blob --stdin) 1 symlink" &&
                echo "120000 $(printf 2 | git hash-object -w -t blob --stdin) 2 symlink"
        ) | git update-index --index-info &&
        git config core.filemode 0 &&
@@@ -188,9 -188,8 +188,8 @@@ test_expect_success 'git add --refresh 
        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&&
@@@ -265,7 -264,7 +264,7 @@@ test_expect_success 'git add to resolv
        git reset --hard &&
        H=$(git rev-parse :1/2/a) &&
        (
 -              echo "100644 $H 1       track-this"
 +              echo "100644 $H 1       track-this" &&
                echo "100644 $H 3       track-this"
        ) | git update-index --index-info &&
        echo track-this >>.gitignore &&
diff --combined t/t4010-diff-pathspec.sh
index b7f25071cfb24408f43634d016ac785bba282614,b95cc91a3f70f6621d3b3a32ef1325ab831f7f91..281f8fad0c71687aecec7479328ce8609cda5c83
@@@ -74,8 -74,7 +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' '
@@@ -111,10 -110,10 +110,10 @@@ test_expect_success 'diff-tree -r with 
  test_expect_success 'setup submodules' '
        test_tick &&
        git init submod &&
 -      ( cd submod && test_commit first; ) &&
 +      ( cd submod && test_commit first ) &&
        git add submod &&
        git commit -m first &&
 -      ( cd submod && test_commit second; ) &&
 +      ( cd submod && test_commit second ) &&
        git add submod &&
        git commit -m second
  '
index e2dc1895ba3942954dfaba3c0af914494d2aa317,5659c2612da5a63ba48e6651ef25e8c549f2c954..35fc8b5c2aa559a40000588f9a1e2b86215cb6ef
@@@ -93,21 -93,20 +93,20 @@@ test_expect_success 'another test, with
        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 +181,7 @@@ test_expect_success 'ignore-blank-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' '
        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' '
@@@ -1223,7 -1220,7 +1220,7 @@@ test_expect_success 'plain moved code, 
        test_cmp expected actual
  '
  
 -test_expect_success 'detect permutations inside moved code -- dimmed_zebra' '
 +test_expect_success 'detect blocks of moved code' '
        git reset --hard &&
        cat <<-\EOF >lines.txt &&
                long line 1
        test_config color.diff.newMovedDimmed "normal cyan" &&
        test_config color.diff.oldMovedAlternativeDimmed "normal blue" &&
        test_config color.diff.newMovedAlternativeDimmed "normal yellow" &&
 -      git diff HEAD --no-renames --color-moved=dimmed_zebra --color |
 -              grep -v "index" |
 -              test_decode_color >actual &&
 +      git diff HEAD --no-renames --color-moved=blocks --color >actual.raw &&
 +      grep -v "index" actual.raw | test_decode_color >actual &&
 +      cat <<-\EOF >expected &&
 +      <BOLD>diff --git a/lines.txt b/lines.txt<RESET>
 +      <BOLD>--- a/lines.txt<RESET>
 +      <BOLD>+++ b/lines.txt<RESET>
 +      <CYAN>@@ -1,16 +1,16 @@<RESET>
 +      <MAGENTA>-long line 1<RESET>
 +      <MAGENTA>-long line 2<RESET>
 +      <MAGENTA>-long line 3<RESET>
 +       line 4<RESET>
 +       line 5<RESET>
 +       line 6<RESET>
 +       line 7<RESET>
 +       line 8<RESET>
 +       line 9<RESET>
 +      <CYAN>+<RESET><CYAN>long line 1<RESET>
 +      <CYAN>+<RESET><CYAN>long line 2<RESET>
 +      <CYAN>+<RESET><CYAN>long line 3<RESET>
 +      <CYAN>+<RESET><CYAN>long line 14<RESET>
 +      <CYAN>+<RESET><CYAN>long line 15<RESET>
 +      <CYAN>+<RESET><CYAN>long line 16<RESET>
 +       line 10<RESET>
 +       line 11<RESET>
 +       line 12<RESET>
 +       line 13<RESET>
 +      <MAGENTA>-long line 14<RESET>
 +      <MAGENTA>-long line 15<RESET>
 +      <MAGENTA>-long line 16<RESET>
 +      EOF
 +      test_cmp expected actual
 +
 +'
 +
 +test_expect_success 'detect permutations inside moved code -- dimmed-zebra' '
 +      # reuse setup from test before!
 +      test_config color.diff.oldMoved "magenta" &&
 +      test_config color.diff.newMoved "cyan" &&
 +      test_config color.diff.oldMovedAlternative "blue" &&
 +      test_config color.diff.newMovedAlternative "yellow" &&
 +      test_config color.diff.oldMovedDimmed "normal magenta" &&
 +      test_config color.diff.newMovedDimmed "normal cyan" &&
 +      test_config color.diff.oldMovedAlternativeDimmed "normal blue" &&
 +      test_config color.diff.newMovedAlternativeDimmed "normal yellow" &&
 +      git diff HEAD --no-renames --color-moved=dimmed-zebra --color >actual.raw &&
 +      grep -v "index" actual.raw | test_decode_color >actual &&
        cat <<-\EOF >expected &&
        <BOLD>diff --git a/lines.txt b/lines.txt<RESET>
        <BOLD>--- a/lines.txt<RESET>
@@@ -1358,8 -1312,9 +1355,8 @@@ test_expect_success 'cmd option assume
        test_config color.diff.oldMovedAlternativeDimmed "normal blue" &&
        test_config color.diff.newMovedAlternativeDimmed "normal yellow" &&
        test_config diff.colorMoved zebra &&
 -      git diff HEAD --no-renames --color-moved --color |
 -              grep -v "index" |
 -              test_decode_color >actual &&
 +      git diff HEAD --no-renames --color-moved --color >actual.raw &&
 +      grep -v "index" actual.raw | test_decode_color >actual &&
        cat <<-\EOF >expected &&
        <BOLD>diff --git a/lines.txt b/lines.txt<RESET>
        <BOLD>--- a/lines.txt<RESET>
@@@ -1437,8 -1392,9 +1434,8 @@@ test_expect_success 'move detection ign
        line 4
        line 5
        EOF
 -      git diff HEAD --no-renames --color-moved --color |
 -              grep -v "index" |
 -              test_decode_color >actual &&
 +      git diff HEAD --no-renames --color-moved --color >actual.raw &&
 +      grep -v "index" actual.raw | test_decode_color >actual &&
        cat <<-\EOF >expected &&
        <BOLD>diff --git a/lines.txt b/lines.txt<RESET>
        <BOLD>--- a/lines.txt<RESET>
        EOF
        test_cmp expected actual &&
  
 -      git diff HEAD --no-renames -w --color-moved --color |
 -              grep -v "index" |
 -              test_decode_color >actual &&
 +      git diff HEAD --no-renames --color-moved --color \
 +              --color-moved-ws=ignore-all-space >actual.raw &&
 +      grep -v "index" actual.raw | test_decode_color >actual &&
        cat <<-\EOF >expected &&
        <BOLD>diff --git a/lines.txt b/lines.txt<RESET>
        <BOLD>--- a/lines.txt<RESET>
@@@ -1500,8 -1456,9 +1497,8 @@@ test_expect_success 'move detection ign
        line 5
        EOF
  
 -      git diff HEAD --no-renames --color-moved --color |
 -              grep -v "index" |
 -              test_decode_color >actual &&
 +      git diff HEAD --no-renames --color-moved --color >actual.raw &&
 +      grep -v "index" actual.raw | test_decode_color >actual &&
        cat <<-\EOF >expected &&
        <BOLD>diff --git a/lines.txt b/lines.txt<RESET>
        <BOLD>--- a/lines.txt<RESET>
        EOF
        test_cmp expected actual &&
  
 -      git diff HEAD --no-renames -b --color-moved --color |
 -              grep -v "index" |
 -              test_decode_color >actual &&
 +      git diff HEAD --no-renames --color-moved --color \
 +              --color-moved-ws=ignore-space-change >actual.raw &&
 +      grep -v "index" actual.raw | test_decode_color >actual &&
        cat <<-\EOF >expected &&
        <BOLD>diff --git a/lines.txt b/lines.txt<RESET>
        <BOLD>--- a/lines.txt<RESET>
@@@ -1566,8 -1523,9 +1563,8 @@@ test_expect_success 'move detection ign
        # avoid cluttering the output with complaints about our eol whitespace
        test_config core.whitespace -blank-at-eol &&
  
 -      git diff HEAD --no-renames --color-moved --color |
 -              grep -v "index" |
 -              test_decode_color >actual &&
 +      git diff HEAD --no-renames --color-moved --color >actual.raw &&
 +      grep -v "index" actual.raw | test_decode_color >actual &&
        cat <<-\EOF >expected &&
        <BOLD>diff --git a/lines.txt b/lines.txt<RESET>
        <BOLD>--- a/lines.txt<RESET>
        EOF
        test_cmp expected actual &&
  
 -      git diff HEAD --no-renames --ignore-space-at-eol --color-moved --color |
 -              grep -v "index" |
 -              test_decode_color >actual &&
 +      git diff HEAD --no-renames --color-moved --color \
 +              --color-moved-ws=ignore-space-at-eol >actual.raw &&
 +      grep -v "index" actual.raw | test_decode_color >actual &&
        cat <<-\EOF >expected &&
        <BOLD>diff --git a/lines.txt b/lines.txt<RESET>
        <BOLD>--- a/lines.txt<RESET>
@@@ -1636,8 -1594,9 +1633,8 @@@ test_expect_success '--color-moved bloc
        irrelevant_line
        EOF
  
 -      git diff HEAD --color-moved=zebra --color --no-renames |
 -              grep -v "index" |
 -              test_decode_color >actual &&
 +      git diff HEAD --color-moved=zebra --color --no-renames >actual.raw &&
 +      grep -v "index" actual.raw | test_decode_color >actual &&
        cat >expected <<-\EOF &&
        <BOLD>diff --git a/bar b/bar<RESET>
        <BOLD>--- a/bar<RESET>
@@@ -1674,8 -1633,9 +1671,8 @@@ test_expect_success '--color-moved resp
        nineteen chars 456789
        EOF
  
 -      git diff HEAD --color-moved=zebra --color --no-renames |
 -              grep -v "index" |
 -              test_decode_color >actual &&
 +      git diff HEAD --color-moved=zebra --color --no-renames >actual.raw &&
 +      grep -v "index" actual.raw | test_decode_color >actual &&
        cat >expected <<-\EOF &&
        <BOLD>diff --git a/bar b/bar<RESET>
        <BOLD>--- a/bar<RESET>
@@@ -1716,8 -1676,7 +1713,8 @@@ test_expect_success '--color-moved trea
        7charsA
        EOF
  
 -      git diff HEAD --color-moved=zebra --color --no-renames | grep -v "index" | test_decode_color >actual &&
 +      git diff HEAD --color-moved=zebra --color --no-renames >actual.raw &&
 +      grep -v "index" actual.raw | test_decode_color >actual &&
        cat >expected <<-\EOF &&
        <BOLD>diff --git a/bar b/bar<RESET>
        <BOLD>--- a/bar<RESET>
@@@ -1760,146 -1719,7 +1757,146 @@@ test_expect_success 'move detection wit
  
        # nor did we mess with it another way
        git diff --submodule=diff --color | test_decode_color >expect &&
 -      test_cmp expect decoded_actual
 +      test_cmp expect decoded_actual &&
 +      rm -rf bananas &&
 +      git submodule deinit bananas
 +'
 +
 +test_expect_success 'only move detection ignores white spaces' '
 +      git reset --hard &&
 +      q_to_tab <<-\EOF >text.txt &&
 +              a long line to exceed per-line minimum
 +              another long line to exceed per-line minimum
 +              original file
 +      EOF
 +      git add text.txt &&
 +      git commit -m "add text" &&
 +      q_to_tab <<-\EOF >text.txt &&
 +              Qa long line to exceed per-line minimum
 +              Qanother long line to exceed per-line minimum
 +              new file
 +      EOF
 +
 +      # Make sure we get a different diff using -w
 +      git diff --color --color-moved -w >actual.raw &&
 +      grep -v "index" actual.raw | test_decode_color >actual &&
 +      q_to_tab <<-\EOF >expected &&
 +      <BOLD>diff --git a/text.txt b/text.txt<RESET>
 +      <BOLD>--- a/text.txt<RESET>
 +      <BOLD>+++ b/text.txt<RESET>
 +      <CYAN>@@ -1,3 +1,3 @@<RESET>
 +       Qa long line to exceed per-line minimum<RESET>
 +       Qanother long line to exceed per-line minimum<RESET>
 +      <RED>-original file<RESET>
 +      <GREEN>+<RESET><GREEN>new file<RESET>
 +      EOF
 +      test_cmp expected actual &&
 +
 +      # And now ignoring white space only in the move detection
 +      git diff --color --color-moved \
 +              --color-moved-ws=ignore-all-space,ignore-space-change,ignore-space-at-eol >actual.raw &&
 +      grep -v "index" actual.raw | test_decode_color >actual &&
 +      q_to_tab <<-\EOF >expected &&
 +      <BOLD>diff --git a/text.txt b/text.txt<RESET>
 +      <BOLD>--- a/text.txt<RESET>
 +      <BOLD>+++ b/text.txt<RESET>
 +      <CYAN>@@ -1,3 +1,3 @@<RESET>
 +      <BOLD;MAGENTA>-a long line to exceed per-line minimum<RESET>
 +      <BOLD;MAGENTA>-another long line to exceed per-line minimum<RESET>
 +      <RED>-original file<RESET>
 +      <BOLD;YELLOW>+<RESET>Q<BOLD;YELLOW>a long line to exceed per-line minimum<RESET>
 +      <BOLD;YELLOW>+<RESET>Q<BOLD;YELLOW>another long line to exceed per-line minimum<RESET>
 +      <GREEN>+<RESET><GREEN>new file<RESET>
 +      EOF
 +      test_cmp expected actual
 +'
 +
 +test_expect_success 'compare whitespace delta across moved blocks' '
 +
 +      git reset --hard &&
 +      q_to_tab <<-\EOF >text.txt &&
 +      QIndented
 +      QText across
 +      Qsome lines
 +      QBut! <- this stands out
 +      QAdjusting with
 +      QQdifferent starting
 +      Qwhite spaces
 +      QAnother outlier
 +      QQQIndented
 +      QQQText across
 +      QQQfive lines
 +      QQQthat has similar lines
 +      QQQto previous blocks, but with different indent
 +      QQQYetQAnotherQoutlierQ
 +      EOF
 +
 +      git add text.txt &&
 +      git commit -m "add text.txt" &&
 +
 +      q_to_tab <<-\EOF >text.txt &&
 +      QQIndented
 +      QQText across
 +      QQsome lines
 +      QQQBut! <- this stands out
 +      Adjusting with
 +      Qdifferent starting
 +      white spaces
 +      AnotherQoutlier
 +      QQIndented
 +      QQText across
 +      QQfive lines
 +      QQthat has similar lines
 +      QQto previous blocks, but with different indent
 +      QQYetQAnotherQoutlier
 +      EOF
 +
 +      git diff --color --color-moved --color-moved-ws=allow-indentation-change >actual.raw &&
 +      grep -v "index" actual.raw | test_decode_color >actual &&
 +
 +      q_to_tab <<-\EOF >expected &&
 +              <BOLD>diff --git a/text.txt b/text.txt<RESET>
 +              <BOLD>--- a/text.txt<RESET>
 +              <BOLD>+++ b/text.txt<RESET>
 +              <CYAN>@@ -1,14 +1,14 @@<RESET>
 +              <BOLD;MAGENTA>-QIndented<RESET>
 +              <BOLD;MAGENTA>-QText across<RESET>
 +              <BOLD;MAGENTA>-Qsome lines<RESET>
 +              <RED>-QBut! <- this stands out<RESET>
 +              <BOLD;MAGENTA>-QAdjusting with<RESET>
 +              <BOLD;MAGENTA>-QQdifferent starting<RESET>
 +              <BOLD;MAGENTA>-Qwhite spaces<RESET>
 +              <RED>-QAnother outlier<RESET>
 +              <BOLD;MAGENTA>-QQQIndented<RESET>
 +              <BOLD;MAGENTA>-QQQText across<RESET>
 +              <BOLD;MAGENTA>-QQQfive lines<RESET>
 +              <BOLD;MAGENTA>-QQQthat has similar lines<RESET>
 +              <BOLD;MAGENTA>-QQQto previous blocks, but with different indent<RESET>
 +              <RED>-QQQYetQAnotherQoutlierQ<RESET>
 +              <BOLD;CYAN>+<RESET>QQ<BOLD;CYAN>Indented<RESET>
 +              <BOLD;CYAN>+<RESET>QQ<BOLD;CYAN>Text across<RESET>
 +              <BOLD;CYAN>+<RESET>QQ<BOLD;CYAN>some lines<RESET>
 +              <GREEN>+<RESET>QQQ<GREEN>But! <- this stands out<RESET>
 +              <BOLD;CYAN>+<RESET><BOLD;CYAN>Adjusting with<RESET>
 +              <BOLD;CYAN>+<RESET>Q<BOLD;CYAN>different starting<RESET>
 +              <BOLD;CYAN>+<RESET><BOLD;CYAN>white spaces<RESET>
 +              <GREEN>+<RESET><GREEN>AnotherQoutlier<RESET>
 +              <BOLD;CYAN>+<RESET>QQ<BOLD;CYAN>Indented<RESET>
 +              <BOLD;CYAN>+<RESET>QQ<BOLD;CYAN>Text across<RESET>
 +              <BOLD;CYAN>+<RESET>QQ<BOLD;CYAN>five lines<RESET>
 +              <BOLD;CYAN>+<RESET>QQ<BOLD;CYAN>that has similar lines<RESET>
 +              <BOLD;CYAN>+<RESET>QQ<BOLD;CYAN>to previous blocks, but with different indent<RESET>
 +              <GREEN>+<RESET>QQ<GREEN>YetQAnotherQoutlier<RESET>
 +      EOF
 +
 +      test_cmp expected actual
 +'
 +
 +test_expect_success 'compare whitespace delta incompatible with other space options' '
 +      test_must_fail git diff \
 +              --color-moved-ws=allow-indentation-change,ignore-all-space \
 +              2>err &&
 +      test_i18ngrep allow-indentation-change err
  '
  
  test_done
diff --combined t/t4202-log.sh
index 05d3707e38befc214678b4010ed96b6be94f16b3,0b1cd3408b8127c267503482af82a699954b3719..153a506151e2afe3f1e047cd5a00270f1378ce14
@@@ -340,10 -340,9 +340,9 @@@ test_expect_success PCRE 'log -F -E --p
  '
  
  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' '
@@@ -1556,28 -1555,12 +1555,28 @@@ test_expect_success GPG 'setup signed b
        git commit -S -m signed_commit
  '
  
 +test_expect_success GPGSM 'setup signed branch x509' '
 +      test_when_finished "git reset --hard && git checkout master" &&
 +      git checkout -b signed-x509 master &&
 +      echo foo >foo &&
 +      git add foo &&
 +      test_config gpg.format x509 &&
 +      test_config user.signingkey $GIT_COMMITTER_EMAIL &&
 +      git commit -S -m signed_commit
 +'
 +
  test_expect_success GPG 'log --graph --show-signature' '
        git log --graph --show-signature -n1 signed >actual &&
        grep "^| gpg: Signature made" actual &&
        grep "^| gpg: Good signature" actual
  '
  
 +test_expect_success GPGSM 'log --graph --show-signature x509' '
 +      git log --graph --show-signature -n1 signed-x509 >actual &&
 +      grep "^| gpgsm: Signature made" actual &&
 +      grep "^| gpgsm: Good signature" actual
 +'
 +
  test_expect_success GPG 'log --graph --show-signature for merged tag' '
        test_when_finished "git reset --hard && git checkout master" &&
        git checkout -b plain master &&
        grep "^| | gpg: Good signature" actual
  '
  
 +test_expect_success GPGSM 'log --graph --show-signature for merged tag x509' '
 +      test_when_finished "git reset --hard && git checkout master" &&
 +      test_config gpg.format x509 &&
 +      test_config user.signingkey $GIT_COMMITTER_EMAIL &&
 +      git checkout -b plain-x509 master &&
 +      echo aaa >bar &&
 +      git add bar &&
 +      git commit -m bar_commit &&
 +      git checkout -b tagged-x509 master &&
 +      echo bbb >baz &&
 +      git add baz &&
 +      git commit -m baz_commit &&
 +      git tag -s -m signed_tag_msg signed_tag_x509 &&
 +      git checkout plain-x509 &&
 +      git merge --no-ff -m msg signed_tag_x509 &&
 +      git log --graph --show-signature -n1 plain-x509 >actual &&
 +      grep "^|\\\  merged tag" actual &&
 +      grep "^| | gpgsm: Signature made" actual &&
 +      grep "^| | gpgsm: Good signature" actual
 +'
 +
  test_expect_success GPG '--no-show-signature overrides --show-signature' '
        git log -1 --show-signature --no-show-signature signed >actual &&
        ! grep "^gpg:" actual
@@@ -1662,9 -1624,8 +1661,8 @@@ test_expect_success 'log diagnoses bogu
  '
  
  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' '
diff --combined t/t5505-remote.sh
index a6856e052b8f9e33a98a869d0b37c5977d93418f,6f8c2442bf93001167c394f1c5d4f68b294801c4..241e6a319df4cefa612b6744c79e72e5cf929462
@@@ -74,8 -74,7 +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 +111,7 @@@ test_expect_success C_LOCALE_OUTPUT 're
                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
        )
  '
  
@@@ -348,13 -346,17 +346,13 @@@ URL: $(pwd)/on
  EOF
  
  test_expect_success 'prune --dry-run' '
 -      (
 -              cd one &&
 -              git branch -m side2 side) &&
 +      git -C one branch -m side2 side &&
 +      test_when_finished "git -C one branch -m side side2" &&
        (
                cd test &&
                git remote prune --dry-run origin >output &&
                git rev-parse refs/remotes/origin/side2 &&
                test_must_fail git rev-parse refs/remotes/origin/side &&
 -      (
 -              cd ../one &&
 -              git branch -m side side2) &&
                test_i18ncmp expect output
        )
  '
@@@ -844,7 -846,7 +842,7 @@@ test_expect_success 'migrate a remote f
                git remote rename origin origin &&
                test_path_is_missing .git/branches/origin &&
                test "$(git config remote.origin.url)" = "quux" &&
 -              test "$(git config remote.origin.fetch)" = "refs/heads/foom:refs/heads/origin"
 +              test "$(git config remote.origin.fetch)" = "refs/heads/foom:refs/heads/origin" &&
                test "$(git config remote.origin.push)" = "HEAD:refs/heads/foom"
        )
  '
@@@ -872,7 -874,7 +870,7 @@@ test_expect_success 'remote prune to ca
                cd eight &&
                test_must_fail git branch nomore origin
        ) 2>err &&
 -      grep "dangling symref" err
 +      test_i18ngrep "dangling symref" err
  '
  
  test_expect_success 'show empty remote' '
diff --combined t/t5512-ls-remote.sh
index ea020040e858de0c65759e299ce9cf646573fc63,f2c05ae0b4e5149b9d1b05a8a3dd11b44d1bb2c0..bc5703ff9ba166b928199abf3085ff55a8fc09f1
@@@ -15,7 -15,7 +15,7 @@@ test_expect_success setup 
        git tag mark1.10 &&
        git show-ref --tags -d | sed -e "s/ /   /" >expected.tag &&
        (
 -              echo "$(git rev-parse HEAD)     HEAD"
 +              echo "$(git rev-parse HEAD)     HEAD" &&
                git show-ref -d | sed -e "s/ /  /"
        ) >expected.all &&
  
@@@ -105,7 -105,7 +105,7 @@@ test_expect_success 'use branch.<name>.
        git clone . other.git &&
        (
                cd other.git &&
 -              echo "$(git rev-parse HEAD)     HEAD"
 +              echo "$(git rev-parse HEAD)     HEAD" &&
                git show-ref    | sed -e "s/ /  /"
        ) >exp &&
  
@@@ -155,14 -155,12 +155,12 @@@ test_expect_success 'die with non-2 fo
  
  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' '
diff --combined t/t7004-tag.sh
index 2147938aa1b60d8b67557e0bbe3c0368ef712b69,93a6694f0e0c45fb7a52abb0b547327636f0f0e6..465eb4ea3f973943367b1c8b2e560d1b16b3c31b
@@@ -693,9 -693,8 +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 +973,8 @@@ test_expect_success GPG 'verifying a pr
  '
  
  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:
@@@ -1354,19 -1352,6 +1352,19 @@@ test_expect_success GPG 
        'test_config gpg.program echo &&
         test_must_fail git tag -s -m tail tag-gpg-failure'
  
 +# try to sign with bad user.signingkey
 +test_expect_success GPGSM \
 +      'git tag -s fails if gpgsm is misconfigured (bad key)' \
 +      'test_config user.signingkey BobTheMouse &&
 +       test_config gpg.format x509 &&
 +       test_must_fail git tag -s -m tail tag-gpg-failure'
 +
 +# try to produce invalid signature
 +test_expect_success GPGSM \
 +      'git tag -s fails if gpgsm is misconfigured (bad signature format)' \
 +      'test_config gpg.x509.program echo &&
 +       test_config gpg.format x509 &&
 +       test_must_fail git tag -s -m tail tag-gpg-failure'
  
  # try to verify without gpg:
  
@@@ -1395,9 -1380,8 +1393,8 @@@ test_expect_success 'message in editor 
  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
@@@ -1479,19 -1463,18 +1476,18 @@@ test_expect_success 'checking that firs
  
  # 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
@@@ -1619,9 -1602,8 +1615,8 @@@ test_expect_success 'checking that --co
  '
  
  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:
@@@ -1918,7 -1900,6 +1913,6 @@@ test_expect_success 'version sort with 
  '
  
  test_expect_success ULIMIT_STACK_SIZE '--contains and --no-contains work in a deep repo' '
-       >expect &&
        i=1 &&
        while test $i -lt 8000
        do
@@@ -1933,7 -1914,7 +1927,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
  '
diff --combined t/t7030-verify-tag.sh
index 99f35a5bbe47aff93121c5e6beeec2dce00d18be,1f068714c5dd36b61158342af30152b133e2c842..041e319e79aacb74ea9ec8fc20a38cc222961b6e
@@@ -41,13 -41,6 +41,13 @@@ test_expect_success GPG 'create signed 
        git tag -uB7227189 -m eighth eighth-signed-alt
  '
  
 +test_expect_success GPGSM 'create signed tags x509 ' '
 +      test_config gpg.format x509 &&
 +      test_config user.signingkey $GIT_COMMITTER_EMAIL &&
 +      echo 9 >file && test_tick && git commit -a -m "nineth gpgsm-signed" &&
 +      git tag -s -m nineth nineth-signed-x509
 +'
 +
  test_expect_success GPG 'verify and show signatures' '
        (
                for tag in initial second merge fourth-signed sixth-signed seventh-signed
        )
  '
  
 +test_expect_success GPGSM 'verify and show signatures x509' '
 +      git verify-tag nineth-signed-x509 2>actual &&
 +      grep "Good signature from" actual &&
 +      ! grep "BAD signature from" actual &&
 +      echo nineth-signed-x509 OK
 +'
 +
  test_expect_success GPG 'detect fudged signature' '
        git cat-file tag seventh-signed >raw &&
        sed -e "/^tag / s/seventh/7th forged/" raw >forged1 &&
@@@ -126,13 -112,6 +126,13 @@@ test_expect_success GPG 'verify signatu
        )
  '
  
 +test_expect_success GPGSM 'verify signatures with --raw x509' '
 +      git verify-tag --raw nineth-signed-x509 2>actual &&
 +      grep "GOODSIG" actual &&
 +      ! grep "BADSIG" actual &&
 +      echo nineth-signed-x509 OK
 +'
 +
  test_expect_success GPG 'verify multiple tags' '
        tags="fourth-signed sixth-signed seventh-signed" &&
        for i in $tags
        test_cmp expect.stderr actual.stderr
  '
  
 +test_expect_success GPGSM 'verify multiple tags x509' '
 +      tags="seventh-signed nineth-signed-x509" &&
 +      for i in $tags
 +      do
 +              git verify-tag -v --raw $i || return 1
 +      done >expect.stdout 2>expect.stderr.1 &&
 +      grep "^.GNUPG:." <expect.stderr.1 >expect.stderr &&
 +      git verify-tag -v --raw $tags >actual.stdout 2>actual.stderr.1 &&
 +      grep "^.GNUPG:." <actual.stderr.1 >actual.stderr &&
 +      test_cmp expect.stdout actual.stdout &&
 +      test_cmp expect.stderr actual.stderr
 +'
 +
  test_expect_success GPG 'verifying tag with --format' '
        cat >expect <<-\EOF &&
        tagname : fourth-signed
  '
  
  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 c9162c54f4ceab56cd9fbbb455f3030cc7ae60d9,6d8256a424dd28f2b17ff336e75dd5b01c59a000..2da57fce7b12bd9a2cfac38ba4d98fc9c4af1a4c
@@@ -26,9 -26,8 +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 '
@@@ -666,7 -665,7 +665,7 @@@ test_expect_success 'test ident field i
        mkdir ../other_worktree &&
        cp -R done dthree dtwo four three ../other_worktree &&
        GIT_WORK_TREE=../other_worktree git status 2>../err &&
 -      echo "warning: Untracked cache is disabled on this system or location." >../expect &&
 +      echo "warning: untracked cache is disabled on this system or location" >../expect &&
        test_i18ncmp ../expect ../err
  '
  
diff --combined t/t7610-mergetool.sh
index 047156e9d51141a97ad71687c6da036b5ce76548,4d46c599f8493860b9f4bcf72242b832bf7f7913..b18503de8158aa6583423f923675d415ab408e76
@@@ -57,18 -57,18 +57,18 @@@ test_expect_success 'setup' 
  
        git checkout -b delete-base branch1 &&
        mkdir -p a/a &&
 -      (echo one; echo two; echo 3; echo 4) >a/a/file.txt &&
 +      test_write_lines one two 3 4 >a/a/file.txt &&
        git add a/a/file.txt &&
        git commit -m"base file" &&
        git checkout -b move-to-b delete-base &&
        mkdir -p b/b &&
        git mv a/a/file.txt b/b/file.txt &&
 -      (echo one; echo two; echo 4) >b/b/file.txt &&
 +      test_write_lines one two 4 >b/b/file.txt &&
        git commit -a -m"move to b" &&
        git checkout -b move-to-c delete-base &&
        mkdir -p c/c &&
        git mv a/a/file.txt c/c/file.txt &&
 -      (echo one; echo two; echo 3) >c/c/file.txt &&
 +      test_write_lines one two 3 >c/c/file.txt &&
        git commit -a -m"move to c" &&
  
        git checkout -b stash1 master &&
@@@ -349,7 -349,7 +349,7 @@@ test_expect_success 'mergetool keeps te
        git checkout -b test$test_count move-to-c &&
        test_config mergetool.keepTemporaries true &&
        test_must_fail git merge move-to-b &&
 -      ! (echo a; echo n) | git mergetool a/a/file.txt &&
 +      ! test_write_lines a n | git mergetool a/a/file.txt &&
        test -d a/a &&
        cat >expect <<-\EOF &&
        file_BASE_.txt
@@@ -620,8 -620,7 +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' '
diff --combined t/t7810-grep.sh
index dcaab1557b4082adbd2507d1ca4beba629723022,fc44ec96aacbd9ed03341448a9b3bff44bce8c45..d826e24b45118d4b87a2723f540c742ac6300f44
                fi
        '
  
 +      test_expect_success "grep $L (with --column, --only-matching)" '
 +              {
 +                      echo ${HC}file:1:5:mmap
 +                      echo ${HC}file:2:5:mmap
 +                      echo ${HC}file:3:5:mmap
 +                      echo ${HC}file:3:13:mmap
 +                      echo ${HC}file:4:5:mmap
 +                      echo ${HC}file:4:13:mmap
 +                      echo ${HC}file:5:5:mmap
 +                      echo ${HC}file:5:13:mmap
 +              } >expected &&
 +              git grep --column -n -o -e mmap $H >actual &&
 +              test_cmp expected actual
 +      '
 +
        test_expect_success "grep $L (t-1)" '
                echo "${HC}t/t:1:test" >expected &&
                git grep -n -e test $H >actual &&
@@@ -691,8 -676,7 +691,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)' '
@@@ -955,9 -939,10 +954,9 @@@ test_expect_success 'grep from a subdir
  test_expect_success 'grep from a subdirectory to search wider area (2)' '
        mkdir -p s &&
        (
 -              cd s || exit 1
 -              ( git grep xxyyzz .. >out ; echo $? >status )
 -              ! test -s out &&
 -              test 1 = $(cat status)
 +              cd s &&
 +              test_expect_code 1 git grep xxyyzz .. >out &&
 +              ! test -s out
        )
  '
  
diff --combined t/t9001-send-email.sh
index b8e919e25d6b4def87a6d66db32b94e8813b1cd7,b73422449460febab9275d74449eb2b6da03257c..1ef1a19003db5c9be94197e9d6cb25110591705b
@@@ -253,10 -253,9 +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 () {
@@@ -332,7 -331,7 +331,7 @@@ test_expect_success $PREREQ 'Show all h
  
  test_expect_success $PREREQ 'Prompting works' '
        clean_fake_sendmail &&
 -      (echo "to@example.com"
 +      (echo "to@example.com" &&
         echo ""
        ) | GIT_SEND_EMAIL_NOTTY=1 git send-email \
                --smtp-server="$(pwd)/fake.sendmail" \
@@@ -509,8 -508,8 +508,8 @@@ test_expect_success $PREREQ 'Invalid In
  
  test_expect_success $PREREQ 'Valid In-Reply-To when prompting' '
        clean_fake_sendmail &&
 -      (echo "From Example <from@example.com>"
 -       echo "To Example <to@example.com>"
 +      (echo "From Example <from@example.com>" &&
 +       echo "To Example <to@example.com>" &&
         echo ""
        ) | GIT_SEND_EMAIL_NOTTY=1 git send-email \
                --smtp-server="$(pwd)/fake.sendmail" \
@@@ -2023,11 -2022,11 +2022,11 @@@ test_expect_success $PREREQ 'invoke hoo
  
                # Verify error message when a patch is rejected by the hook
                sed -e "s/add master/x/" ../0001-add-master.patch >../another.patch &&
 -              git send-email \
 +              test_must_fail git send-email \
                        --from="Example <nobody@example.com>" \
                        --to=nobody@example.com \
                        --smtp-server="$(pwd)/../fake.sendmail" \
 -                      ../another.patch 2>err
 +                      ../another.patch 2>err &&
                test_i18ngrep "rejected by sendemail-validate hook" err
        )
  '
diff --combined t/t9300-fast-import.sh
index fac33e524c760c5dedc908c02e2efc185eeed92a,f8f869e26a4caf7ec10f6f7f0c447b0cd179d9e6..40fe7e49767ac4e0bbe5686413ff2b667171747a
@@@ -2191,12 -2191,11 +2191,11 @@@ test_expect_success 'R: --import-marks-
  
  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) &&
  
        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' '
@@@ -3147,10 -3144,7 +3144,10 @@@ background_import_then_checkpoint () 
        echo $! >V.pid
        # We don't mind if fast-import has already died by the time the test
        # ends.
 -      test_when_finished "exec 8>&-; exec 9>&-; kill $(cat V.pid) || true"
 +      test_when_finished "
 +              exec 8>&-; exec 9>&-;
 +              kill $(cat V.pid) && wait $(cat V.pid)
 +              true"
  
        # Start in the background to ensure we adhere strictly to (blocking)
        # pipes writing sequence. We want to assume that the write below could