{"thread":{"id":"52352","subject":"[PATCH] test: use test_must_be_empty F instead of test_cmp empty F","startedAt":"2019-11-26T19:46:40Z","lastAt":"2019-11-27T07:51:50Z","messageCount":4,"participants":["René Scharfe","Denton Liu"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"387103","messageId":"52479277-b753-c3c0-7f6c-5d013016964e@web.de","threadId":"52352","inReplyTo":null,"subject":"[PATCH] test: use test_must_be_empty F instead of test_cmp empty F","fromName":"René Scharfe","fromEmail":"l.s.r@web.de","sentAt":"2019-11-26T19:46:34Z","receivedAt":"2019-11-26T19:46:40Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"Use test_must_be_empty instead of comparing it to an empty file.  That's\nmore efficient, as the function only needs built-in meta-data only check\nin the usual case, and provides nicer debug output otherwise.\n\nSigned-off-by: René Scharfe <l.s.r@web.de>\n---\n t/t1011-read-tree-sparse-checkout.sh | 3 +--\n t/t9010-svn-fe.sh                    | 6 ++----\n 2 files changed, 3 insertions(+), 6 deletions(-)\n\ndiff --git a/t/t1011-read-tree-sparse-checkout.sh b/t/t1011-read-tree-sparse-checkout.sh\nindex ba71b159ba..eb44bafb59 100755\n--- a/t/t1011-read-tree-sparse-checkout.sh\n+++ b/t/t1011-read-tree-sparse-checkout.sh\n@@ -215,7 +215,6 @@ test_expect_success 'read-tree adds to worktree, dirty case' '\n '\n\n test_expect_success 'index removal and worktree narrowing at the same time' '\n-\t>empty &&\n \techo init.t >.git/info/sparse-checkout &&\n \techo sub/added >>.git/info/sparse-checkout &&\n \tgit checkout -f top &&\n@@ -223,7 +222,7 @@ test_expect_success 'index removal and worktree narrowing at the same time' '\n \tgit checkout removed &&\n \tgit ls-files sub/added >result &&\n \ttest ! -f sub/added &&\n-\ttest_cmp empty result\n+\ttest_must_be_empty result\n '\n\n test_expect_success 'read-tree --reset removes outside worktree' '\ndiff --git a/t/t9010-svn-fe.sh b/t/t9010-svn-fe.sh\nindex 0b20b07e68..3a3d8d3bd5 100755\n--- a/t/t9010-svn-fe.sh\n+++ b/t/t9010-svn-fe.sh\n@@ -53,9 +53,7 @@ text_no_props () {\n \tprintf \"%s\\n\" \"$text\"\n }\n\n->empty\n-\n-test_expect_success 'empty dump' '\n+test_expect_success PIPE 'empty dump' '\n \treinit_git &&\n \techo \"SVN-fs-dump-format-version: 2\" >input &&\n \ttry_dump input\n@@ -208,7 +206,7 @@ test_expect_failure 'timestamp and empty file' '\n \ttest_cmp expect.date actual.date &&\n \ttest_cmp expect.files actual.files &&\n \tgit checkout HEAD empty-file &&\n-\ttest_cmp empty file\n+\ttest_must_be_empty file\n '\n\n test_expect_success 'directory with files' '\n--\n2.24.0\n\n"},{"id":"387104","messageId":"20191126200239.GA36748@generichostname","threadId":"52352","inReplyTo":"52479277-b753-c3c0-7f6c-5d013016964e@web.de","subject":"Re: [PATCH] test: use test_must_be_empty F instead of test_cmp empty F","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-11-26T20:02:39Z","receivedAt":"2019-11-26T20:02:44Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Hi René,\n\nOn Tue, Nov 26, 2019 at 08:46:34PM +0100, René Scharfe wrote:\n> Use test_must_be_empty instead of comparing it to an empty file.  That's\n> more efficient, as the function only needs built-in meta-data only check\n> in the usual case, and provides nicer debug output otherwise.\n> \n> Signed-off-by: René Scharfe <l.s.r@web.de>\n\nNice, I like test cleanup :)\n\n> ---\n\n[...]\n\n> diff --git a/t/t9010-svn-fe.sh b/t/t9010-svn-fe.sh\n> index 0b20b07e68..3a3d8d3bd5 100755\n> --- a/t/t9010-svn-fe.sh\n> +++ b/t/t9010-svn-fe.sh\n> @@ -53,9 +53,7 @@ text_no_props () {\n>  \tprintf \"%s\\n\" \"$text\"\n>  }\n> \n> ->empty\n> -\n> -test_expect_success 'empty dump' '\n> +test_expect_success PIPE 'empty dump' '\n\nHow come we need the PIPE prereq here? At the top of this file, we have\n\n\tif test_have_prereq !PIPE\n\tthen\n\t\tskip_all=\"svn dumpfile importer testing requires the PIPE prerequisite\"\n\t\ttest_done\n\tfi\n\nwhich should guarantee PIPE at this point already.\n\nThanks,\n\nDenton\n\n>  \treinit_git &&\n>  \techo \"SVN-fs-dump-format-version: 2\" >input &&\n>  \ttry_dump input\n> @@ -208,7 +206,7 @@ test_expect_failure 'timestamp and empty file' '\n>  \ttest_cmp expect.date actual.date &&\n>  \ttest_cmp expect.files actual.files &&\n>  \tgit checkout HEAD empty-file &&\n> -\ttest_cmp empty file\n> +\ttest_must_be_empty file\n>  '\n> \n>  test_expect_success 'directory with files' '\n> --\n> 2.24.0\n> \n"},{"id":"387133","messageId":"8dc0b50d-4e41-bc79-33a1-7e2a1ef7aa0b@web.de","threadId":"52352","inReplyTo":"20191126200239.GA36748@generichostname","subject":"Re: [PATCH] test: use test_must_be_empty F instead of test_cmp empty F","fromName":"René Scharfe","fromEmail":"l.s.r@web.de","sentAt":"2019-11-27T07:51:09Z","receivedAt":"2019-11-27T07:51:39Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"Am 26.11.19 um 21:02 schrieb Denton Liu:\n>> diff --git a/t/t9010-svn-fe.sh b/t/t9010-svn-fe.sh\n>> index 0b20b07e68..3a3d8d3bd5 100755\n>> --- a/t/t9010-svn-fe.sh\n>> +++ b/t/t9010-svn-fe.sh\n>> @@ -53,9 +53,7 @@ text_no_props () {\n>>  \tprintf \"%s\\n\" \"$text\"\n>>  }\n>>\n>> ->empty\n>> -\n>> -test_expect_success 'empty dump' '\n>> +test_expect_success PIPE 'empty dump' '\n>\n> How come we need the PIPE prereq here? At the top of this file, we have\n>\n> \tif test_have_prereq !PIPE\n> \tthen\n> \t\tskip_all=\"svn dumpfile importer testing requires the PIPE prerequisite\"\n> \t\ttest_done\n> \tfi\n>\n> which should guarantee PIPE at this point already.\n\nRight, we haven't needed it since 7236a34c98 (t9010-*.sh: skip all tests\nif the PIPE prereq is missing, 2017-09-17).  Thanks for catching this!\n\nMy patch had been gathering dust here already before that time, and\nsometime along the way I did a sloppy rebase.  Didn't see it before\nsending because I was focusing on \"can we remove the empty file?\".  O_o\n\nRené\n"},{"id":"387134","messageId":"a56a4b33-61f8-d3a5-d85f-431c70b8f3e7@web.de","threadId":"52352","inReplyTo":"52479277-b753-c3c0-7f6c-5d013016964e@web.de","subject":"[PATCH v2] test: use test_must_be_empty F instead of test_cmp empty F","fromName":"René Scharfe","fromEmail":"l.s.r@web.de","sentAt":"2019-11-27T07:51:43Z","receivedAt":"2019-11-27T07:51:50Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"Use test_must_be_empty instead of comparing it to an empty file.  That's\nmore efficient, as the function only needs built-in meta-data only check\nin the usual case, and provides nicer debug output otherwise.\n\nHelped-by: Denton Liu <liu.denton@gmail.com>\nSigned-off-by: René Scharfe <l.s.r@web.de>\n---\nChange since v1: Don't re-add PIPE prerequisite.\n\n t/t1011-read-tree-sparse-checkout.sh | 3 +--\n t/t9010-svn-fe.sh                    | 4 +---\n 2 files changed, 2 insertions(+), 5 deletions(-)\n\ndiff --git a/t/t1011-read-tree-sparse-checkout.sh b/t/t1011-read-tree-sparse-checkout.sh\nindex ba71b159ba..eb44bafb59 100755\n--- a/t/t1011-read-tree-sparse-checkout.sh\n+++ b/t/t1011-read-tree-sparse-checkout.sh\n@@ -215,7 +215,6 @@ test_expect_success 'read-tree adds to worktree, dirty case' '\n '\n\n test_expect_success 'index removal and worktree narrowing at the same time' '\n-\t>empty &&\n \techo init.t >.git/info/sparse-checkout &&\n \techo sub/added >>.git/info/sparse-checkout &&\n \tgit checkout -f top &&\n@@ -223,7 +222,7 @@ test_expect_success 'index removal and worktree narrowing at the same time' '\n \tgit checkout removed &&\n \tgit ls-files sub/added >result &&\n \ttest ! -f sub/added &&\n-\ttest_cmp empty result\n+\ttest_must_be_empty result\n '\n\n test_expect_success 'read-tree --reset removes outside worktree' '\ndiff --git a/t/t9010-svn-fe.sh b/t/t9010-svn-fe.sh\nindex 0b20b07e68..c90fdc5c89 100755\n--- a/t/t9010-svn-fe.sh\n+++ b/t/t9010-svn-fe.sh\n@@ -53,8 +53,6 @@ text_no_props () {\n \tprintf \"%s\\n\" \"$text\"\n }\n\n->empty\n-\n test_expect_success 'empty dump' '\n \treinit_git &&\n \techo \"SVN-fs-dump-format-version: 2\" >input &&\n@@ -208,7 +206,7 @@ test_expect_failure 'timestamp and empty file' '\n \ttest_cmp expect.date actual.date &&\n \ttest_cmp expect.files actual.files &&\n \tgit checkout HEAD empty-file &&\n-\ttest_cmp empty file\n+\ttest_must_be_empty file\n '\n\n test_expect_success 'directory with files' '\n--\n2.24.0\n\n"}]}