{"thread":{"id":"51980","subject":"[PATCH] tests: remove \"cat foo\" before \"test_i18ngrep bar foo\"","startedAt":"2019-10-06T13:26:54Z","lastAt":"2019-10-07T01:19:12Z","messageCount":2,"participants":["René Scharfe","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"383519","messageId":"d178227d-7658-8c49-a147-e88d31c713e3@web.de","threadId":"51980","inReplyTo":null,"subject":"[PATCH] tests: remove \"cat foo\" before \"test_i18ngrep bar foo\"","fromName":"René Scharfe","fromEmail":"l.s.r@web.de","sentAt":"2019-10-06T13:26:42Z","receivedAt":"2019-10-06T13:26:54Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"Some tests print a file before searching for a pattern using\ntest_i18ngrep.  This is useful when debugging tests with --verbose when\nthe pattern is not found as expected.\n\nSince 63b1a175ee (t: make 'test_i18ngrep' more informative on failure,\n2018-02-08) test_i18ngrep already shows the contents of a file that\ndoesn't match the expected pattern, though.\n\nSo don't bother doing the same unconditionally up-front.  The contents\nare not interesting if the expected pattern is found, and showing it\ntwice if it doesn't match is of no use.\n\nSigned-off-by: René Scharfe <l.s.r@web.de>\n---\nAlmost formatted it using -U1..\n\n t/t1450-fsck.sh            | 16 ----------------\n t/t5801-remote-helpers.sh  |  1 -\n t/t7400-submodule-basic.sh |  2 --\n t/t9300-fast-import.sh     | 13 -------------\n 4 files changed, 32 deletions(-)\n\ndiff --git a/t/t1450-fsck.sh b/t/t1450-fsck.sh\nindex b36e0528d0..50d28e6fdb 100755\n--- a/t/t1450-fsck.sh\n+++ b/t/t1450-fsck.sh\n@@ -70,7 +70,6 @@ test_expect_success 'object with bad sha1' '\n \ttest_when_finished \"git update-ref -d refs/heads/bogus\" &&\n\n \ttest_must_fail git fsck 2>out &&\n-\tcat out &&\n \ttest_i18ngrep \"$sha.*corrupt\" out\n '\n\n@@ -78,7 +77,6 @@ test_expect_success 'branch pointing to non-commit' '\n \tgit rev-parse HEAD^{tree} >.git/refs/heads/invalid &&\n \ttest_when_finished \"git update-ref -d refs/heads/invalid\" &&\n \ttest_must_fail git fsck 2>out &&\n-\tcat out &&\n \ttest_i18ngrep \"not a commit\" out\n '\n\n@@ -88,7 +86,6 @@ test_expect_success 'HEAD link pointing at a funny object' '\n \techo $ZERO_OID >.git/HEAD &&\n \t# avoid corrupt/broken HEAD from interfering with repo discovery\n \ttest_must_fail env GIT_DIR=.git git fsck 2>out &&\n-\tcat out &&\n \ttest_i18ngrep \"detached HEAD points\" out\n '\n\n@@ -98,7 +95,6 @@ test_expect_success 'HEAD link pointing at a funny place' '\n \techo \"ref: refs/funny/place\" >.git/HEAD &&\n \t# avoid corrupt/broken HEAD from interfering with repo discovery\n \ttest_must_fail env GIT_DIR=.git git fsck 2>out &&\n-\tcat out &&\n \ttest_i18ngrep \"HEAD points to something strange\" out\n '\n\n@@ -157,7 +153,6 @@ test_expect_success 'email with embedded > is not okay' '\n \tgit update-ref refs/heads/bogus \"$new\" &&\n \ttest_when_finished \"git update-ref -d refs/heads/bogus\" &&\n \ttest_must_fail git fsck 2>out &&\n-\tcat out &&\n \ttest_i18ngrep \"error in commit $new\" out\n '\n\n@@ -169,7 +164,6 @@ test_expect_success 'missing < email delimiter is reported nicely' '\n \tgit update-ref refs/heads/bogus \"$new\" &&\n \ttest_when_finished \"git update-ref -d refs/heads/bogus\" &&\n \ttest_must_fail git fsck 2>out &&\n-\tcat out &&\n \ttest_i18ngrep \"error in commit $new.* - bad name\" out\n '\n\n@@ -181,7 +175,6 @@ test_expect_success 'missing email is reported nicely' '\n \tgit update-ref refs/heads/bogus \"$new\" &&\n \ttest_when_finished \"git update-ref -d refs/heads/bogus\" &&\n \ttest_must_fail git fsck 2>out &&\n-\tcat out &&\n \ttest_i18ngrep \"error in commit $new.* - missing email\" out\n '\n\n@@ -193,7 +186,6 @@ test_expect_success '> in name is reported' '\n \tgit update-ref refs/heads/bogus \"$new\" &&\n \ttest_when_finished \"git update-ref -d refs/heads/bogus\" &&\n \ttest_must_fail git fsck 2>out &&\n-\tcat out &&\n \ttest_i18ngrep \"error in commit $new\" out\n '\n\n@@ -207,7 +199,6 @@ test_expect_success 'integer overflow in timestamps is reported' '\n \tgit update-ref refs/heads/bogus \"$new\" &&\n \ttest_when_finished \"git update-ref -d refs/heads/bogus\" &&\n \ttest_must_fail git fsck 2>out &&\n-\tcat out &&\n \ttest_i18ngrep \"error in commit $new.*integer overflow\" out\n '\n\n@@ -219,7 +210,6 @@ test_expect_success 'commit with NUL in header' '\n \tgit update-ref refs/heads/bogus \"$new\" &&\n \ttest_when_finished \"git update-ref -d refs/heads/bogus\" &&\n \ttest_must_fail git fsck 2>out &&\n-\tcat out &&\n \ttest_i18ngrep \"error in commit $new.*unterminated header: NUL at offset\" out\n '\n\n@@ -297,7 +287,6 @@ test_expect_success 'tag pointing to nonexistent' '\n \techo $tag >.git/refs/tags/invalid &&\n \ttest_when_finished \"git update-ref -d refs/tags/invalid\" &&\n \ttest_must_fail git fsck --tags >out &&\n-\tcat out &&\n \ttest_i18ngrep \"broken link\" out\n '\n\n@@ -378,7 +367,6 @@ test_expect_success 'tag with NUL in header' '\n \techo $tag >.git/refs/tags/wrong &&\n \ttest_when_finished \"git update-ref -d refs/tags/wrong\" &&\n \ttest_must_fail git fsck --tags 2>out &&\n-\tcat out &&\n \ttest_i18ngrep \"error in tag $tag.*unterminated header: NUL at offset\" out\n '\n\n@@ -409,7 +397,6 @@ test_expect_success 'rev-list --verify-objects with bad sha1' '\n \ttest_when_finished \"git update-ref -d refs/heads/bogus\" &&\n\n \ttest_might_fail git rev-list --verify-objects refs/heads/bogus >/dev/null 2>out &&\n-\tcat out &&\n \ttest_i18ngrep -q \"error: hash mismatch $(dirname $new)$(test_oid ff_2)\" out\n '\n\n@@ -433,7 +420,6 @@ test_expect_success 'fsck notices blob entry pointing to null sha1' '\n \t sha=$(printf \"100644 file$_bz$_bzoid\" |\n \t       git hash-object -w --stdin -t tree) &&\n \t  git fsck 2>out &&\n-\t  cat out &&\n \t  test_i18ngrep \"warning.*null sha1\" out\n \t)\n '\n@@ -444,7 +430,6 @@ test_expect_success 'fsck notices submodule entry pointing to null sha1' '\n \t sha=$(printf \"160000 submodule$_bz$_bzoid\" |\n \t       git hash-object -w --stdin -t tree) &&\n \t  git fsck 2>out &&\n-\t  cat out &&\n \t  test_i18ngrep \"warning.*null sha1\" out\n \t)\n '\n@@ -465,7 +450,6 @@ while read name path pretty; do\n \t\t\tprintf \"$mode $type %s\\t%s\" \"$value\" \"$path\" >bad &&\n \t\t\tbad_tree=$(git mktree <bad) &&\n \t\t\tgit fsck 2>out &&\n-\t\t\tcat out &&\n \t\t\ttest_i18ngrep \"warning.*tree $bad_tree\" out\n \t\t)'\n \tdone <<-\\EOF\ndiff --git a/t/t5801-remote-helpers.sh b/t/t5801-remote-helpers.sh\nindex 2d6c4a281e..121e5c6edb 100755\n--- a/t/t5801-remote-helpers.sh\n+++ b/t/t5801-remote-helpers.sh\n@@ -247,7 +247,6 @@ clean_mark () {\n test_expect_success 'proper failure checks for fetching' '\n \t(cd local &&\n \ttest_must_fail env GIT_REMOTE_TESTGIT_FAILURE=1 git fetch 2>error &&\n-\tcat error &&\n \ttest_i18ngrep -q \"error while running fast-import\" error\n \t)\n '\ndiff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh\nindex a208cb26e1..691b5fc3bf 100755\n--- a/t/t7400-submodule-basic.sh\n+++ b/t/t7400-submodule-basic.sh\n@@ -527,7 +527,6 @@ test_expect_success 'update --init' '\n \ttest_must_fail git config submodule.example.url &&\n\n \tgit submodule update init 2> update.out &&\n-\tcat update.out &&\n \ttest_i18ngrep \"not initialized\" update.out &&\n \ttest_must_fail git rev-parse --resolve-git-dir init/.git &&\n\n@@ -545,7 +544,6 @@ test_expect_success 'update --init from subdirectory' '\n \t(\n \t\tcd sub &&\n \t\tgit submodule update ../init 2>update.out &&\n-\t\tcat update.out &&\n \t\ttest_i18ngrep \"not initialized\" update.out &&\n \t\ttest_must_fail git rev-parse --resolve-git-dir ../init/.git &&\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex 141b7fa35e..0a44a06239 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -2781,7 +2781,6 @@ test_expect_success 'S: filemodify with garbage after mark must fail' '\n \tCOMMIT\n \tM 100644 :403x hello.c\n \tEOF\n-\tcat err &&\n \ttest_i18ngrep \"space after mark\" err\n '\n\n@@ -2798,7 +2797,6 @@ test_expect_success 'S: filemodify with garbage after inline must fail' '\n \tinline\n \tBLOB\n \tEOF\n-\tcat err &&\n \ttest_i18ngrep \"nvalid dataref\" err\n '\n\n@@ -2812,7 +2810,6 @@ test_expect_success 'S: filemodify with garbage after sha1 must fail' '\n \tCOMMIT\n \tM 100644 ${sha1}x hello.c\n \tEOF\n-\tcat err &&\n \ttest_i18ngrep \"space after SHA1\" err\n '\n\n@@ -2828,7 +2825,6 @@ test_expect_success 'S: notemodify with garbage after mark dataref must fail' '\n \tCOMMIT\n \tN :202x :302\n \tEOF\n-\tcat err &&\n \ttest_i18ngrep \"space after mark\" err\n '\n\n@@ -2844,7 +2840,6 @@ test_expect_success 'S: notemodify with garbage after inline dataref must fail'\n \tnote blob\n \tBLOB\n \tEOF\n-\tcat err &&\n \ttest_i18ngrep \"nvalid dataref\" err\n '\n\n@@ -2858,7 +2853,6 @@ test_expect_success 'S: notemodify with garbage after sha1 dataref must fail' '\n \tCOMMIT\n \tN ${sha1}x :302\n \tEOF\n-\tcat err &&\n \ttest_i18ngrep \"space after SHA1\" err\n '\n\n@@ -2874,7 +2868,6 @@ test_expect_success 'S: notemodify with garbage after mark commit-ish must fail'\n \tCOMMIT\n \tN :202 :302x\n \tEOF\n-\tcat err &&\n \ttest_i18ngrep \"after mark\" err\n '\n\n@@ -2908,7 +2901,6 @@ test_expect_success 'S: from with garbage after mark must fail' '\n \tEOF\n\n \t# now evaluate the error\n-\tcat err &&\n \ttest_i18ngrep \"after mark\" err\n '\n\n@@ -2928,7 +2920,6 @@ test_expect_success 'S: merge with garbage after mark must fail' '\n \tmerge :303x\n \tM 100644 :403 hello.c\n \tEOF\n-\tcat err &&\n \ttest_i18ngrep \"after mark\" err\n '\n\n@@ -2944,7 +2935,6 @@ test_expect_success 'S: tag with garbage after mark must fail' '\n \ttag S\n \tTAG\n \tEOF\n-\tcat err &&\n \ttest_i18ngrep \"after mark\" err\n '\n\n@@ -2955,7 +2945,6 @@ test_expect_success 'S: cat-blob with garbage after mark must fail' '\n \ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n \tcat-blob :403x\n \tEOF\n-\tcat err &&\n \ttest_i18ngrep \"after mark\" err\n '\n\n@@ -2966,7 +2955,6 @@ test_expect_success 'S: ls with garbage after mark must fail' '\n \ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n \tls :302x hello.c\n \tEOF\n-\tcat err &&\n \ttest_i18ngrep \"space after mark\" err\n '\n\n@@ -2975,7 +2963,6 @@ test_expect_success 'S: ls with garbage after sha1 must fail' '\n \ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n \tls ${sha1}x hello.c\n \tEOF\n-\tcat err &&\n \ttest_i18ngrep \"space after tree-ish\" err\n '\n\n--\n2.23.0\n"},{"id":"383554","messageId":"xmqqsgo54ak3.fsf@gitster-ct.c.googlers.com","threadId":"51980","inReplyTo":"d178227d-7658-8c49-a147-e88d31c713e3@web.de","subject":"Re: [PATCH] tests: remove \"cat foo\" before \"test_i18ngrep bar foo\"","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-10-07T01:19:08Z","receivedAt":"2019-10-07T01:19:12Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"René Scharfe <l.s.r@web.de> writes:\n\n> Some tests print a file before searching for a pattern using\n> test_i18ngrep.  This is useful when debugging tests with --verbose when\n> the pattern is not found as expected.\n>\n> Since 63b1a175ee (t: make 'test_i18ngrep' more informative on failure,\n> 2018-02-08) test_i18ngrep already shows the contents of a file that\n> doesn't match the expected pattern, though.\n>\n> So don't bother doing the same unconditionally up-front.  The contents\n> are not interesting if the expected pattern is found, and showing it\n> twice if it doesn't match is of no use.\n>\n> Signed-off-by: René Scharfe <l.s.r@web.de>\n> ---\n> Almost formatted it using -U1..\n\nYeah, that's tempting ;-)\n\nThanks.  All looked good.\n"}]}