Merge branch 'sg/test-must-be-empty'
authorJunio C Hamano <gitster@pobox.com>
Mon, 27 Aug 2018 21:33:43 +0000 (14:33 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 27 Aug 2018 21:33:43 +0000 (14:33 -0700)
Test fixes.

* sg/test-must-be-empty:
tests: use 'test_must_be_empty' instead of 'test_cmp <empty> <out>'
tests: use 'test_must_be_empty' instead of 'test_cmp /dev/null <out>'
tests: use 'test_must_be_empty' instead of 'test ! -s'
tests: use 'test_must_be_empty' instead of '! test -s'

32 files changed:
1  2 
t/t0000-basic.sh
t/t0001-init.sh
t/t0003-attributes.sh
t/t0090-cache-tree.sh
t/t1300-config.sh
t/t1411-reflog-show.sh
t/t1450-fsck.sh
t/t1700-split-index.sh
t/t3210-pack-refs.sh
t/t3301-notes.sh
t/t3310-notes-merge-manual-resolve.sh
t/t3404-rebase-interactive.sh
t/t3600-rm.sh
t/t4015-diff-whitespace.sh
t/t4041-diff-submodule-option.sh
t/t4060-diff-submodule-option-diff-format.sh
t/t4150-am.sh
t/t4211-line-log.sh
t/t5401-update-hooks.sh
t/t5500-fetch-pack.sh
t/t5526-fetch-submodules.sh
t/t5541-http-push-smart.sh
t/t5570-git-daemon.sh
t/t7001-mv.sh
t/t7004-tag.sh
t/t7201-co.sh
t/t7400-submodule-basic.sh
t/t7501-commit.sh
t/t7610-mergetool.sh
t/t7810-grep.sh
t/t9200-git-cvsexportcommit.sh
t/t9903-bash-prompt.sh
diff --combined t/t0000-basic.sh
index 34859fe4a59fdbb48273f4b9e4f16e878b421349,4e588eda092546c0898de5cb372efee2326341be..850f651e4e434084bbc8995fcfb3bb001d83875c
@@@ -116,7 -116,7 +116,7 @@@ check_sub_test_lib_test () 
        name="$1" # stdin is the expected output from the test
        (
                cd "$name" &&
-               ! test -s err &&
+               test_must_be_empty err &&
                sed -e 's/^> //' -e 's/Z$//' >expect &&
                test_cmp expect out
        )
@@@ -1081,7 -1081,7 +1081,7 @@@ test_expect_success 'very long name in 
        (
                git ls-files -s path4 |
                sed -e "s/      .*/     /" |
 -              tr -d "\012"
 +              tr -d "\012" &&
                echo "$a"
        ) | git update-index --index-info &&
        len=$(git ls-files "a*" | wc -c) &&
diff --combined t/t0001-init.sh
index ca85aae51ed1c528d1b93e7fea5f53ecb8095851,28f34fd3bd3c0ab2b24138fcaff413823208f5a1..182da069f1743b8a06b65396599f94530080e67f
@@@ -167,9 -167,8 +167,8 @@@ test_expect_success 'reinit' 
        ) &&
        test_i18ngrep "Initialized empty" again/out1 &&
        test_i18ngrep "Reinitialized existing" again/out2 &&
-       >again/empty &&
-       test_i18ncmp again/empty again/err1 &&
-       test_i18ncmp again/empty again/err2
+       test_must_be_empty again/err1 &&
+       test_must_be_empty again/err2
  '
  
  test_expect_success 'init with --template' '
@@@ -408,7 -407,7 +407,7 @@@ is_hidden () 
  test_expect_success MINGW '.git hidden' '
        rm -rf newdir &&
        (
 -              unset GIT_DIR GIT_WORK_TREE
 +              sane_unset GIT_DIR GIT_WORK_TREE &&
                mkdir newdir &&
                cd newdir &&
                git init &&
  test_expect_success MINGW 'bare git dir not hidden' '
        rm -rf newdir &&
        (
 -              unset GIT_DIR GIT_WORK_TREE GIT_CONFIG
 +              sane_unset GIT_DIR GIT_WORK_TREE GIT_CONFIG &&
                mkdir newdir &&
                cd newdir &&
                git --bare init
diff --combined t/t0003-attributes.sh
index 5c37c2e1f8c3e96ae72dea1c7a5eef556fb18d00,ee2f5c238916961e19c29376e8e1744615ce076b..22499bce5f50637e574961f744b567b974a4d3d0
@@@ -34,15 -34,15 +34,15 @@@ test_expect_success 'open-quoted pathna
  test_expect_success 'setup' '
        mkdir -p a/b/d a/c b &&
        (
 -              echo "[attr]notest !test"
 -              echo "\" d \"   test=d"
 -              echo " e        test=e"
 -              echo " e\"      test=e"
 -              echo "f test=f"
 -              echo "a/i test=a/i"
 -              echo "onoff test -test"
 -              echo "offon -test test"
 -              echo "no notest"
 +              echo "[attr]notest !test" &&
 +              echo "\" d \"   test=d" &&
 +              echo " e        test=e" &&
 +              echo " e\"      test=e" &&
 +              echo "f test=f" &&
 +              echo "a/i test=a/i" &&
 +              echo "onoff test -test" &&
 +              echo "offon -test test" &&
 +              echo "no notest" &&
                echo "A/e/F test=A/e/F"
        ) >.gitattributes &&
        (
@@@ -51,7 -51,7 +51,7 @@@
        ) >a/.gitattributes &&
        (
                echo "h test=a/b/h" &&
 -              echo "d/* test=a/b/d/*"
 +              echo "d/* test=a/b/d/*" &&
                echo "d/yes notest"
        ) >a/b/.gitattributes &&
        (
@@@ -208,9 -208,8 +208,8 @@@ test_expect_success 'attribute test: --
  '
  
  test_expect_success 'attribute test: --cached option' '
-       : >empty &&
        git check-attr --cached --stdin --all <stdin-all | sort >actual &&
-       test_cmp empty actual &&
+       test_must_be_empty actual &&
        git add .gitattributes a/.gitattributes a/b/.gitattributes &&
        git check-attr --cached --stdin --all <stdin-all | sort >actual &&
        test_cmp specified-all actual
@@@ -287,7 -286,7 +286,7 @@@ test_expect_success 'bare repository: c
        (
                cd bare.git &&
                (
 -                      echo "f test=f"
 +                      echo "f test=f" &&
                        echo "a/i test=a/i"
                ) >.gitattributes &&
                attr_check f unspecified &&
@@@ -312,7 -311,7 +311,7 @@@ test_expect_success 'bare repository: t
        (
                cd bare.git &&
                (
 -                      echo "f test=f"
 +                      echo "f test=f" &&
                        echo "a/i test=a/i"
                ) >info/attributes &&
                attr_check f f &&
diff --combined t/t0090-cache-tree.sh
index 28ea93f509c0a9a932897e45316be9f188ad4259,9e88a56d619ca33a24089ec1208e6726d76f6256..7de40141ca84dc53657d81c0254870b387339f79
@@@ -156,7 -156,7 +156,7 @@@ test_expect_success PERL 'commit --inte
                return 44;
        }
        EOT
 -      (echo p; echo 1; echo; echo s; echo n; echo y; echo q) |
 +      test_write_lines p 1 "" s n y q |
        git commit --interactive -m foo &&
        test_cache_tree
  '
@@@ -239,7 -239,7 +239,7 @@@ test_expect_success 'no phantom error w
        >newdir/one &&
        git add newdir/one &&
        git checkout 2>errors &&
-       ! test -s errors
+       test_must_be_empty errors
  '
  
  test_expect_success 'switching trees does not invalidate shared index' '
diff --combined t/t1300-config.sh
index 4976e2fcd3fc8be5b39ff44f662dfc71c6cabdc9,84e88cf5a93b167815a1691d640c16b845e9514a..cdf1fed5d1c33e659b5d2c9bfb64423b13f05e94
@@@ -346,12 -346,9 +346,9 @@@ test_expect_success 'working --list' 
        git config --list > output &&
        test_cmp expect output
  '
- cat > expect << EOF
- EOF
  test_expect_success '--list without repo produces empty output' '
        git --git-dir=nonexistent config --list >output &&
-       test_cmp expect output
+       test_must_be_empty output
  '
  
  cat > expect << EOF
@@@ -888,7 -885,7 +885,7 @@@ EO
  
  test_expect_success !MINGW 'get --path copes with unset $HOME' '
        (
 -              unset HOME;
 +              sane_unset HOME &&
                test_must_fail git config --get --path path.home \
                        >result 2>msg &&
                git config --get --path path.normal >>result &&
@@@ -1218,93 -1215,6 +1215,93 @@@ test_expect_success 'last one wins: thr
        test_cmp expect actual
  '
  
 +test_expect_success 'old-fashioned settings are case insensitive' '
 +      test_when_finished "rm -f testConfig testConfig_expect testConfig_actual" &&
 +
 +      cat >testConfig_actual <<-EOF &&
 +              [V.A]
 +              r = value1
 +      EOF
 +      q_to_tab >testConfig_expect <<-EOF &&
 +              [V.A]
 +              Qr = value2
 +      EOF
 +      git config -f testConfig_actual "v.a.r" value2 &&
 +      test_cmp testConfig_expect testConfig_actual &&
 +
 +      cat >testConfig_actual <<-EOF &&
 +              [V.A]
 +              r = value1
 +      EOF
 +      q_to_tab >testConfig_expect <<-EOF &&
 +              [V.A]
 +              QR = value2
 +      EOF
 +      git config -f testConfig_actual "V.a.R" value2 &&
 +      test_cmp testConfig_expect testConfig_actual &&
 +
 +      cat >testConfig_actual <<-EOF &&
 +              [V.A]
 +              r = value1
 +      EOF
 +      q_to_tab >testConfig_expect <<-EOF &&
 +              [V.A]
 +              r = value1
 +              Qr = value2
 +      EOF
 +      git config -f testConfig_actual "V.A.r" value2 &&
 +      test_cmp testConfig_expect testConfig_actual &&
 +
 +      cat >testConfig_actual <<-EOF &&
 +              [V.A]
 +              r = value1
 +      EOF
 +      q_to_tab >testConfig_expect <<-EOF &&
 +              [V.A]
 +              r = value1
 +              Qr = value2
 +      EOF
 +      git config -f testConfig_actual "v.A.r" value2 &&
 +      test_cmp testConfig_expect testConfig_actual
 +'
 +
 +test_expect_success 'setting different case sensitive subsections ' '
 +      test_when_finished "rm -f testConfig testConfig_expect testConfig_actual" &&
 +
 +      cat >testConfig_actual <<-EOF &&
 +              [V "A"]
 +              R = v1
 +              [K "E"]
 +              Y = v1
 +              [a "b"]
 +              c = v1
 +              [d "e"]
 +              f = v1
 +      EOF
 +      q_to_tab >testConfig_expect <<-EOF &&
 +              [V "A"]
 +              Qr = v2
 +              [K "E"]
 +              Qy = v2
 +              [a "b"]
 +              Qc = v2
 +              [d "e"]
 +              f = v1
 +              [d "E"]
 +              Qf = v2
 +      EOF
 +      # exact match
 +      git config -f testConfig_actual a.b.c v2 &&
 +      # match section and subsection, key is cased differently.
 +      git config -f testConfig_actual K.E.y v2 &&
 +      # section and key are matched case insensitive, but subsection needs
 +      # to match; When writing out new values only the key is adjusted
 +      git config -f testConfig_actual v.A.r v2 &&
 +      # subsection is not matched:
 +      git config -f testConfig_actual d.E.f v2 &&
 +      test_cmp testConfig_expect testConfig_actual
 +'
 +
  for VAR in a .a a. a.0b a."b c". a."b c".0d
  do
        test_expect_success "git -c $VAR=VAL rejects invalid '$VAR'" '
diff --combined t/t1411-reflog-show.sh
index 4d62ceef9c15cc981bada757bcf7cfa43f2dd9a5,26590f9a217f210726563da5d1bed5014d5f968c..985daf1def366fd1aa928bd2ddeeca454c4702ca
@@@ -136,13 -136,12 +136,12 @@@ test_expect_success '--date magic does 
        test_cmp expect actual
  '
  
- : >expect
  test_expect_success 'empty reflog file' '
        git branch empty &&
        git reflog expire --expire=all refs/heads/empty &&
  
        git log -g empty >actual &&
-       test_cmp expect actual
+       test_must_be_empty actual
  '
  
  # This guards against the alternative of showing the diffs vs. the
@@@ -159,9 -158,9 +158,9 @@@ test_expect_success 'git log -g -p show
        git log -1 -p HEAD^ >log.one &&
        git log -1 -p HEAD >log.two &&
        (
 -              cat log.one; echo
 -              cat log.two; echo
 -              cat log.one; echo
 +              cat log.one && echo &&
 +              cat log.two && echo &&
 +              cat log.one && echo &&
                cat log.two
        ) >expect &&
        test_cmp expect actual
diff --combined t/t1450-fsck.sh
index 7b7602ddb453de7104ae3c64a08c96e74b465aa4,a652f6002a1992592a2aa30d1ee88e99a14e22d8..0f2dd26f74b4b2c19474ad563e7c34701838cb46
@@@ -16,8 -16,7 +16,7 @@@ test_expect_success setup 
        git checkout HEAD^0 &&
        test_commit B fileB two &&
        git tag -d A B &&
-       git reflog expire --expire=now --all &&
-       >empty
+       git reflog expire --expire=now --all
  '
  
  test_expect_success 'loose objects borrowed from alternate are not missing' '
                test_commit C fileC one &&
                git fsck --no-dangling >../actual 2>&1
        ) &&
-       test_cmp empty actual
+       test_must_be_empty actual
  '
  
  test_expect_success 'HEAD is part of refs, valid objects appear valid' '
        git fsck >actual 2>&1 &&
-       test_cmp empty actual
+       test_must_be_empty actual
  '
  
  # Corruption tests follow.  Make sure to remove all traces of the
@@@ -346,12 -345,12 +345,12 @@@ test_expect_success 'tag with NUL in he
  
  test_expect_success 'cleaned up' '
        git fsck >actual 2>&1 &&
-       test_cmp empty actual
+       test_must_be_empty actual
  '
  
  test_expect_success 'rev-list --verify-objects' '
        git rev-list --verify-objects --all >/dev/null 2>out &&
-       test_cmp empty out
+       test_must_be_empty out
  '
  
  test_expect_success 'rev-list --verify-objects with bad sha1' '
  
        test_might_fail git rev-list --verify-objects refs/heads/bogus >/dev/null 2>out &&
        cat out &&
 -      grep -q "error: sha1 mismatch 63ffffffffffffffffffffffffffffffffffffff" out
 +      test_i18ngrep -q "error: sha1 mismatch 63ffffffffffffffffffffffffffffffffffffff" out
  '
  
  test_expect_success 'force fsck to ignore double author' '
diff --combined t/t1700-split-index.sh
index 39133bcbc85239183c3d73596f76f0486aeefcfe,f85ba5780397cdca3d3b22ca453f153f43ae86ae..b3b4d83eafc4a031618a3a89fd8ca50353f1a844
@@@ -143,9 -143,7 +143,7 @@@ test_expect_success 'remove file not i
  test_expect_success 'remove file in base index' '
        git update-index --force-remove one &&
        git ls-files --stage >ls-files.actual &&
-       cat >ls-files.expect <<-EOF &&
-       EOF
-       test_cmp ls-files.expect ls-files.actual &&
+       test_must_be_empty ls-files.actual &&
  
        test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
        cat >expect <<-EOF &&
@@@ -435,7 -433,7 +433,7 @@@ test_expect_success 'writing split inde
        commit=$(git commit-tree $tree -p HEAD <msg) &&
        git update-ref HEAD "$commit" &&
        GIT_ALLOW_NULL_SHA1=1 git reset --hard &&
 -      (test-tool dump-cache-tree >cache-tree.out || true) &&
 +      test_might_fail test-tool dump-cache-tree >cache-tree.out &&
        test_line_count = 0 cache-tree.out
  '
  
diff --combined t/t3210-pack-refs.sh
index 7333d7d5459179ab306d29fc04e7d088d75412af,112cbb0e6264bd2e23e159fc992d492ea13413de..9ea5fa4fd246374d6c49dfc35c12cfdbd84957c2
@@@ -127,7 -127,7 +127,7 @@@ test_expect_success 'explicit pack-ref
        git reflog expire --expire=all --all &&
        git prune --expire=all &&
        git pack-refs --all 2>result &&
-       test_cmp /dev/null result
+       test_must_be_empty result
  '
  
  test_expect_success 'delete ref with dangling packed version' '
        git reflog expire --expire=all --all &&
        git prune --expire=all &&
        git branch -d lamb 2>result &&
-       test_cmp /dev/null result
+       test_must_be_empty result
  '
  
  test_expect_success 'delete ref while another dangling packed ref' '
        git reflog expire --expire=all --all &&
        git prune --expire=all &&
        git branch -d lamb 2>result &&
-       test_cmp /dev/null result
+       test_must_be_empty result
  '
  
  test_expect_success 'pack ref directly below refs/' '
@@@ -186,7 -186,7 +186,7 @@@ test_expect_success 'notice d/f conflic
  
  test_expect_success 'existing directory reports concrete ref' '
        test_must_fail git branch foo 2>stderr &&
 -      grep refs/heads/foo/bar/baz stderr
 +      test_i18ngrep refs/heads/foo/bar/baz stderr
  '
  
  test_expect_success 'notice d/f conflict with existing ref' '
@@@ -231,9 -231,9 +231,9 @@@ test_expect_success 'timeout if packed-
  test_expect_success 'retry acquiring packed-refs.lock' '
        LOCK=.git/packed-refs.lock &&
        >"$LOCK" &&
 -      test_when_finished "wait; rm -f $LOCK" &&
 +      test_when_finished "wait && rm -f $LOCK" &&
        {
 -              ( sleep 1 ; rm -f $LOCK ) &
 +              ( sleep 1 && rm -f $LOCK ) &
        } &&
        git -c core.packedrefstimeout=3000 pack-refs --all --prune
  '
diff --combined t/t3301-notes.sh
index ac62dc0e8fdc4602fb006919f0c0b62a015964bd,e5703a0d5b42fb8a76ca85aae77fe312369ea61c..84bbf88cf9d0cf8e2887abc6ef3a4c597ba4aa3a
@@@ -481,10 -481,8 +481,8 @@@ test_expect_success 'list specific not
  '
  
  test_expect_success 'listing non-existing notes fails' '
-       cat >expect <<-EOF &&
-       EOF
        test_must_fail git notes list HEAD >actual &&
-       test_cmp expect actual
+       test_must_be_empty actual
  '
  
  test_expect_success 'append to existing note with "git notes append"' '
@@@ -914,7 -912,7 +912,7 @@@ test_expect_success 'git notes copy --s
                ${indent}
                ${indent}yet another note
        EOF
 -      (echo $(git rev-parse HEAD~3) $(git rev-parse HEAD^); \
 +      (echo $(git rev-parse HEAD~3) $(git rev-parse HEAD^) &&
        echo $(git rev-parse HEAD~2) $(git rev-parse HEAD)) |
        git notes copy --stdin &&
        git log -2 >actual &&
@@@ -939,7 -937,7 +937,7 @@@ test_expect_success 'git notes copy --f
        EOF
        test_commit 14th &&
        test_commit 15th &&
 -      (echo $(git rev-parse HEAD~3) $(git rev-parse HEAD^); \
 +      (echo $(git rev-parse HEAD~3) $(git rev-parse HEAD^) &&
        echo $(git rev-parse HEAD~2) $(git rev-parse HEAD)) |
        git notes copy --for-rewrite=foo &&
        git log -2 >actual &&
@@@ -972,7 -970,7 +970,7 @@@ test_expect_success 'git notes copy --f
        EOF
        test_config notes.rewriteMode overwrite &&
        test_config notes.rewriteRef "refs/notes/*" &&
 -      (echo $(git rev-parse HEAD~3) $(git rev-parse HEAD^); \
 +      (echo $(git rev-parse HEAD~3) $(git rev-parse HEAD^) &&
        echo $(git rev-parse HEAD~2) $(git rev-parse HEAD)) |
        git notes copy --for-rewrite=foo &&
        git log -2 >actual &&
@@@ -1059,7 -1057,7 +1057,7 @@@ test_expect_success 'git notes copy --f
        git notes add -f -m"append 2" HEAD^^ &&
        test_config notes.rewriteMode concatenate &&
        test_config notes.rewriteRef "refs/notes/*" &&
 -      (echo $(git rev-parse HEAD^) $(git rev-parse HEAD);
 +      (echo $(git rev-parse HEAD^) $(git rev-parse HEAD) &&
        echo $(git rev-parse HEAD^^) $(git rev-parse HEAD)) |
        git notes copy --for-rewrite=foo &&
        git log -1 >actual &&
index 68436eed82101cdfcc7f93fea0681083b546cf2a,a1cf4ec385b09f730a3f7951a513ba35c7128dd1..2dea846e259dbb8cd163b82f6e551c9823cbd180
@@@ -337,7 -337,7 +337,7 @@@ EO
        git notes merge --commit &&
        # No .git/NOTES_MERGE_* files left
        test_might_fail ls .git/NOTES_MERGE_* >output 2>/dev/null &&
-       test_cmp /dev/null output &&
+       test_must_be_empty output &&
        # Merge commit has pre-merge y and pre-merge z as parents
        test "$(git rev-parse refs/notes/m^1)" = "$(cat pre_merge_y)" &&
        test "$(git rev-parse refs/notes/m^2)" = "$(cat pre_merge_z)" &&
@@@ -399,7 -399,7 +399,7 @@@ test_expect_success 'abort notes merge
        git notes merge --abort &&
        # No .git/NOTES_MERGE_* files left
        test_might_fail ls .git/NOTES_MERGE_* >output 2>/dev/null &&
-       test_cmp /dev/null output &&
+       test_must_be_empty output &&
        # m has not moved (still == y)
        test "$(git rev-parse refs/notes/m)" = "$(cat pre_merge_y)" &&
        # Verify that other notes refs has not changed (w, x, y and z)
@@@ -466,7 -466,7 +466,7 @@@ EO
        git notes merge --commit &&
        # No .git/NOTES_MERGE_* files left
        test_might_fail ls .git/NOTES_MERGE_* >output 2>/dev/null &&
-       test_cmp /dev/null output &&
+       test_must_be_empty output &&
        # Merge commit has pre-merge y and pre-merge z as parents
        test "$(git rev-parse refs/notes/m^1)" = "$(cat pre_merge_y)" &&
        test "$(git rev-parse refs/notes/m^2)" = "$(cat pre_merge_z)" &&
@@@ -541,9 -541,9 +541,9 @@@ EO
        test "$(git rev-parse refs/notes/y)" = "$(git rev-parse NOTES_MERGE_PARTIAL^1)" &&
        test "$(git rev-parse refs/notes/m)" != "$(git rev-parse NOTES_MERGE_PARTIAL^1)" &&
        # Mention refs/notes/m, and its current and expected value in output
 -      grep -q "refs/notes/m" output &&
 -      grep -q "$(git rev-parse refs/notes/m)" output &&
 -      grep -q "$(git rev-parse NOTES_MERGE_PARTIAL^1)" output &&
 +      test_i18ngrep -q "refs/notes/m" output &&
 +      test_i18ngrep -q "$(git rev-parse refs/notes/m)" output &&
 +      test_i18ngrep -q "$(git rev-parse NOTES_MERGE_PARTIAL^1)" output &&
        # Verify that other notes refs has not changed (w, x, y and z)
        verify_notes w &&
        verify_notes x &&
@@@ -555,7 -555,7 +555,7 @@@ test_expect_success 'resolve situation 
        git notes merge --abort &&
        # No .git/NOTES_MERGE_* files left
        test_might_fail ls .git/NOTES_MERGE_* >output 2>/dev/null &&
-       test_cmp /dev/null output &&
+       test_must_be_empty output &&
        # m has not moved (still == w)
        test "$(git rev-parse refs/notes/m)" = "$(git rev-parse refs/notes/w)" &&
        # Verify that other notes refs has not changed (w, x, y and z)
index 4c7b1ea3563274c7c3551e417c819b70200e90e9,5997770dc3d7480dd1aa8139fbc7c56e6a56b66e..259c27233dff0e47e2e0d7ddd48ac8dc6742925b
@@@ -119,15 -119,6 +119,15 @@@ test_expect_success 'rebase -i with exe
        )
  '
  
 +test_expect_success 'rebase -i sets work tree properly' '
 +      test_when_finished "rm -rf subdir" &&
 +      test_when_finished "test_might_fail git rebase --abort" &&
 +      mkdir subdir &&
 +      git rebase -x "(cd subdir && git rev-parse --show-toplevel)" HEAD^ \
 +              >actual &&
 +      ! grep "/subdir$" actual
 +'
 +
  test_expect_success 'rebase -i with the exec command checks tree cleanness' '
        git checkout master &&
        set_fake_editor &&
@@@ -525,7 -516,7 +525,7 @@@ test_expect_success 'interrupted squas
        one=$(git rev-parse HEAD~3) &&
        set_fake_editor &&
        test_must_fail env FAKE_LINES="1 squash 3 2" git rebase -i HEAD~3 &&
 -      (echo one; echo two; echo four) > conflict &&
 +      test_write_lines one two four > conflict &&
        git add conflict &&
        test_must_fail git rebase --continue &&
        echo resolved > conflict &&
@@@ -539,10 -530,10 +539,10 @@@ test_expect_success 'interrupted squas
        one=$(git rev-parse HEAD~3) &&
        set_fake_editor &&
        test_must_fail env FAKE_LINES="3 squash 1 2" git rebase -i HEAD~3 &&
 -      (echo one; echo four) > conflict &&
 +      test_write_lines one four > conflict &&
        git add conflict &&
        test_must_fail git rebase --continue &&
 -      (echo one; echo two; echo four) > conflict &&
 +      test_write_lines one two four > conflict &&
        git add conflict &&
        test_must_fail git rebase --continue &&
        echo resolved > conflict &&
@@@ -796,16 -787,15 +796,15 @@@ test_expect_success 'always cherry-pic
        git tag original-no-ff-branch &&
        set_fake_editor &&
        git rebase -i --no-ff A &&
-       touch empty &&
        for p in 0 1 2
        do
                test ! $(git rev-parse HEAD~$p) = $(git rev-parse original-no-ff-branch~$p) &&
                git diff HEAD~$p original-no-ff-branch~$p > out &&
-               test_cmp empty out
+               test_must_be_empty out
        done &&
        test $(git rev-parse HEAD~3) = $(git rev-parse original-no-ff-branch~3) &&
        git diff HEAD~3 original-no-ff-branch~3 > out &&
-       test_cmp empty out
+       test_must_be_empty out
  '
  
  test_expect_success 'set up commits with funny messages' '
@@@ -1247,7 -1237,7 +1246,7 @@@ rebase_setup_and_clean () 
                test_might_fail git branch -D $1 &&
                test_might_fail git rebase --abort
        " &&
 -      git checkout -b $1 master
 +      git checkout -b $1 ${2:-master}
  }
  
  test_expect_success 'drop' '
@@@ -1424,12 -1414,4 +1423,12 @@@ test_expect_success 'rebase -i --gpg-si
        test_i18ngrep "$SQ-S\"S I Gner\"$SQ" err
  '
  
 +test_expect_success 'valid author header after --root swap' '
 +      rebase_setup_and_clean author-header no-conflict-branch &&
 +      set_fake_editor &&
 +      FAKE_LINES="2 1" git rebase -i --root &&
 +      git cat-file commit HEAD^ >out &&
 +      grep "^author ..*> [0-9][0-9]* [-+][0-9][0-9][0-9][0-9]$" out
 +'
 +
  test_done
diff --combined t/t3600-rm.sh
index 5829dfd12cfdcbfe3061b7dcc7a91cd9799f4687,b178a376c47de2dc2e8783fdbb34da628510b8b7..04e5d42bd3b82a7bf683659f6fdd8e20813df770
@@@ -14,13 -14,15 +14,13 @@@ test_expect_success 
       git add -- foo bar baz 'space embedded' -q &&
       git commit -m 'add normal files'"
  
 -if test_have_prereq !MINGW && touch -- 'tab   embedded' 'newline
 -embedded' 2>/dev/null
 -then
 -      test_set_prereq FUNNYNAMES
 -else
 +if test_have_prereq !FUNNYNAMES; then
        say 'Your filesystem does not allow tabs in filenames.'
  fi
  
  test_expect_success FUNNYNAMES 'add files with funny names' "
 +     touch -- 'tab    embedded' 'newline
 +embedded' &&
       git add -- 'tab  embedded' 'newline
  embedded' &&
       git commit -m 'add files with tabs and newlines'
@@@ -380,7 -382,7 +380,7 @@@ test_expect_success 'rm does not compla
        git submodule update &&
        git rm .gitmodules &&
        git rm submod >actual 2>actual.err &&
-       ! test -s actual.err &&
+       test_must_be_empty actual.err &&
        ! test -d submod &&
        ! test -f submod/.git &&
        git status -s -uno >actual &&
@@@ -398,7 -400,7 +398,7 @@@ test_expect_success 'rm will error out 
        git diff-files --quiet -- submod &&
        git add .gitmodules &&
        git rm submod >actual 2>actual.err &&
-       ! test -s actual.err &&
+       test_must_be_empty actual.err &&
        ! test -d submod &&
        ! test -f submod/.git &&
        git status -s -uno >actual &&
@@@ -692,7 -694,7 +692,7 @@@ test_expect_success 'checking out a com
        test_cmp expected actual &&
        rm -rf submod &&
        git status -s -uno --ignore-submodules=none >actual &&
-       ! test -s actual
+       test_must_be_empty actual
  '
  
  test_expect_success 'rm of d/f when d has become a non-directory' '
index 35fc8b5c2aa559a40000588f9a1e2b86215cb6ef,1ea9e0d21dedceb0358644aeae8f4e495bd0aa25..a9fb226c5ad566095163c5141a4ca591f2aeacb1
@@@ -776,8 -776,6 +776,6 @@@ test_expect_success 'checkdiff allows n
        git diff --check
  '
  
- cat <<EOF >expect
- EOF
  test_expect_success 'whitespace-only changes not reported' '
        git reset --hard &&
        echo >x "hello world" &&
        git commit -m "hello 1" &&
        echo >x "hello  world" &&
        git diff -b >actual &&
-       test_cmp expect actual
+       test_must_be_empty actual
  '
  
  cat <<EOF >expect
@@@ -1220,7 -1218,7 +1218,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>
@@@ -1355,8 -1310,9 +1353,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>
@@@ -1434,8 -1390,9 +1432,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>
@@@ -1497,8 -1454,9 +1495,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>
@@@ -1563,8 -1521,9 +1561,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>
@@@ -1633,8 -1592,9 +1631,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>
@@@ -1671,8 -1631,9 +1669,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>
@@@ -1713,8 -1674,7 +1711,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>
@@@ -1757,146 -1717,7 +1755,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
index 4e3499ef84c1bc3bb26857d70bf7f5ba78d5bf9a,7a4594224b0d09ef946f52a7df4c310ad0e19866..619bf970983e481af1537eb539d66bdd6b12971f
@@@ -257,9 -257,7 +257,7 @@@ test_expect_success 'typechanged submod
  commit_file sm1 &&
  test_expect_success 'submodule is up to date' '
        git diff-index -p --submodule=log HEAD >actual &&
-       cat >expected <<-EOF &&
-       EOF
-       test_cmp expected actual
+       test_must_be_empty actual
  '
  
  test_expect_success 'submodule contains untracked content' '
  
  test_expect_success 'submodule contains untracked content (untracked ignored)' '
        git diff-index -p --ignore-submodules=untracked --submodule=log HEAD >actual &&
-       ! test -s actual
+       test_must_be_empty actual
  '
  
  test_expect_success 'submodule contains untracked content (dirty ignored)' '
        git diff-index -p --ignore-submodules=dirty --submodule=log HEAD >actual &&
-       ! test -s actual
+       test_must_be_empty actual
  '
  
  test_expect_success 'submodule contains untracked content (all ignored)' '
        git diff-index -p --ignore-submodules=all --submodule=log HEAD >actual &&
-       ! test -s actual
+       test_must_be_empty actual
  '
  
  test_expect_success 'submodule contains untracked and modifed content' '
@@@ -308,13 -306,13 +306,13 @@@ test_expect_success 'submodule contain
  test_expect_success 'submodule contains untracked and modifed content (dirty ignored)' '
        echo new > sm1/foo6 &&
        git diff-index -p --ignore-submodules=dirty --submodule=log HEAD >actual &&
-       ! test -s actual
+       test_must_be_empty actual
  '
  
  test_expect_success 'submodule contains untracked and modifed content (all ignored)' '
        echo new > sm1/foo6 &&
        git diff-index -p --ignore-submodules --submodule=log HEAD >actual &&
-       ! test -s actual
+       test_must_be_empty actual
  '
  
  test_expect_success 'submodule contains modifed content' '
@@@ -368,7 -366,7 +366,7 @@@ test_expect_success 'modified submodul
  
  test_expect_success 'modified submodule contains untracked content (all ignored)' '
        git diff-index -p --ignore-submodules=all --submodule=log HEAD >actual &&
-       ! test -s actual
+       test_must_be_empty actual
  '
  
  test_expect_success 'modified submodule contains untracked and modifed content' '
@@@ -407,7 -405,7 +405,7 @@@ test_expect_success 'modified submodul
  test_expect_success 'modified submodule contains untracked and modifed content (all ignored)' '
        echo modification >> sm1/foo6 &&
        git diff-index -p --ignore-submodules --submodule=log HEAD >actual &&
-       ! test -s actual
+       test_must_be_empty actual
  '
  
  test_expect_success 'modified submodule contains modifed content' '
@@@ -498,7 -496,7 +496,7 @@@ test_expect_success 'given commit --sub
  test_expect_success 'setup .git file for sm2' '
        (cd sm2 &&
         REAL="$(pwd)/../.real" &&
 -       mv .git "$REAL"
 +       mv .git "$REAL" &&
         echo "gitdir: $REAL" >.git)
  '
  
@@@ -527,7 -525,7 +525,7 @@@ test_expect_success 'diff --submodule w
                git commit -m "sub a"
        ) &&
        (cd sub_alt &&
 -              sha1_before=$(git rev-parse --short HEAD)
 +              sha1_before=$(git rev-parse --short HEAD) &&
                echo b >b &&
                git add b &&
                git commit -m b &&
index 0eba4620f039aaa529afa2cf3fbcff2559857b9e,60c8dc75a99dbefba5e1f1d6f26449992b4f6f10..9dcb69df5c3684b02b09278ecd64b19f5473ef0b
@@@ -392,9 -392,7 +392,7 @@@ test_expect_success 'typechanged submod
  commit_file sm1 &&
  test_expect_success 'submodule is up to date' '
        git diff-index -p --submodule=diff HEAD >actual &&
-       cat >expected <<-EOF &&
-       EOF
-       test_cmp expected actual
+       test_must_be_empty actual
  '
  
  test_expect_success 'submodule contains untracked content' '
  
  test_expect_success 'submodule contains untracked content (untracked ignored)' '
        git diff-index -p --ignore-submodules=untracked --submodule=diff HEAD >actual &&
-       ! test -s actual
+       test_must_be_empty actual
  '
  
  test_expect_success 'submodule contains untracked content (dirty ignored)' '
        git diff-index -p --ignore-submodules=dirty --submodule=diff HEAD >actual &&
-       ! test -s actual
+       test_must_be_empty actual
  '
  
  test_expect_success 'submodule contains untracked content (all ignored)' '
        git diff-index -p --ignore-submodules=all --submodule=diff HEAD >actual &&
-       ! test -s actual
+       test_must_be_empty actual
  '
  
  test_expect_success 'submodule contains untracked and modified content' '
@@@ -458,13 -456,13 +456,13 @@@ test_expect_success 'submodule contain
  test_expect_success 'submodule contains untracked and modified content (dirty ignored)' '
        echo new > sm1/foo6 &&
        git diff-index -p --ignore-submodules=dirty --submodule=diff HEAD >actual &&
-       ! test -s actual
+       test_must_be_empty actual
  '
  
  test_expect_success 'submodule contains untracked and modified content (all ignored)' '
        echo new > sm1/foo6 &&
        git diff-index -p --ignore-submodules --submodule=diff HEAD >actual &&
-       ! test -s actual
+       test_must_be_empty actual
  '
  
  test_expect_success 'submodule contains modified content' '
@@@ -549,7 -547,7 +547,7 @@@ test_expect_success 'modified submodul
  
  test_expect_success 'modified submodule contains untracked content (all ignored)' '
        git diff-index -p --ignore-submodules=all --submodule=diff HEAD >actual &&
-       ! test -s actual
+       test_must_be_empty actual
  '
  
  test_expect_success 'modified submodule contains untracked and modified content' '
@@@ -609,7 -607,7 +607,7 @@@ test_expect_success 'modified submodul
  test_expect_success 'modified submodule contains untracked and modified content (all ignored)' '
        echo modification >> sm1/foo6 &&
        git diff-index -p --ignore-submodules --submodule=diff HEAD >actual &&
-       ! test -s actual
+       test_must_be_empty actual
  '
  
  # NOT OK
@@@ -721,7 -719,7 +719,7 @@@ test_expect_success 'given commit' 
  test_expect_success 'setup .git file for sm2' '
        (cd sm2 &&
         REAL="$(pwd)/../.real" &&
 -       mv .git "$REAL"
 +       mv .git "$REAL" &&
         echo "gitdir: $REAL" >.git)
  '
  
diff --combined t/t4150-am.sh
index 01867a989885e1272e998df54375b74438a8059e,38fe717c12c173d0744dd29e3691f3d9aa05b781..55b577d919b5d82dd8c8bc81a6a4bc657b190f41
@@@ -69,15 -69,13 +69,15 @@@ test_expect_success 'setup: messages' 
  
        EOF
  
 -      cat >scissors-msg <<-\EOF &&
 -      Test git-am with scissors line
 +      cat >msg-without-scissors-line <<-\EOF &&
 +      Test that git-am --scissors cuts at the scissors line
  
        This line should be included in the commit message.
        EOF
  
 -      cat - scissors-msg >no-scissors-msg <<-\EOF &&
 +      printf "Subject: " >subject-prefix &&
 +
 +      cat - subject-prefix msg-without-scissors-line >msg-with-scissors-line <<-\EOF &&
        This line should not be included in the commit message with --scissors enabled.
  
         - - >8 - - remove everything above this line - - >8 - -
@@@ -150,17 -148,18 +150,17 @@@ test_expect_success setup 
        } >patch1-hg.eml &&
  
  
 -      echo scissors-file >scissors-file &&
 -      git add scissors-file &&
 -      git commit -F scissors-msg &&
 -      git tag scissors &&
 -      git format-patch --stdout scissors^ >scissors-patch.eml &&
 +      echo file >file &&
 +      git add file &&
 +      git commit -F msg-without-scissors-line &&
 +      git tag expected-for-scissors &&
        git reset --hard HEAD^ &&
  
 -      echo no-scissors-file >no-scissors-file &&
 -      git add no-scissors-file &&
 -      git commit -F no-scissors-msg &&
 -      git tag no-scissors &&
 -      git format-patch --stdout no-scissors^ >no-scissors-patch.eml &&
 +      echo file >file &&
 +      git add file &&
 +      git commit -F msg-with-scissors-line &&
 +      git tag expected-for-no-scissors &&
 +      git format-patch --stdout expected-for-no-scissors^ >patch-with-scissors-line.eml &&
        git reset --hard HEAD^ &&
  
        sed -n -e "3,\$p" msg >file &&
@@@ -417,10 -416,10 +417,10 @@@ test_expect_success 'am --scissors cut
        rm -fr .git/rebase-apply &&
        git reset --hard &&
        git checkout second &&
 -      git am --scissors scissors-patch.eml &&
 +      git am --scissors patch-with-scissors-line.eml &&
        test_path_is_missing .git/rebase-apply &&
 -      git diff --exit-code scissors &&
 -      test_cmp_rev scissors HEAD
 +      git diff --exit-code expected-for-scissors &&
 +      test_cmp_rev expected-for-scissors HEAD
  '
  
  test_expect_success 'am --no-scissors overrides mailinfo.scissors' '
        git reset --hard &&
        git checkout second &&
        test_config mailinfo.scissors true &&
 -      git am --no-scissors no-scissors-patch.eml &&
 +      git am --no-scissors patch-with-scissors-line.eml &&
        test_path_is_missing .git/rebase-apply &&
 -      git diff --exit-code no-scissors &&
 -      test_cmp_rev no-scissors HEAD
 +      git diff --exit-code expected-for-no-scissors &&
 +      test_cmp_rev expected-for-no-scissors HEAD
  '
  
  test_expect_success 'setup: new author and committer' '
@@@ -652,7 -651,7 +652,7 @@@ test_expect_success 'am -3 -q is quiet
        git checkout -f lorem2 &&
        git reset base3way --hard &&
        git am -3 -q lorem-move.patch >output.out 2>&1 &&
-       ! test -s output.out
+       test_must_be_empty output.out
  '
  
  test_expect_success 'am pauses on conflict' '
@@@ -875,7 -874,7 +875,7 @@@ test_expect_success 'am -q is quiet' 
        git checkout first &&
        test_tick &&
        git am -q <patch1 >output.out 2>&1 &&
-       ! test -s output.out
+       test_must_be_empty output.out
  '
  
  test_expect_success 'am empty-file does not infloop' '
diff --combined t/t4211-line-log.sh
index 436b13ad21d06351ef9f9a027689a7e23ca97ba5,6e378b23c797a83e2553594b00bec5b90b5aefe0..ef1322148e1413e4b90f46b6bea4f2d9b0300189
@@@ -60,6 -60,7 +60,6 @@@ test_bad_opts "-L 1:nonexistent" "Ther
  test_bad_opts "-L 1:simple" "There is no path"
  test_bad_opts "-L '/foo:b.c'" "argument not .start,end:file"
  test_bad_opts "-L 1000:b.c" "has only.*lines"
 -test_bad_opts "-L 1,1000:b.c" "has only.*lines"
  test_bad_opts "-L :b.c" "argument not .start,end:file"
  test_bad_opts "-L :foo:b.c" "no match"
  
@@@ -85,12 -86,12 +85,12 @@@ test_expect_success '-L ,Y (Y == nlines
  
  test_expect_success '-L ,Y (Y == nlines + 1)' '
        n=$(expr $(wc -l <b.c) + 1) &&
 -      test_must_fail git log -L ,$n:b.c
 +      git log -L ,$n:b.c
  '
  
  test_expect_success '-L ,Y (Y == nlines + 2)' '
        n=$(expr $(wc -l <b.c) + 2) &&
 -      test_must_fail git log -L ,$n:b.c
 +      git log -L ,$n:b.c
  '
  
  test_expect_success '-L with --first-parent and a merge' '
  test_expect_success '-L with --output' '
        git checkout parallel-change &&
        git log --output=log -L :main:b.c >output &&
-       test ! -s output &&
+       test_must_be_empty output &&
        test_line_count = 70 log
  '
  
diff --combined t/t5401-update-hooks.sh
index b5f886a0e264eed3d3ab54176b01912bbb8badb6,ce151e71c19e27cec38b99719142fe2d48dffce7..956d69f5b1773d3d697e4bb2ca9d50786c42b74f
@@@ -82,13 -82,13 +82,13 @@@ test_expect_success 'hooks ran' 
  '
  
  test_expect_success 'pre-receive hook input' '
 -      (echo $commit0 $commit1 refs/heads/master;
 +      (echo $commit0 $commit1 refs/heads/master &&
         echo $commit1 $commit0 refs/heads/tofail
        ) | test_cmp - victim.git/pre-receive.stdin
  '
  
  test_expect_success 'update hook arguments' '
 -      (echo refs/heads/master $commit0 $commit1;
 +      (echo refs/heads/master $commit0 $commit1 &&
         echo refs/heads/tofail $commit1 $commit0
        ) | test_cmp - victim.git/update.args
  '
@@@ -104,17 -104,17 +104,17 @@@ test_expect_success 'post-update hook a
  '
  
  test_expect_success 'all hook stdin is /dev/null' '
-       ! test -s victim.git/update.stdin &&
-       ! test -s victim.git/post-update.stdin
+       test_must_be_empty victim.git/update.stdin &&
+       test_must_be_empty victim.git/post-update.stdin
  '
  
  test_expect_success 'all *-receive hook args are empty' '
-       ! test -s victim.git/pre-receive.args &&
-       ! test -s victim.git/post-receive.args
+       test_must_be_empty victim.git/pre-receive.args &&
+       test_must_be_empty victim.git/post-receive.args
  '
  
  test_expect_success 'send-pack produced no output' '
-       ! test -s send.out
+       test_must_be_empty send.out
  '
  
  cat <<EOF >expect
diff --combined t/t5500-fetch-pack.sh
index 8f945235e3a94156de4dadaff5e944751f056372,07fcea04741afb362ec728a17eb1eaa283463b5f..1b5a4a6d380f37b0e616e5ca6c5fd5b732e6383d
@@@ -161,7 -161,7 +161,7 @@@ test_expect_success 'clone shallow obje
  test_expect_success 'clone shallow object count (part 2)' '
        sed -e "/^in-pack:/d" -e "/^packs:/d" -e "/^size-pack:/d" \
            -e "/: 0$/d" count.shallow > count_output &&
-       ! test -s count_output
+       test_must_be_empty count_output
  '
  
  test_expect_success 'fsck in shallow repo' '
@@@ -259,7 -259,7 +259,7 @@@ test_expect_success 'clone shallow obje
  test_expect_success 'pull in shallow repo with missing merge base' '
        (
                cd shallow &&
 -              git fetch --depth 4 .. A
 +              git fetch --depth 4 .. A &&
                test_must_fail git merge --allow-unrelated-histories FETCH_HEAD
        )
  '
@@@ -403,7 -403,7 +403,7 @@@ test_expect_success 'fetch creating ne
                git fetch --depth=1 --progress 2>actual &&
                # This should fetch only the empty commit, no tree or
                # blob objects
 -              grep "remote: Total 1" actual
 +              test_i18ngrep "remote: Total 1" actual
        )
  '
  
@@@ -814,39 -814,6 +814,39 @@@ test_expect_success 'fetching deepen' 
        )
  '
  
 +test_expect_success 'use ref advertisement to prune "have" lines sent' '
 +      rm -rf server client &&
 +      git init server &&
 +      test_commit -C server both_have_1 &&
 +      git -C server tag -d both_have_1 &&
 +      test_commit -C server both_have_2 &&
 +
 +      git clone server client &&
 +      test_commit -C server server_has &&
 +      test_commit -C client client_has &&
 +
 +      # In both protocol v0 and v2, ensure that the parent of both_have_2 is
 +      # not sent as a "have" line. The client should know that the server has
 +      # both_have_2, so it only needs to inform the server that it has
 +      # both_have_2, and the server can infer the rest.
 +
 +      rm -f trace &&
 +      cp -r client clientv0 &&
 +      GIT_TRACE_PACKET="$(pwd)/trace" git -C clientv0 \
 +              fetch origin server_has both_have_2 &&
 +      grep "have $(git -C client rev-parse client_has)" trace &&
 +      grep "have $(git -C client rev-parse both_have_2)" trace &&
 +      ! grep "have $(git -C client rev-parse both_have_2^)" trace &&
 +
 +      rm -f trace &&
 +      cp -r client clientv2 &&
 +      GIT_TRACE_PACKET="$(pwd)/trace" git -C clientv2 -c protocol.version=2 \
 +              fetch origin server_has both_have_2 &&
 +      grep "have $(git -C client rev-parse client_has)" trace &&
 +      grep "have $(git -C client rev-parse both_have_2)" trace &&
 +      ! grep "have $(git -C client rev-parse both_have_2^)" trace
 +'
 +
  test_expect_success 'filtering by size' '
        rm -rf server client &&
        test_create_repo server &&
index 0f730d7781568861564b44d534bad728095ac71d,fc95df0d0d95bb31ade7db13c8ef907671ca15ad..6c2f9b2ba266ad910769745e72285a840b33238b
@@@ -98,8 -98,8 +98,8 @@@ test_expect_success "fetch alone only f
                cd downstream &&
                git fetch >../actual.out 2>../actual.err
        ) &&
-       ! test -s actual.out &&
-       ! test -s actual.err
+       test_must_be_empty actual.out &&
+       test_must_be_empty actual.err
  '
  
  test_expect_success "fetch --no-recurse-submodules only fetches superproject" '
                cd downstream &&
                git fetch --no-recurse-submodules >../actual.out 2>../actual.err
        ) &&
-       ! test -s actual.out &&
-       ! test -s actual.err
+       test_must_be_empty actual.out &&
+       test_must_be_empty actual.err
  '
  
  test_expect_success "using fetchRecurseSubmodules=true in .gitmodules recurses into submodules" '
@@@ -127,8 -127,8 +127,8 @@@ test_expect_success "--no-recurse-submo
                cd downstream &&
                git fetch --no-recurse-submodules >../actual.out 2>../actual.err
        ) &&
-       ! test -s actual.out &&
-       ! test -s actual.err
+       test_must_be_empty actual.out &&
+       test_must_be_empty actual.err
  '
  
  test_expect_success "using fetchRecurseSubmodules=false in .git/config overrides setting in .gitmodules" '
                git config submodule.submodule.fetchRecurseSubmodules false &&
                git fetch >../actual.out 2>../actual.err
        ) &&
-       ! test -s actual.out &&
-       ! test -s actual.err
+       test_must_be_empty actual.out &&
+       test_must_be_empty actual.err
  '
  
  test_expect_success "--recurse-submodules overrides fetchRecurseSubmodules setting from .git/config" '
@@@ -157,8 -157,8 +157,8 @@@ test_expect_success "--quiet propagate
                cd downstream &&
                git fetch --recurse-submodules --quiet >../actual.out 2>../actual.err
        ) &&
-       ! test -s actual.out &&
-       ! test -s actual.err
+       test_must_be_empty actual.out &&
+       test_must_be_empty actual.err
  '
  
  test_expect_success "--quiet propagates to parallel submodules" '
                cd downstream &&
                git fetch --recurse-submodules -j 2 --quiet  >../actual.out 2>../actual.err
        ) &&
-       ! test -s actual.out &&
-       ! test -s actual.err
+       test_must_be_empty actual.out &&
+       test_must_be_empty actual.err
  '
  
  test_expect_success "--dry-run propagates to submodules" '
@@@ -221,8 -221,8 +221,8 @@@ test_expect_success "--no-recurse-submo
                git config fetch.recurseSubmodules true &&
                git fetch --no-recurse-submodules >../actual.out 2>../actual.err
        ) &&
-       ! test -s actual.out &&
-       ! test -s actual.err
+       test_must_be_empty actual.out &&
+       test_must_be_empty actual.err
  '
  
  test_expect_success "Recursion doesn't happen when no new commits are fetched in the superproject" '
                git config --unset fetch.recurseSubmodules &&
                git fetch >../actual.out 2>../actual.err
        ) &&
-       ! test -s actual.out &&
-       ! test -s actual.err
+       test_must_be_empty actual.out &&
+       test_must_be_empty actual.err
  '
  
  test_expect_success "Recursion stops when no new submodule commits are fetched" '
@@@ -268,7 -268,7 +268,7 @@@ test_expect_success "Recursion doesn't 
                cd downstream &&
                git fetch >../actual.out 2>../actual.err
        ) &&
-       ! test -s actual.out &&
+       test_must_be_empty actual.out &&
        test_i18ncmp expect.err.file actual.err
  '
  
@@@ -357,8 -357,8 +357,8 @@@ test_expect_success "'--recurse-submodu
                git fetch --recurse-submodules=on-demand >../actual.out 2>../actual.err &&
                git config --unset fetch.recurseSubmodules
        ) &&
-       ! test -s actual.out &&
-       ! test -s actual.err
+       test_must_be_empty actual.out &&
+       test_must_be_empty actual.err
  '
  
  test_expect_success "'--recurse-submodules=on-demand' recurses as deep as necessary (and ignores config)" '
                        git config -f .gitmodules submodule.subdir/deepsubmodule.fetchRecursive false
                ) &&
                git fetch --recurse-submodules=on-demand >../actual.out 2>../actual.err &&
 -              git config --unset fetch.recurseSubmodules
 +              git config --unset fetch.recurseSubmodules &&
                (
                        cd submodule &&
                        git config --unset -f .gitmodules submodule.subdir/deepsubmodule.fetchRecursive
@@@ -402,7 -402,7 +402,7 @@@ test_expect_success "'--recurse-submodu
                cd downstream &&
                git fetch --recurse-submodules=on-demand >../actual.out 2>../actual.err
        ) &&
-       ! test -s actual.out &&
+       test_must_be_empty actual.out &&
        test_i18ncmp expect.err.file actual.err
  '
  
@@@ -477,7 -477,7 +477,7 @@@ test_expect_success "don't fetch submod
                cd downstream &&
                git fetch >../actual.out 2>../actual.err
        ) &&
-       ! test -s actual.out &&
+       test_must_be_empty actual.out &&
        test_i18ncmp expect.err actual.err &&
        (
                cd submodule &&
@@@ -495,7 -495,6 +495,6 @@@ test_expect_success "'fetch.recurseSubm
        git add submodule &&
        git rm .gitmodules &&
        git commit -m "new submodule without .gitmodules" &&
-       printf "" >expect.out &&
        head2=$(git rev-parse --short HEAD) &&
        echo "From $pwd/." >expect.err.2 &&
        echo "   $head1..$head2  master     -> origin/master" >>expect.err.2 &&
                git config --unset fetch.recurseSubmodules &&
                git reset --hard
        ) &&
-       test_i18ncmp expect.out actual.out &&
+       test_must_be_empty actual.out &&
        test_i18ncmp expect.err.2 actual.err &&
        git checkout HEAD^ -- .gitmodules &&
        git add .gitmodules &&
index a0fc4005e059723dbafb26606548a074554bc961,4319ef6ec777c1d9797294adba08bba91ab40808..5475afc052934677c4f87adf4f29da507b4c6844
@@@ -38,16 -38,25 +38,16 @@@ GET  /smart/test_repo.git/info/refs?ser
  POST /smart/test_repo.git/git-upload-pack HTTP/1.1 200
  EOF
  test_expect_success 'no empty path components' '
 +      # Clear the log, so that it does not affect the "used receive-pack
 +      # service" test which reads the log too.
 +      test_when_finished ">\"\$HTTPD_ROOT_PATH\"/access.log" &&
 +
        # In the URL, add a trailing slash, and see if git appends yet another
        # slash.
        cd "$ROOT_PATH" &&
        git clone $HTTPD_URL/smart/test_repo.git/ test_repo_clone &&
  
 -      sed -e "
 -              s/^.* \"//
 -              s/\"//
 -              s/ [1-9][0-9]*\$//
 -              s/^GET /GET  /
 -      " >act <"$HTTPD_ROOT_PATH"/access.log &&
 -
 -      # Clear the log, so that it does not affect the "used receive-pack
 -      # service" test which reads the log too.
 -      #
 -      # We do this before the actual comparison to ensure the log is cleared.
 -      echo > "$HTTPD_ROOT_PATH"/access.log &&
 -
 -      test_cmp exp act
 +      check_access_log exp
  '
  
  test_expect_success 'clone remote repository' '
@@@ -115,6 -124,7 +115,6 @@@ test_expect_success 'rejected update pr
  rm -f "$HTTPD_DOCUMENT_ROOT_PATH/test_repo.git/hooks/update"
  
  cat >exp <<EOF
 -
  GET  /smart/test_repo.git/info/refs?service=git-upload-pack HTTP/1.1 200
  POST /smart/test_repo.git/git-upload-pack HTTP/1.1 200
  GET  /smart/test_repo.git/info/refs?service=git-receive-pack HTTP/1.1 200
@@@ -128,7 -138,13 +128,7 @@@ GET  /smart/test_repo.git/info/refs?ser
  POST /smart/test_repo.git/git-receive-pack HTTP/1.1 200
  EOF
  test_expect_success 'used receive-pack service' '
 -      sed -e "
 -              s/^.* \"//
 -              s/\"//
 -              s/ [1-9][0-9]*\$//
 -              s/^GET /GET  /
 -      " >act <"$HTTPD_ROOT_PATH"/access.log &&
 -      test_cmp exp act
 +      check_access_log exp
  '
  
  test_http_push_nonff "$HTTPD_DOCUMENT_ROOT_PATH"/test_repo.git \
@@@ -210,7 -226,7 +210,7 @@@ test_expect_success TTY 'push --quiet s
        cd "$ROOT_PATH"/test_repo_clone &&
        test_commit quiet &&
        test_terminal git push --quiet >output 2>&1 &&
-       test_cmp /dev/null output
+       test_must_be_empty output
  '
  
  test_expect_success TTY 'push --no-progress silences progress but not status' '
diff --combined t/t5570-git-daemon.sh
index a571f22bfdd52293d0fcce16d30870119f72e88f,12c1e43a843023bc582cef2321a58d10c30b83a1..7466aad111fe4ef11b97d05a9616f8530993c288
@@@ -7,9 -7,9 +7,9 @@@ test_description='test fetching over gi
  start_git_daemon
  
  check_verbose_connect () {
 -      grep -F "Looking up 127.0.0.1 ..." stderr &&
 -      grep -F "Connecting to 127.0.0.1 (port " stderr &&
 -      grep -F "done." stderr
 +      test_i18ngrep -F "Looking up 127.0.0.1 ..." stderr &&
 +      test_i18ngrep -F "Connecting to 127.0.0.1 (port " stderr &&
 +      test_i18ngrep -F "done." stderr
  }
  
  test_expect_success 'setup repository' '
@@@ -51,7 -51,7 +51,7 @@@ test_expect_success 'no-op fetch -v std
  
  test_expect_success 'no-op fetch without "-v" is quiet' '
        (cd clone && git fetch 2>../stderr) &&
-       ! test -s stderr
+       test_must_be_empty stderr
  '
  
  test_expect_success 'remote detects correct HEAD' '
diff --combined t/t7001-mv.sh
index 9e59e5a5dd031f036237dafc3ebb1e3854883caa,56ca467c0a18ed7267272eb288c86dec6b698909..36b50d0b4c1255408d57b4e8b583cfcd41ce9c0d
@@@ -384,7 -384,7 +384,7 @@@ test_expect_success 'mv does not compla
        entry="$(git ls-files --stage sub | cut -f 1)" &&
        mkdir mod &&
        git mv sub mod/sub 2>actual.err &&
-       ! test -s actual.err &&
+       test_must_be_empty actual.err &&
        ! test -e sub &&
        [ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
        (
@@@ -408,7 -408,7 +408,7 @@@ test_expect_success 'mv will error out 
        git diff-files --quiet -- sub &&
        git add .gitmodules &&
        git mv sub mod/sub 2>actual.err &&
-       ! test -s actual.err &&
+       test_must_be_empty actual.err &&
        ! test -e sub &&
        [ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
        (
@@@ -469,7 -469,7 +469,7 @@@ test_expect_success 'checking out a com
        git update-index --refresh &&
        git diff-files --quiet -- sub .gitmodules &&
        git status -s sub2 >actual &&
-       ! test -s actual
+       test_must_be_empty actual
  '
  
  test_expect_success 'mv -k does not accidentally destroy submodules' '
@@@ -509,7 -509,7 +509,7 @@@ test_expect_success 'moving nested subm
                touch nested_level1 &&
                git init &&
                git add . &&
 -              git commit -m "nested level 1"
 +              git commit -m "nested level 1" &&
                git submodule add ../sub_nested_nested &&
                git commit -m "add nested level 2"
        ) &&
diff --combined t/t7004-tag.sh
index 465eb4ea3f973943367b1c8b2e560d1b16b3c31b,2e17cdb084268c1ccd4eb2da53c28d2bb2ccc5ad..0b01862c23aa182ee4ae7ce2944a40b4449d6049
@@@ -325,11 -325,10 +325,10 @@@ test_expect_success 
        test_cmp expect actual
  '
  
- >expect
  test_expect_success \
        'listing tags using v.* should print nothing because none have v.' '
        git tag -l "v.*" > actual &&
-       test_cmp expect actual
+       test_must_be_empty actual
  '
  
  cat >expect <<EOF
@@@ -1352,19 -1351,6 +1351,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:
  
@@@ -1511,12 -1497,9 +1510,9 @@@ test_expect_success 'inverse of the las
        test_cmp expected actual
  "
  
- cat > expected <<EOF
- EOF
  test_expect_success 'checking that third commit has no tags' "
        git tag -l --contains $hash3 v* >actual &&
-       test_cmp expected actual
+       test_must_be_empty actual
  "
  
  cat > expected <<EOF
diff --combined t/t7201-co.sh
index 94cb039a03f8378cec55f61a9694feca4a973d29,d67b10ce00ee67faf6bd52153b5d9afe6ea3e2b6..324933acfe94153e166783e9810e98e69da1fc7e
@@@ -116,9 -116,8 +116,8 @@@ test_expect_success "checkout -m with d
        git diff --name-status side >current.side &&
        test_cmp expect.side current.side &&
  
-       : >expect.index &&
        git diff --cached >current.index &&
-       test_cmp expect.index current.index
+       test_must_be_empty current.index
  '
  
  test_expect_success "checkout -m with dirty tree, renamed" '
        test_cmp expect uno &&
        ! test -f one &&
        git diff --cached >current &&
-       ! test -s current
+       test_must_be_empty current
  
  '
  
@@@ -163,7 -162,7 +162,7 @@@ test_expect_success 'checkout -m with m
        fill d2 aT d7 aS >expect &&
        test_cmp current expect &&
        git diff --cached two >current &&
-       ! test -s current
+       test_must_be_empty current
  '
  
  test_expect_success 'format of merge conflict from checkout -m' '
@@@ -528,10 -527,10 +527,10 @@@ test_expect_success 'checkout with --me
        cat sample >filf &&
        git checkout -m -- fild file filf &&
        (
 -              echo "<<<<<<< ours"
 -              echo ourside
 -              echo "======="
 -              echo theirside
 +              echo "<<<<<<< ours" &&
 +              echo ourside &&
 +              echo "=======" &&
 +              echo theirside &&
                echo ">>>>>>> theirs"
        ) >merged &&
        test_cmp expect fild &&
@@@ -549,12 -548,12 +548,12 @@@ test_expect_success 'checkout with --me
        cat sample >filf &&
        git checkout -m -- fild file filf &&
        (
 -              echo "<<<<<<< ours"
 -              echo ourside
 -              echo "||||||| base"
 -              echo original
 -              echo "======="
 -              echo theirside
 +              echo "<<<<<<< ours" &&
 +              echo ourside &&
 +              echo "||||||| base" &&
 +              echo original &&
 +              echo "=======" &&
 +              echo theirside &&
                echo ">>>>>>> theirs"
        ) >merged &&
        test_cmp expect fild &&
@@@ -572,10 -571,10 +571,10 @@@ test_expect_success 'checkout --conflic
        cat sample >filf &&
        git checkout --conflict=merge -- fild file filf &&
        (
 -              echo "<<<<<<< ours"
 -              echo ourside
 -              echo "======="
 -              echo theirside
 +              echo "<<<<<<< ours" &&
 +              echo ourside &&
 +              echo "=======" &&
 +              echo theirside &&
                echo ">>>>>>> theirs"
        ) >merged &&
        test_cmp expect fild &&
@@@ -593,12 -592,12 +592,12 @@@ test_expect_success 'checkout --conflic
        cat sample >filf &&
        git checkout --conflict=diff3 -- fild file filf &&
        (
 -              echo "<<<<<<< ours"
 -              echo ourside
 -              echo "||||||| base"
 -              echo original
 -              echo "======="
 -              echo theirside
 +              echo "<<<<<<< ours" &&
 +              echo ourside &&
 +              echo "||||||| base" &&
 +              echo original &&
 +              echo "=======" &&
 +              echo theirside &&
                echo ">>>>>>> theirs"
        ) >merged &&
        test_cmp expect fild &&
@@@ -673,6 -672,7 +672,6 @@@ test_expect_success 'custom merge drive
                do
                        grep $t arm || exit 1
                done
 -              exit 0
        ) &&
  
        mv arm expect &&
index 2b71e62ec2c26e6b1bbbcf71e69c5e5b784dc2ba,894ea2f27dd9bef345d8247b19143005c66de7f0..7d3d9842108ae5961f7c17e392f0ce9a8b397cf4
@@@ -101,7 -101,6 +101,6 @@@ inspect() 
  
  test_expect_success 'submodule add' '
        echo "refs/heads/master" >expect &&
-       >empty &&
  
        (
                cd addtest &&
        inspect addtest/submod ../.. &&
        test_cmp expect heads &&
        test_cmp expect head &&
-       test_cmp empty untracked
+       test_must_be_empty untracked
  '
  
  test_expect_success 'setup parent and one repository' '
@@@ -171,13 -170,12 +170,13 @@@ test_expect_success 'submodule add to .
  test_expect_success 'submodule add to reconfigure existing submodule with --force' '
        (
                cd addtest-ignore &&
 -              git submodule add --force bogus-url submod &&
 -              git submodule add -b initial "$submodurl" submod-branch &&
 -              test "bogus-url" = "$(git config -f .gitmodules submodule.submod.url)" &&
 -              test "bogus-url" = "$(git config submodule.submod.url)" &&
 +              bogus_url="$(pwd)/bogus-url" &&
 +              git submodule add --force "$bogus_url" submod &&
 +              git submodule add --force -b initial "$submodurl" submod-branch &&
 +              test "$bogus_url" = "$(git config -f .gitmodules submodule.submod.url)" &&
 +              test "$bogus_url" = "$(git config submodule.submod.url)" &&
                # Restore the url
 -              git submodule add --force "$submodurl" submod
 +              git submodule add --force "$submodurl" submod &&
                test "$submodurl" = "$(git config -f .gitmodules submodule.submod.url)" &&
                test "$submodurl" = "$(git config submodule.submod.url)"
        )
@@@ -189,7 -187,6 +188,6 @@@ test_expect_success 'submodule add --br
        refs/heads/initial
        refs/heads/master
        EOF
-       >empty &&
  
        (
                cd addtest &&
        inspect addtest/submod-branch ../.. &&
        test_cmp expect-heads heads &&
        test_cmp expect-head head &&
-       test_cmp empty untracked
+       test_must_be_empty untracked
  '
  
  test_expect_success 'submodule add with ./ in path' '
        echo "refs/heads/master" >expect &&
-       >empty &&
  
        (
                cd addtest &&
        inspect addtest/dotsubmod/frotz ../../.. &&
        test_cmp expect heads &&
        test_cmp expect head &&
-       test_cmp empty untracked
+       test_must_be_empty untracked
  '
  
  test_expect_success 'submodule add with /././ in path' '
        echo "refs/heads/master" >expect &&
-       >empty &&
  
        (
                cd addtest &&
        inspect addtest/dotslashdotsubmod/frotz ../../.. &&
        test_cmp expect heads &&
        test_cmp expect head &&
-       test_cmp empty untracked
+       test_must_be_empty untracked
  '
  
  test_expect_success 'submodule add with // in path' '
        echo "refs/heads/master" >expect &&
-       >empty &&
  
        (
                cd addtest &&
        inspect addtest/slashslashsubmod/frotz ../../.. &&
        test_cmp expect heads &&
        test_cmp expect head &&
-       test_cmp empty untracked
+       test_must_be_empty untracked
  '
  
  test_expect_success 'submodule add with /.. in path' '
        echo "refs/heads/master" >expect &&
-       >empty &&
  
        (
                cd addtest &&
        inspect addtest/realsubmod ../.. &&
        test_cmp expect heads &&
        test_cmp expect head &&
-       test_cmp empty untracked
+       test_must_be_empty untracked
  '
  
  test_expect_success 'submodule add with ./, /.. and // in path' '
        echo "refs/heads/master" >expect &&
-       >empty &&
  
        (
                cd addtest &&
        inspect addtest/realsubmod2 ../.. &&
        test_cmp expect heads &&
        test_cmp expect head &&
-       test_cmp empty untracked
+       test_must_be_empty untracked
  '
  
  test_expect_success !CYGWIN 'submodule add with \\ in path' '
  
  test_expect_success 'submodule add in subdirectory' '
        echo "refs/heads/master" >expect &&
-       >empty &&
  
        mkdir addtest/sub &&
        (
        inspect addtest/realsubmod3 ../.. &&
        test_cmp expect heads &&
        test_cmp expect head &&
-       test_cmp empty untracked
+       test_must_be_empty untracked
  '
  
  test_expect_success 'submodule add in subdirectory with relative path should fail' '
@@@ -378,7 -369,7 +370,7 @@@ test_expect_success 'init should regist
  
  test_failure_with_unknown_submodule () {
        test_must_fail git submodule $1 no-such-submodule 2>output.err &&
 -      grep "^error: .*no-such-submodule" output.err
 +      test_i18ngrep "^error: .*no-such-submodule" output.err
  }
  
  test_expect_success 'init should fail with unknown submodule' '
@@@ -502,8 -493,6 +494,6 @@@ test_expect_success 'checkout superproj
  '
  
  test_expect_success 'apply submodule diff' '
-       >empty &&
        git branch second &&
        (
                cd init &&
        git apply --index P.diff &&
  
        git diff --cached master >staged &&
-       test_cmp empty staged
+       test_must_be_empty staged
  '
  
  test_expect_success 'update --init' '
@@@ -819,7 -808,7 +809,7 @@@ test_expect_success '../bar/a/b/c work
                cp pristine-.git-config .git/config &&
                cp pristine-.gitmodules .gitmodules &&
                mkdir -p a/b/c &&
 -              (cd a/b/c; git init) &&
 +              (cd a/b/c && git init) &&
                git config remote.origin.url ../foo/bar.git &&
                git submodule add ../bar/a/b/c ./a/b/c &&
                git submodule init &&
diff --combined t/t7501-commit.sh
index 51646d80197486a19475a144ae8e64b2151b511c,c1d232e92da00dd2b2b22433661b8b3c13d7dcb4..fb9337c708798edd411802251fa4b9cd39387140
@@@ -47,7 -47,7 +47,7 @@@ test_expect_success 'paths and -a do no
  test_expect_success PERL 'can use paths with --interactive' '
        echo bong-o-bong >file &&
        # 2: update, 1:st path, that is all, 7: quit
 -      ( echo 2; echo 1; echo; echo 7 ) |
 +      test_write_lines 2 1 "" 7 |
        git commit -m foo --interactive file &&
        git reset --hard HEAD^
  '
@@@ -293,7 -293,7 +293,7 @@@ test_expect_success PERL 'interactive a
  test_expect_success PERL "commit --interactive doesn't change index if editor aborts" '
        echo zoo >file &&
        test_must_fail git diff --exit-code >diff1 &&
 -      (echo u ; echo "*" ; echo q) |
 +      test_write_lines u "*" q |
        (
                EDITOR=: &&
                export EDITOR &&
@@@ -411,8 -411,8 +411,8 @@@ test_expect_success 'sign off (1)' 
        git commit -s -m "thank you" &&
        git cat-file commit HEAD | sed -e "1,/^\$/d" >actual &&
        (
 -              echo thank you
 -              echo
 +              echo thank you &&
 +              echo &&
                git var GIT_COMMITTER_IDENT |
                sed -e "s/>.*/>/" -e "s/^/Signed-off-by: /"
        ) >expected &&
@@@ -430,9 -430,9 +430,9 @@@ test_expect_success 'sign off (2)' 
  $existing" &&
        git cat-file commit HEAD | sed -e "1,/^\$/d" >actual &&
        (
 -              echo thank you
 -              echo
 -              echo $existing
 +              echo thank you &&
 +              echo &&
 +              echo $existing &&
                git var GIT_COMMITTER_IDENT |
                sed -e "s/>.*/>/" -e "s/^/Signed-off-by: /"
        ) >expected &&
@@@ -450,9 -450,9 +450,9 @@@ test_expect_success 'signoff gap' 
  $alt" &&
        git cat-file commit HEAD | sed -e "1,/^\$/d" > actual &&
        (
 -              echo welcome
 -              echo
 -              echo $alt
 +              echo welcome &&
 +              echo &&
 +              echo $alt &&
                git var GIT_COMMITTER_IDENT |
                sed -e "s/>.*/>/" -e "s/^/Signed-off-by: /"
        ) >expected &&
@@@ -470,11 -470,11 +470,11 @@@ We have no
  $alt" &&
        git cat-file commit HEAD | sed -e "1,/^\$/d" > actual &&
        (
 -              echo welcome
 -              echo
 -              echo We have now
 -              echo $alt
 -              echo
 +              echo welcome &&
 +              echo &&
 +              echo We have now &&
 +              echo $alt &&
 +              echo &&
                git var GIT_COMMITTER_IDENT |
                sed -e "s/>.*/>/" -e "s/^/Signed-off-by: /"
        ) >expected &&
@@@ -491,11 -491,11 +491,11 @@@ non-trailer lin
  Myfooter: x" &&
        git cat-file commit HEAD | sed -e "1,/^\$/d" > actual &&
        (
 -              echo subject
 -              echo
 -              echo non-trailer line
 -              echo Myfooter: x
 -              echo
 +              echo subject &&
 +              echo &&
 +              echo non-trailer line &&
 +              echo Myfooter: x &&
 +              echo &&
                echo "Signed-off-by: $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>"
        ) >expected &&
        test_cmp expected actual &&
@@@ -508,10 -508,10 +508,10 @@@ non-trailer lin
  Myfooter: x" &&
        git cat-file commit HEAD | sed -e "1,/^\$/d" > actual &&
        (
 -              echo subject
 -              echo
 -              echo non-trailer line
 -              echo Myfooter: x
 +              echo subject &&
 +              echo &&
 +              echo non-trailer line &&
 +              echo Myfooter: x &&
                echo "Signed-off-by: $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>"
        ) >expected &&
        test_cmp expected actual
@@@ -524,10 -524,10 +524,10 @@@ test_expect_success 'multiple -m' 
        git commit -m "one" -m "two" -m "three" &&
        git cat-file commit HEAD | sed -e "1,/^\$/d" >actual &&
        (
 -              echo one
 -              echo
 -              echo two
 -              echo
 +              echo one &&
 +              echo &&
 +              echo two &&
 +              echo &&
                echo three
        ) >expected &&
        test_cmp expected actual
@@@ -582,13 -582,11 +582,11 @@@ test_expect_success 'same tree (merge a
  
        git merge -s ours side -m "empty ok" &&
        git diff HEAD^ HEAD >actual &&
-       : >expected &&
-       test_cmp expected actual &&
+       test_must_be_empty actual &&
  
        git commit --amend -m "empty really ok" &&
        git diff HEAD^ HEAD >actual &&
-       : >expected &&
-       test_cmp expected actual
+       test_must_be_empty actual
  
  '
  
diff --combined t/t7610-mergetool.sh
index b18503de8158aa6583423f923675d415ab408e76,78bed2aee1e3e40a75ca7b2e73059de362300cce..a9fb971615b7f40bd17f16dcc1ce99ab2c0930ca
@@@ -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 &&
@@@ -328,9 -328,8 +328,8 @@@ test_expect_success 'mergetool produce
        git checkout -b test$test_count move-to-c &&
        test_config mergetool.keepBackup true &&
        test_must_fail git merge move-to-b &&
-       : >expect &&
        echo d | git mergetool a/a/file.txt 2>actual &&
-       test_cmp expect actual &&
+       test_must_be_empty actual &&
        ! test -d a
  '
  
@@@ -349,7 -348,7 +348,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
diff --combined t/t7810-grep.sh
index d826e24b45118d4b87a2723f540c742ac6300f44,c82c8f5f728d1fc912f8bfd9819acf9f1b5dd1b2..be5c1bd553ede55d54e1d918625c99000ba32d80
@@@ -217,9 -217,8 +217,8 @@@ d
        '
  
        test_expect_success "grep -w $L (w)" '
-               : >expected &&
                test_must_fail git grep -n -w -e "^w" $H >actual &&
-               test_cmp expected actual
+               test_must_be_empty actual
        '
  
        test_expect_success "grep -w $L (x)" '
        '
  
        test_expect_success "grep -w $L (y-2)" '
-               : >expected &&
                if git grep -n -w -e "^y y" $H >actual
                then
                        echo should not have matched
                        cat actual
                        false
                else
-                       test_cmp expected actual
+                       test_must_be_empty actual
                fi
        '
  
        test_expect_success "grep -w $L (z)" '
-               : >expected &&
                if git grep -n -w -e "^z" $H >actual
                then
                        echo should not have matched
                        cat actual
                        false
                else
-                       test_cmp expected actual
+                       test_must_be_empty actual
                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 &&
@@@ -498,7 -480,7 +495,7 @@@ test_expect_success 'grep -L -C' 
  
  test_expect_success 'grep --files-without-match --quiet' '
        git grep --files-without-match --quiet nonexistent_string >actual &&
-       test_cmp /dev/null actual
+       test_must_be_empty actual
  '
  
  cat >expected <<EOF
@@@ -619,11 -601,10 +616,10 @@@ z:zz
  EOF
  
  test_expect_success 'grep -q, silently report matches' '
-       >empty &&
        git grep -q mmap >actual &&
-       test_cmp empty actual &&
+       test_must_be_empty actual &&
        test_must_fail git grep -q qfwfq >actual &&
-       test_cmp empty actual
+       test_must_be_empty actual
  '
  
  test_expect_success 'grep -C1 hunk mark between files' '
@@@ -716,8 -697,7 +712,7 @@@ test_expect_success 'log grep (9)' 
  
  test_expect_success 'log grep (9)' '
        git log -g --grep-reflog="commit: third" --author="non-existent" --pretty=tformat:%s >actual &&
-       : >expect &&
-       test_cmp expect actual
+       test_must_be_empty actual
  '
  
  test_expect_success 'log --grep-reflog can only be used under -g' '
@@@ -807,15 -787,13 +802,13 @@@ test_expect_success 'log --all-match --
  '
  
  test_expect_success 'log --author does not search in timestamp' '
-       : >expect &&
        git log --author="$GIT_AUTHOR_DATE" >actual &&
-       test_cmp expect actual
+       test_must_be_empty actual
  '
  
  test_expect_success 'log --committer does not search in timestamp' '
-       : >expect &&
        git log --committer="$GIT_COMMITTER_DATE" >actual &&
-       test_cmp expect actual
+       test_must_be_empty actual
  '
  
  test_expect_success 'grep with CE_VALID file' '
@@@ -954,9 -932,10 +947,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_must_be_empty out &&
 -              test 1 = $(cat status)
 +              cd s &&
 +              test_expect_code 1 git grep xxyyzz .. >out &&
-               ! test -s out
++              test_must_be_empty out
        )
  '
  
@@@ -1065,13 -1044,12 +1058,12 @@@ test_expect_success 'inside git reposit
                echo ".gitignore:.*o*" &&
                cat is/expect.unignored
        } >is/expect.full &&
-       : >is/expect.empty &&
        echo file2:world >is/expect.sub &&
        (
                cd is/git &&
                git init &&
                test_must_fail git grep o >../actual.full &&
-               test_cmp ../expect.empty ../actual.full &&
+               test_must_be_empty ../actual.full &&
  
                git grep --untracked o >../actual.unignored &&
                test_cmp ../expect.unignored ../actual.unignored &&
  
                cd sub &&
                test_must_fail git grep o >../../actual.sub &&
-               test_cmp ../../expect.empty ../../actual.sub &&
+               test_must_be_empty ../../actual.sub &&
  
                git grep --no-index o >../../actual.sub &&
                test_cmp ../../expect.sub ../../actual.sub &&
@@@ -1250,10 -1228,9 +1242,9 @@@ test_expect_success !PCRE 'grep -P patt
  '
  
  test_expect_success 'grep pattern with grep.extendedRegexp=true' '
-       >empty &&
        test_must_fail git -c grep.extendedregexp=true \
                grep "\p{Ps}.*?\p{Pe}" hello.c >actual &&
-       test_cmp empty actual
+       test_must_be_empty actual
  '
  
  test_expect_success PCRE 'grep -P pattern with grep.extendedRegexp=true' '
index cd61288aa1a9476819bd9b19b888e9e1b75f1da5,99d7aa621db53e95188440f3df3faeb1383b1f31..c5946cb0b8a94cfc8c4e2a30284c3343acb8e876
@@@ -43,11 -43,11 +43,11 @@@ check_entries () 
        sed -ne '/^\//p' "$1/CVS/Entries" | sort | cut -d/ -f2,3,5 >actual
        if test -z "$2"
        then
-               >expected
+               test_must_be_empty actual
        else
                printf '%s\n' "$2" | tr '|' '\012' >expected
+               test_cmp expected actual
        fi
-       test_cmp expected actual
  }
  
  test_expect_success \
@@@ -187,7 -187,7 +187,7 @@@ test_expect_success 
        git commit -a -m "Update with spaces" &&
        id=$(git rev-list --max-count=1 HEAD) &&
        (cd "$CVSWORK" &&
 -      git cvsexportcommit -c $id
 +      git cvsexportcommit -c $id &&
        check_entries "G g" "with spaces.png/1.2/-kb|with spaces.txt/1.2/"
        )'
  
@@@ -245,7 -245,7 +245,7 @@@ test_expect_success FILEMODE 
        git add G/off &&
        git commit -a -m "Execute test" &&
        (cd "$CVSWORK" &&
 -      git cvsexportcommit -c HEAD
 +      git cvsexportcommit -c HEAD &&
        test -x G/on &&
        ! test -x G/off
        )'
@@@ -303,7 -303,7 +303,7 @@@ test_expect_success 're-commit a remove
      git add attic_gremlin &&
      git commit -m "Added attic_gremlin" &&
        git cvsexportcommit -w "$CVSWORK" -c HEAD &&
 -    (cd "$CVSWORK"; cvs -Q update -d) &&
 +    (cd "$CVSWORK" && cvs -Q update -d) &&
      test -f "$CVSWORK/attic_gremlin"
  '
  
diff --combined t/t9903-bash-prompt.sh
index ab890d3d4b3e2a39bb787bd29d7865c46f64c7f6,056bf1dcda95c04e05aa47dbc73f2d45d764c1d8..81a5179e28bf529bc2f0a8bc197108fcb69fba72
@@@ -63,15 -63,18 +63,15 @@@ test_expect_success 'prompt - unborn br
        test_cmp expected "$actual"
  '
  
 -repo_with_newline='repo
 -with
 -newline'
 -
 -if test_have_prereq !MINGW && mkdir "$repo_with_newline" 2>/dev/null
 -then
 -      test_set_prereq FUNNYNAMES
 -else
 +if test_have_prereq !FUNNYNAMES; then
        say 'Your filesystem does not allow newlines in filenames.'
  fi
  
  test_expect_success FUNNYNAMES 'prompt - with newline in path' '
 +    repo_with_newline="repo
 +with
 +newline" &&
 +      mkdir "$repo_with_newline" &&
        printf " (master)" >expected &&
        git init "$repo_with_newline" &&
        test_when_finished "rm -rf \"$repo_with_newline\"" &&
@@@ -513,10 -516,9 +513,9 @@@ test_expect_success 'prompt - format st
  
  test_expect_success 'prompt - pc mode' '
        printf "BEFORE: (\${__git_ps1_branch_name}):AFTER\\nmaster" >expected &&
-       printf "" >expected_output &&
        (
                __git_ps1 "BEFORE:" ":AFTER" >"$actual" &&
-               test_cmp expected_output "$actual" &&
+               test_must_be_empty "$actual" &&
                printf "%s\\n%s" "$PS1" "${__git_ps1_branch_name}" >"$actual"
        ) &&
        test_cmp expected "$actual"
@@@ -526,7 -528,7 +525,7 @@@ test_expect_success 'prompt - bash colo
        printf "BEFORE: (${c_green}\${__git_ps1_branch_name}${c_clear}):AFTER\\nmaster" >expected &&
        (
                GIT_PS1_SHOWCOLORHINTS=y &&
 -              __git_ps1 "BEFORE:" ":AFTER" >"$actual"
 +              __git_ps1 "BEFORE:" ":AFTER" >"$actual" &&
                printf "%s\\n%s" "$PS1" "${__git_ps1_branch_name}" >"$actual"
        ) &&
        test_cmp expected "$actual"
@@@ -712,13 -714,12 +711,12 @@@ test_expect_success 'prompt - hide if p
  '
  
  test_expect_success 'prompt - hide if pwd ignored - env var set, config unset' '
-       printf "" >expected &&
        (
                cd ignored_dir &&
                GIT_PS1_HIDE_IF_PWD_IGNORED=y &&
                __git_ps1 >"$actual"
        ) &&
-       test_cmp expected "$actual"
+       test_must_be_empty "$actual"
  '
  
  test_expect_success 'prompt - hide if pwd ignored - env var set, config unset, pc mode' '