{"thread":{"id":"59986","subject":"[PATCH] t4002: fix \"diff can read from stdin\" syntax","startedAt":"2023-07-14T13:30:17Z","lastAt":"2023-07-14T18:56:39Z","messageCount":5,"participants":["D. Ben Knoble via GitGitGadget","René Scharfe","D. Ben Knoble","Junio C Hamano","John Cai"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"479516","messageId":"pull.1545.git.git.1689341410476.gitgitgadget@gmail.com","threadId":"59986","inReplyTo":null,"subject":"[PATCH] t4002: fix \"diff can read from stdin\" syntax","fromName":"D. Ben Knoble via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-07-14T13:30:10Z","receivedAt":"2023-07-14T13:30:17Z","isPatch":true,"sender":{"key":"ben.knoble@gmail.com","avatar":"https://avatars.githubusercontent.com/u/22802209?v=4"},"body":"From: \"D. Ben Knoble\" <ben.knoble+github@gmail.com>\n\nI noticed this test was producing output like\n\n```\nt4002-diff-basic.sh: test_expect_successdiff can read from stdin: not found\n```\n\nwhich is rather odd. Investigation shows an error of shell syntax:\nfoo'abc' is the same as fooabc to the shell. Perhaps obviously, this is\nnot a valid command for the test.\n\nI am surprised this doesn't count as an error in the test, but that\naccounts for it going unnoticed.\n\nSigned-off-by: D. Ben Knoble <ben.knoble+github@gmail.com>\n---\n    t4002: fix \"diff can read from stdin\" syntax\n    \n    I noticed this test was producing output like\n    \n    t4002-diff-basic.sh: test_expect_successdiff can read from stdin: not found\n    \n    \n    which is rather odd. Investigation shows an error of shell syntax:\n    foo'abc' is the same as fooabc to the shell. Perhaps obviously, this is\n    not a valid command for the test.\n    \n    I am surprised this doesn't count as an error in the test, but that\n    accounts for it going unnoticed.\n    \n    ------------------------------------------------------------------------\n    \n    I would be interested in knowing how to \"unsilence\" failures like this\n    so they do not go unnoticed in the future.\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1545%2Fbenknoble%2Ft4002-diff-stdin-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1545/benknoble/t4002-diff-stdin-v1\nPull-Request: https://github.com/git/git/pull/1545\n\n t/t4002-diff-basic.sh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/t/t4002-diff-basic.sh b/t/t4002-diff-basic.sh\nindex d524d4057dc..7afc883ec37 100755\n--- a/t/t4002-diff-basic.sh\n+++ b/t/t4002-diff-basic.sh\n@@ -403,7 +403,7 @@ test_expect_success 'diff-tree -r B A == diff-tree -r -R A B' '\n \tgit diff-tree -r -R $tree_A $tree_B >.test-b &&\n \tcmp -s .test-a .test-b'\n \n-test_expect_success'diff can read from stdin' '\n+test_expect_success 'diff can read from stdin' '\n \ttest_must_fail git diff --no-index -- MN - < NN |\n \t\tgrep -v \"^index\" | sed \"s#/-#/NN#\" >.test-a &&\n \ttest_must_fail git diff --no-index -- MN NN |\n\nbase-commit: aa9166bcc0ba654fc21f198a30647ec087f733ed\n-- \ngitgitgadget\n"},{"id":"479518","messageId":"279beaea-d332-0d88-3cd0-b935ef6bc5eb@web.de","threadId":"59986","inReplyTo":"pull.1545.git.git.1689341410476.gitgitgadget@gmail.com","subject":"Re: [PATCH] t4002: fix \"diff can read from stdin\" syntax","fromName":"René Scharfe","fromEmail":"l.s.r@web.de","sentAt":"2023-07-14T14:44:08Z","receivedAt":"2023-07-14T14:44:18Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"Am 14.07.23 um 15:30 schrieb D. Ben Knoble via GitGitGadget:\n> diff --git a/t/t4002-diff-basic.sh b/t/t4002-diff-basic.sh\n> index d524d4057dc..7afc883ec37 100755\n> --- a/t/t4002-diff-basic.sh\n> +++ b/t/t4002-diff-basic.sh\n> @@ -403,7 +403,7 @@ test_expect_success 'diff-tree -r B A == diff-tree -r -R A B' '\n>  \tgit diff-tree -r -R $tree_A $tree_B >.test-b &&\n>  \tcmp -s .test-a .test-b'\n>\n> -test_expect_success'diff can read from stdin' '\n> +test_expect_success 'diff can read from stdin' '\n>  \ttest_must_fail git diff --no-index -- MN - < NN |\n>  \t\tgrep -v \"^index\" | sed \"s#/-#/NN#\" >.test-a &&\n>  \ttest_must_fail git diff --no-index -- MN NN |\n>\n\nGood find!  Introduced by 9cfcbcc095 (t4002-diff-basic: modernize test\nformat, 2023-05-18).  Perhaps an automatic formatter would have avoided\nit?  E.g. some sed(1) scripting, or shfmt (https://github.com/mvdan/sh)?\n(Just discovered shfmt, never used it.)\n\nRené\n"},{"id":"479519","messageId":"CALnO6CCOWvYLkGRJOSV5saK3g3s0+RD-aEopF6gcX3qfmU5=UQ@mail.gmail.com","threadId":"59986","inReplyTo":"279beaea-d332-0d88-3cd0-b935ef6bc5eb@web.de","subject":"Re: [PATCH] t4002: fix \"diff can read from stdin\" syntax","fromName":"D. Ben Knoble","fromEmail":"ben.knoble+github@gmail.com","sentAt":"2023-07-14T14:53:48Z","receivedAt":"2023-07-14T14:54:17Z","isPatch":true,"sender":{"key":"ben.knoble@gmail.com","avatar":"https://avatars.githubusercontent.com/u/22802209?v=4"},"body":"On Fri, Jul 14, 2023 at 10:44 AM René Scharfe <l.s.r@web.de> wrote:\n>\n> Good find!  Introduced by 9cfcbcc095 (t4002-diff-basic: modernize test\n> format, 2023-05-18).  Perhaps an automatic formatter would have avoided\n> it?  E.g. some sed(1) scripting, or shfmt (https://github.com/mvdan/sh)?\n> (Just discovered shfmt, never used it.)\n\nI'm doubtful: it would have to know things about the test_* commands.\n(I would expect context-blind formatters to leave it alone, as it is a\nperfectly correct way to spell a command with spaces in the name,\nthough who would do such a thing, I don't know.)\n"},{"id":"479524","messageId":"xmqqzg3yph9r.fsf@gitster.g","threadId":"59986","inReplyTo":"pull.1545.git.git.1689341410476.gitgitgadget@gmail.com","subject":"Re: [PATCH] t4002: fix \"diff can read from stdin\" syntax","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-07-14T16:52:32Z","receivedAt":"2023-07-14T16:52:38Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"D. Ben Knoble via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n\n> From: \"D. Ben Knoble\" <ben.knoble+github@gmail.com>\n>\n> I noticed this test was producing output like\n>\n> ```\n> t4002-diff-basic.sh: test_expect_successdiff can read from stdin: not found\n> ```\n>\n> which is rather odd. Investigation shows an error of shell syntax:\n> foo'abc' is the same as fooabc to the shell. Perhaps obviously, this is\n> not a valid command for the test.\n>\n> I am surprised this doesn't count as an error in the test, but that\n> accounts for it going unnoticed.\n>\n> Signed-off-by: D. Ben Knoble <ben.knoble+github@gmail.com>\n> ---\n\nNicely spotted.  Thanks.\n\nWill queue.\n"},{"id":"479528","messageId":"CEC94FDD-E5F1-48C0-8FBF-05682EBEB035@gmail.com","threadId":"59986","inReplyTo":"279beaea-d332-0d88-3cd0-b935ef6bc5eb@web.de","subject":"Re: [PATCH] t4002: fix \"diff can read from stdin\" syntax","fromName":"John Cai","fromEmail":"johncai86@gmail.com","sentAt":"2023-07-14T18:56:34Z","receivedAt":"2023-07-14T18:56:39Z","isPatch":true,"sender":{"key":"johncai86@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2354211?v=4"},"body":"\nOn 14 Jul 2023, at 10:44, René Scharfe wrote:\n\n> Am 14.07.23 um 15:30 schrieb D. Ben Knoble via GitGitGadget:\n>> diff --git a/t/t4002-diff-basic.sh b/t/t4002-diff-basic.sh\n>> index d524d4057dc..7afc883ec37 100755\n>> --- a/t/t4002-diff-basic.sh\n>> +++ b/t/t4002-diff-basic.sh\n>> @@ -403,7 +403,7 @@ test_expect_success 'diff-tree -r B A == diff-tree -r -R A B' '\n>>  \tgit diff-tree -r -R $tree_A $tree_B >.test-b &&\n>>  \tcmp -s .test-a .test-b'\n>>\n>> -test_expect_success'diff can read from stdin' '\n>> +test_expect_success 'diff can read from stdin' '\n>>  \ttest_must_fail git diff --no-index -- MN - < NN |\n>>  \t\tgrep -v \"^index\" | sed \"s#/-#/NN#\" >.test-a &&\n>>  \ttest_must_fail git diff --no-index -- MN NN |\n>>\n>\n> Good find!  Introduced by 9cfcbcc095 (t4002-diff-basic: modernize test\n> format, 2023-05-18).  Perhaps an automatic formatter would have avoided\n> it?  E.g. some sed(1) scripting, or shfmt (https://github.com/mvdan/sh)?\n> (Just discovered shfmt, never used it.)\n\nThanks for finding this and fixing!\n\n>\n> René\n"}]}