]> git.ipfire.org Git - thirdparty/git.git/commitdiff
tests: remove "cat foo" before "test_i18ngrep bar foo"
authorRené Scharfe <l.s.r@web.de>
Sun, 6 Oct 2019 13:26:42 +0000 (15:26 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 7 Oct 2019 01:17:44 +0000 (10:17 +0900)
Some tests print a file before searching for a pattern using
test_i18ngrep.  This is useful when debugging tests with --verbose when
the pattern is not found as expected.

Since 63b1a175ee (t: make 'test_i18ngrep' more informative on failure,
2018-02-08) test_i18ngrep already shows the contents of a file that
doesn't match the expected pattern, though.

So don't bother doing the same unconditionally up-front.  The contents
are not interesting if the expected pattern is found, and showing it
twice if it doesn't match is of no use.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t1450-fsck.sh
t/t5801-remote-helpers.sh
t/t7400-submodule-basic.sh
t/t9300-fast-import.sh

index b36e0528d07b0e50677c4e487d7b6bd64f79b4fe..50d28e6fdb6079a97b3b3a1bb0d633e736cbf45e 100755 (executable)
@@ -70,7 +70,6 @@ test_expect_success 'object with bad sha1' '
        test_when_finished "git update-ref -d refs/heads/bogus" &&
 
        test_must_fail git fsck 2>out &&
-       cat out &&
        test_i18ngrep "$sha.*corrupt" out
 '
 
@@ -78,7 +77,6 @@ test_expect_success 'branch pointing to non-commit' '
        git rev-parse HEAD^{tree} >.git/refs/heads/invalid &&
        test_when_finished "git update-ref -d refs/heads/invalid" &&
        test_must_fail git fsck 2>out &&
-       cat out &&
        test_i18ngrep "not a commit" out
 '
 
@@ -88,7 +86,6 @@ test_expect_success 'HEAD link pointing at a funny object' '
        echo $ZERO_OID >.git/HEAD &&
        # avoid corrupt/broken HEAD from interfering with repo discovery
        test_must_fail env GIT_DIR=.git git fsck 2>out &&
-       cat out &&
        test_i18ngrep "detached HEAD points" out
 '
 
@@ -98,7 +95,6 @@ test_expect_success 'HEAD link pointing at a funny place' '
        echo "ref: refs/funny/place" >.git/HEAD &&
        # avoid corrupt/broken HEAD from interfering with repo discovery
        test_must_fail env GIT_DIR=.git git fsck 2>out &&
-       cat out &&
        test_i18ngrep "HEAD points to something strange" out
 '
 
@@ -157,7 +153,6 @@ test_expect_success 'email with embedded > is not okay' '
        git update-ref refs/heads/bogus "$new" &&
        test_when_finished "git update-ref -d refs/heads/bogus" &&
        test_must_fail git fsck 2>out &&
-       cat out &&
        test_i18ngrep "error in commit $new" out
 '
 
@@ -169,7 +164,6 @@ test_expect_success 'missing < email delimiter is reported nicely' '
        git update-ref refs/heads/bogus "$new" &&
        test_when_finished "git update-ref -d refs/heads/bogus" &&
        test_must_fail git fsck 2>out &&
-       cat out &&
        test_i18ngrep "error in commit $new.* - bad name" out
 '
 
@@ -181,7 +175,6 @@ test_expect_success 'missing email is reported nicely' '
        git update-ref refs/heads/bogus "$new" &&
        test_when_finished "git update-ref -d refs/heads/bogus" &&
        test_must_fail git fsck 2>out &&
-       cat out &&
        test_i18ngrep "error in commit $new.* - missing email" out
 '
 
@@ -193,7 +186,6 @@ test_expect_success '> in name is reported' '
        git update-ref refs/heads/bogus "$new" &&
        test_when_finished "git update-ref -d refs/heads/bogus" &&
        test_must_fail git fsck 2>out &&
-       cat out &&
        test_i18ngrep "error in commit $new" out
 '
 
@@ -207,7 +199,6 @@ test_expect_success 'integer overflow in timestamps is reported' '
        git update-ref refs/heads/bogus "$new" &&
        test_when_finished "git update-ref -d refs/heads/bogus" &&
        test_must_fail git fsck 2>out &&
-       cat out &&
        test_i18ngrep "error in commit $new.*integer overflow" out
 '
 
@@ -219,7 +210,6 @@ test_expect_success 'commit with NUL in header' '
        git update-ref refs/heads/bogus "$new" &&
        test_when_finished "git update-ref -d refs/heads/bogus" &&
        test_must_fail git fsck 2>out &&
-       cat out &&
        test_i18ngrep "error in commit $new.*unterminated header: NUL at offset" out
 '
 
@@ -297,7 +287,6 @@ test_expect_success 'tag pointing to nonexistent' '
        echo $tag >.git/refs/tags/invalid &&
        test_when_finished "git update-ref -d refs/tags/invalid" &&
        test_must_fail git fsck --tags >out &&
-       cat out &&
        test_i18ngrep "broken link" out
 '
 
@@ -378,7 +367,6 @@ test_expect_success 'tag with NUL in header' '
        echo $tag >.git/refs/tags/wrong &&
        test_when_finished "git update-ref -d refs/tags/wrong" &&
        test_must_fail git fsck --tags 2>out &&
-       cat out &&
        test_i18ngrep "error in tag $tag.*unterminated header: NUL at offset" out
 '
 
@@ -409,7 +397,6 @@ test_expect_success 'rev-list --verify-objects with bad sha1' '
        test_when_finished "git update-ref -d refs/heads/bogus" &&
 
        test_might_fail git rev-list --verify-objects refs/heads/bogus >/dev/null 2>out &&
-       cat out &&
        test_i18ngrep -q "error: hash mismatch $(dirname $new)$(test_oid ff_2)" out
 '
 
@@ -433,7 +420,6 @@ test_expect_success 'fsck notices blob entry pointing to null sha1' '
         sha=$(printf "100644 file$_bz$_bzoid" |
               git hash-object -w --stdin -t tree) &&
          git fsck 2>out &&
-         cat out &&
          test_i18ngrep "warning.*null sha1" out
        )
 '
@@ -444,7 +430,6 @@ test_expect_success 'fsck notices submodule entry pointing to null sha1' '
         sha=$(printf "160000 submodule$_bz$_bzoid" |
               git hash-object -w --stdin -t tree) &&
          git fsck 2>out &&
-         cat out &&
          test_i18ngrep "warning.*null sha1" out
        )
 '
@@ -465,7 +450,6 @@ while read name path pretty; do
                        printf "$mode $type %s\t%s" "$value" "$path" >bad &&
                        bad_tree=$(git mktree <bad) &&
                        git fsck 2>out &&
-                       cat out &&
                        test_i18ngrep "warning.*tree $bad_tree" out
                )'
        done <<-\EOF
index 2d6c4a281edb3f0678a600fd3e780825536da437..121e5c6edb0a21eb8a6d72d01c7edd5f45d11b2f 100755 (executable)
@@ -247,7 +247,6 @@ clean_mark () {
 test_expect_success 'proper failure checks for fetching' '
        (cd local &&
        test_must_fail env GIT_REMOTE_TESTGIT_FAILURE=1 git fetch 2>error &&
-       cat error &&
        test_i18ngrep -q "error while running fast-import" error
        )
 '
index a208cb26e1dfd4b1a147f620747c025600ce7181..691b5fc3bfa6b0118640a269e5e1a2817989b09b 100755 (executable)
@@ -527,7 +527,6 @@ test_expect_success 'update --init' '
        test_must_fail git config submodule.example.url &&
 
        git submodule update init 2> update.out &&
-       cat update.out &&
        test_i18ngrep "not initialized" update.out &&
        test_must_fail git rev-parse --resolve-git-dir init/.git &&
 
@@ -545,7 +544,6 @@ test_expect_success 'update --init from subdirectory' '
        (
                cd sub &&
                git submodule update ../init 2>update.out &&
-               cat update.out &&
                test_i18ngrep "not initialized" update.out &&
                test_must_fail git rev-parse --resolve-git-dir ../init/.git &&
 
index 141b7fa35e74b860d91ea7cdabf48730442ed635..0a44a06239192983c412b63d5f940f5ab4581c4f 100755 (executable)
@@ -2781,7 +2781,6 @@ test_expect_success 'S: filemodify with garbage after mark must fail' '
        COMMIT
        M 100644 :403x hello.c
        EOF
-       cat err &&
        test_i18ngrep "space after mark" err
 '
 
@@ -2798,7 +2797,6 @@ test_expect_success 'S: filemodify with garbage after inline must fail' '
        inline
        BLOB
        EOF
-       cat err &&
        test_i18ngrep "nvalid dataref" err
 '
 
@@ -2812,7 +2810,6 @@ test_expect_success 'S: filemodify with garbage after sha1 must fail' '
        COMMIT
        M 100644 ${sha1}x hello.c
        EOF
-       cat err &&
        test_i18ngrep "space after SHA1" err
 '
 
@@ -2828,7 +2825,6 @@ test_expect_success 'S: notemodify with garbage after mark dataref must fail' '
        COMMIT
        N :202x :302
        EOF
-       cat err &&
        test_i18ngrep "space after mark" err
 '
 
@@ -2844,7 +2840,6 @@ test_expect_success 'S: notemodify with garbage after inline dataref must fail'
        note blob
        BLOB
        EOF
-       cat err &&
        test_i18ngrep "nvalid dataref" err
 '
 
@@ -2858,7 +2853,6 @@ test_expect_success 'S: notemodify with garbage after sha1 dataref must fail' '
        COMMIT
        N ${sha1}x :302
        EOF
-       cat err &&
        test_i18ngrep "space after SHA1" err
 '
 
@@ -2874,7 +2868,6 @@ test_expect_success 'S: notemodify with garbage after mark commit-ish must fail'
        COMMIT
        N :202 :302x
        EOF
-       cat err &&
        test_i18ngrep "after mark" err
 '
 
@@ -2908,7 +2901,6 @@ test_expect_success 'S: from with garbage after mark must fail' '
        EOF
 
        # now evaluate the error
-       cat err &&
        test_i18ngrep "after mark" err
 '
 
@@ -2928,7 +2920,6 @@ test_expect_success 'S: merge with garbage after mark must fail' '
        merge :303x
        M 100644 :403 hello.c
        EOF
-       cat err &&
        test_i18ngrep "after mark" err
 '
 
@@ -2944,7 +2935,6 @@ test_expect_success 'S: tag with garbage after mark must fail' '
        tag S
        TAG
        EOF
-       cat err &&
        test_i18ngrep "after mark" err
 '
 
@@ -2955,7 +2945,6 @@ test_expect_success 'S: cat-blob with garbage after mark must fail' '
        test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
        cat-blob :403x
        EOF
-       cat err &&
        test_i18ngrep "after mark" err
 '
 
@@ -2966,7 +2955,6 @@ test_expect_success 'S: ls with garbage after mark must fail' '
        test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
        ls :302x hello.c
        EOF
-       cat err &&
        test_i18ngrep "space after mark" err
 '
 
@@ -2975,7 +2963,6 @@ test_expect_success 'S: ls with garbage after sha1 must fail' '
        test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
        ls ${sha1}x hello.c
        EOF
-       cat err &&
        test_i18ngrep "space after tree-ish" err
 '