{"thread":{"id":"59381","subject":"[PATCH v1 1/7] t1005: assert output of ls-files","startedAt":"2023-03-12T20:16:16Z","lastAt":"2023-03-28T17:38:13Z","messageCount":33,"participants":["Andrei Rybak","Junio C Hamano","Michael J Gruber"],"isPatch":true,"patchVersion":1,"patchTotal":7},"messages":[{"id":"473425","messageId":"20230312201520.370234-2-rybak.a.v@gmail.com","threadId":"59381","inReplyTo":"20230312201520.370234-1-rybak.a.v@gmail.com","subject":"[PATCH v1 1/7] t1005: assert output of ls-files","fromName":"Andrei Rybak","fromEmail":"rybak.a.v@gmail.com","sentAt":"2023-03-12T20:15:13Z","receivedAt":"2023-03-12T20:16:16Z","isPatch":true,"sender":{"key":"rybak.a.v@gmail.com","avatar":"https://avatars.githubusercontent.com/u/624072?v=4"},"body":"Test 'reset should work' in t1005-read-tree-reset.sh compares two files\n\"expect\" and \"actual\" to assert the expected output of \"git ls-files\".\nSeveral other tests in the same file also create files \"expect\" and\n\"actual\", but don't use them in assertions.\n\nAssert output of \"git ls-files\" in t1005-read-tree-reset.sh to improve\ntest coverage.\n\nSigned-off-by: Andrei Rybak <rybak.a.v@gmail.com>\n---\n t/t1005-read-tree-reset.sh | 15 ++++++++++-----\n 1 file changed, 10 insertions(+), 5 deletions(-)\n\ndiff --git a/t/t1005-read-tree-reset.sh b/t/t1005-read-tree-reset.sh\nindex 12e30d77d0..26be4a2b5a 100755\n--- a/t/t1005-read-tree-reset.sh\n+++ b/t/t1005-read-tree-reset.sh\n@@ -41,7 +41,8 @@ test_expect_success 'reset should remove remnants from a failed merge' '\n \tgit ls-files -s &&\n \tread_tree_u_must_succeed --reset -u HEAD &&\n \tgit ls-files -s >actual &&\n-\t! test -f old\n+\t! test -f old &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success 'two-way reset should remove remnants too' '\n@@ -56,7 +57,8 @@ test_expect_success 'two-way reset should remove remnants too' '\n \tgit ls-files -s &&\n \tread_tree_u_must_succeed --reset -u HEAD HEAD &&\n \tgit ls-files -s >actual &&\n-\t! test -f old\n+\t! test -f old &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success 'Porcelain reset should remove remnants too' '\n@@ -71,7 +73,8 @@ test_expect_success 'Porcelain reset should remove remnants too' '\n \tgit ls-files -s &&\n \tgit reset --hard &&\n \tgit ls-files -s >actual &&\n-\t! test -f old\n+\t! test -f old &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success 'Porcelain checkout -f should remove remnants too' '\n@@ -86,7 +89,8 @@ test_expect_success 'Porcelain checkout -f should remove remnants too' '\n \tgit ls-files -s &&\n \tgit checkout -f &&\n \tgit ls-files -s >actual &&\n-\t! test -f old\n+\t! test -f old &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success 'Porcelain checkout -f HEAD should remove remnants too' '\n@@ -101,7 +105,8 @@ test_expect_success 'Porcelain checkout -f HEAD should remove remnants too' '\n \tgit ls-files -s &&\n \tgit checkout -f HEAD &&\n \tgit ls-files -s >actual &&\n-\t! test -f old\n+\t! test -f old &&\n+\ttest_cmp expect actual\n '\n \n test_done\n-- \n2.39.2\n\n"},{"id":"473426","messageId":"20230312201520.370234-3-rybak.a.v@gmail.com","threadId":"59381","inReplyTo":"20230312201520.370234-1-rybak.a.v@gmail.com","subject":"[PATCH v1 1/1] t1507: assert output of rev-parse","fromName":"Andrei Rybak","fromEmail":"rybak.a.v@gmail.com","sentAt":"2023-03-12T20:15:14Z","receivedAt":"2023-03-12T20:16:17Z","isPatch":true,"sender":{"key":"rybak.a.v@gmail.com","avatar":"https://avatars.githubusercontent.com/u/624072?v=4"},"body":"Tests in t1507-rev-parse-upstream.sh compare files \"expect\" and \"actual\"\nto assert the output of \"git rev-parse\", \"git show\", and \"git log\".\nHowever, two of the tests '@{reflog}-parsing does not look beyond colon'\nand '@{upstream}-parsing does not look beyond colon' don't inspect the\ncontents of the created files.\n\nAssert output of \"git rev-parse\" in tests in t1507-rev-parse-upstream.sh\nto improve test coverage.\n\nSigned-off-by: Andrei Rybak <rybak.a.v@gmail.com>\n---\n t/t1507-rev-parse-upstream.sh | 6 ++++--\n 1 file changed, 4 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t1507-rev-parse-upstream.sh b/t/t1507-rev-parse-upstream.sh\nindex c34714ffe3..4458820168 100755\n--- a/t/t1507-rev-parse-upstream.sh\n+++ b/t/t1507-rev-parse-upstream.sh\n@@ -258,7 +258,8 @@ test_expect_success '@{reflog}-parsing does not look beyond colon' '\n \tgit add @{yesterday} &&\n \tgit commit -m \"funny reflog file\" &&\n \tgit hash-object @{yesterday} >expect &&\n-\tgit rev-parse HEAD:@{yesterday} >actual\n+\tgit rev-parse HEAD:@{yesterday} >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success '@{upstream}-parsing does not look beyond colon' '\n@@ -266,7 +267,8 @@ test_expect_success '@{upstream}-parsing does not look beyond colon' '\n \tgit add @{upstream} &&\n \tgit commit -m \"funny upstream file\" &&\n \tgit hash-object @{upstream} >expect &&\n-\tgit rev-parse HEAD:@{upstream} >actual\n+\tgit rev-parse HEAD:@{upstream} >actual &&\n+\ttest_cmp expect actual\n '\n \n test_done\n-- \n2.39.2\n\n"},{"id":"473427","messageId":"20230312201520.370234-1-rybak.a.v@gmail.com","threadId":"59381","inReplyTo":null,"subject":"[PATCH v1 0/7] t: fix unused files, part 1","fromName":"Andrei Rybak","fromEmail":"rybak.a.v@gmail.com","sentAt":"2023-03-12T20:15:12Z","receivedAt":"2023-03-12T20:16:18Z","isPatch":true,"sender":{"key":"rybak.a.v@gmail.com","avatar":"https://avatars.githubusercontent.com/u/624072?v=4"},"body":"I've noticed that several tests in t9001-send-email.sh don't use the files\ncreated from redirecting output of git commands.  So I wrote a crude script to\nfind similar issues in other tests:\n\n    from sys import argv\n    from sys import exit\n    import re\n    \n    script = argv[1]\n    \n    filename_pattern = re.compile('([-a-z_A-Z]+|&1)')\n    git_with_output_pattern = re.compile('git [^&\"]*[ 2][>](?!/)')\n    \n    while True:\n        res = git_with_output_pattern.search(script)\n        if res is None:\n            break\n        filename_index = res.span()[1]\n        res = filename_pattern.search(script[filename_index:])\n        filename = res.group()\n    \n        script = script[filename_index + len(filename):]\n    \n        if filename == '&1':\n            continue\n    \n        read_index = script.find(filename)\n        if read_index < 0:\n            print(\"File '\" + filename + \"' is unused\")\n            print(\"Script: \")\n            print(script)\n            exit(1)\n        script = script[read_index + len(filename):]\n\nIt doesn't check the tests very throughly and has a lot of false-positives, but\nthis is enough for now.  I invoke it from test_expect_success() like so:\n\n---- 8< ----\ndiff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh\nindex 999d46fafe..ac2614009d 100644\n--- a/t/test-lib-functions.sh\n+++ b/t/test-lib-functions.sh\n@@ -836,6 +836,14 @@ test_expect_success () {\n \t\tif test_run_ \"$2\"\n \t\tthen\n \t\t\ttest_ok_ \"$1\"\n+\t\t\tif ! echo \"$1\" | grep -q -E '(setup|preparation)'\n+\t\t\tthen\n+\t\t\t\tif ! python3 \"$TEST_DIRECTORY/../check_unused_files.py\" \"$2\"\n+\t\t\t\tthen\n+\t\t\t\t\tBUG \"check_unused_files.py found an unused file in test '$1'\"\n+\t\t\t\t\treturn 1\n+\t\t\t\tfi\n+\t\t\tfi\n \t\telse\n \t\t\ttest_failure_ \"$@\"\n \t\tfi\n---- >8 ----\n\nHere are the fixes for the issues I've found so far -- I've gone through t0???\nand t1???.\n\nAndrei Rybak (7):\n  t1005: assert output of ls-files\n  t1006: assert error output of cat-file\n  t1010: assert empty output of mktree\n  t1302: don't create unused file\n  t1400: assert output of update-ref\n  t1404: don't create unused file\n  t1507: assert output of rev-parse\n\n t/t1005-read-tree-reset.sh    | 15 ++++++++++-----\n t/t1006-cat-file.sh           |  3 ++-\n t/t1010-mktree.sh             |  6 ++++--\n t/t1302-repo-version.sh       |  2 +-\n t/t1400-update-ref.sh         |  3 +++\n t/t1404-update-ref-errors.sh  |  1 -\n t/t1507-rev-parse-upstream.sh |  6 ++++--\n 7 files changed, 24 insertions(+), 12 deletions(-)\n\n-- \n2.39.2\n\n"},{"id":"473428","messageId":"20230312201520.370234-4-rybak.a.v@gmail.com","threadId":"59381","inReplyTo":"20230312201520.370234-1-rybak.a.v@gmail.com","subject":"[PATCH v1 2/7] t1006: assert error output of cat-file","fromName":"Andrei Rybak","fromEmail":"rybak.a.v@gmail.com","sentAt":"2023-03-12T20:15:15Z","receivedAt":"2023-03-12T20:16:21Z","isPatch":true,"sender":{"key":"rybak.a.v@gmail.com","avatar":"https://avatars.githubusercontent.com/u/624072?v=4"},"body":"Test \"cat-file $arg1 $arg2 error on missing full OID\" in\nt1006-cat-file.sh compares files \"expect.err\" and \"err.actual\" to assert\nthe expected error output of \"git cat-file\".  A similar test in the same\nfile named \"cat-file $arg1 $arg2 error on missing short OID\" also\ncreates these two files, but doesn't use them in assertions.\n\nAssert error output of \"git cat-file\" in test \"cat-file $arg1 $arg2\nerror on missing short OID\" of t1006-cat-file.sh to improve test\ncoverage.\n\nSigned-off-by: Andrei Rybak <rybak.a.v@gmail.com>\n---\n t/t1006-cat-file.sh | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git a/t/t1006-cat-file.sh b/t/t1006-cat-file.sh\nindex 2d875b17d8..8eac74b59c 100755\n--- a/t/t1006-cat-file.sh\n+++ b/t/t1006-cat-file.sh\n@@ -603,7 +603,8 @@ do\n \t\t\tfatal: Not a valid object name $(test_oid deadbeef_short)\n \t\t\tEOF\n \t\t\ttest_must_fail git cat-file $arg1 $arg2 $(test_oid deadbeef_short) >out 2>err.actual &&\n-\t\t\ttest_must_be_empty out\n+\t\t\ttest_must_be_empty out &&\n+\t\t\ttest_cmp expect.err err.actual\n \t\t'\n \n \t\ttest_expect_success \"cat-file $arg1 $arg2 error on missing full OID\" '\n-- \n2.39.2\n\n"},{"id":"473429","messageId":"20230312201520.370234-5-rybak.a.v@gmail.com","threadId":"59381","inReplyTo":"20230312201520.370234-1-rybak.a.v@gmail.com","subject":"[PATCH v1 3/7] t1010: assert empty output of mktree","fromName":"Andrei Rybak","fromEmail":"rybak.a.v@gmail.com","sentAt":"2023-03-12T20:15:16Z","receivedAt":"2023-03-12T20:16:22Z","isPatch":true,"sender":{"key":"rybak.a.v@gmail.com","avatar":"https://avatars.githubusercontent.com/u/624072?v=4"},"body":"Builtin \"git mktree\" writes the the object name of the tree object built\nto the standard output.  Tests 'mktree refuses to read ls-tree -r output\n(1)' and 'mktree refuses to read ls-tree -r output (2)' in\n\"t1010-mktree.sh\" redirect output of \"git mktree\" to a file, but don't\nuse its contents in assertions.\n\nAssert that the output of \"git mktree\" is empty when it refuses to build\na tree object.\n\nSigned-off-by: Andrei Rybak <rybak.a.v@gmail.com>\n---\n t/t1010-mktree.sh | 6 ++++--\n 1 file changed, 4 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t1010-mktree.sh b/t/t1010-mktree.sh\nindex 3c08194526..31ea2ec0bb 100755\n--- a/t/t1010-mktree.sh\n+++ b/t/t1010-mktree.sh\n@@ -60,11 +60,13 @@ test_expect_success 'allow missing object with --missing' '\n '\n \n test_expect_success 'mktree refuses to read ls-tree -r output (1)' '\n-\ttest_must_fail git mktree <all >actual\n+\ttest_must_fail git mktree <all >actual &&\n+\ttest_must_be_empty actual\n '\n \n test_expect_success 'mktree refuses to read ls-tree -r output (2)' '\n-\ttest_must_fail git mktree <all.withsub >actual\n+\ttest_must_fail git mktree <all.withsub >actual &&\n+\ttest_must_be_empty actual\n '\n \n test_done\n-- \n2.39.2\n\n"},{"id":"473430","messageId":"20230312201520.370234-6-rybak.a.v@gmail.com","threadId":"59381","inReplyTo":"20230312201520.370234-1-rybak.a.v@gmail.com","subject":"[PATCH v1 4/7] t1302: don't create unused file","fromName":"Andrei Rybak","fromEmail":"rybak.a.v@gmail.com","sentAt":"2023-03-12T20:15:17Z","receivedAt":"2023-03-12T20:16:25Z","isPatch":true,"sender":{"key":"rybak.a.v@gmail.com","avatar":"https://avatars.githubusercontent.com/u/624072?v=4"},"body":"Test 'gitdir selection on unsupported repo' in t1302-repo-version.sh\nwrites output of a \"git config\" invocation to file \"actual\".  However,\nthe test doesn't have any assertions for the file.  The file was used by\nthis test until commit b9605bc4f2 (config: only read .git/config from\nconfigured repos, 2016-09-12), before which \"git config\" was expected to\nprint the bogus value of \"core.repositoryformatversion\" to standard\noutput.\n\nDon't redirect output of \"git config\" to file \"actual\" in test 'gitdir\nselection on unsupported repo'.\n\nSigned-off-by: Andrei Rybak <rybak.a.v@gmail.com>\n---\n t/t1302-repo-version.sh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/t/t1302-repo-version.sh b/t/t1302-repo-version.sh\nindex 70389fa2eb..179474fa65 100755\n--- a/t/t1302-repo-version.sh\n+++ b/t/t1302-repo-version.sh\n@@ -37,7 +37,7 @@ test_expect_success 'gitdir selection on normal repos' '\n \n test_expect_success 'gitdir selection on unsupported repo' '\n \t# Make sure it would stop at test2, not trash\n-\ttest_expect_code 1 git -C test2 config core.repositoryformatversion >actual\n+\ttest_expect_code 1 git -C test2 config core.repositoryformatversion\n '\n \n test_expect_success 'gitdir not required mode' '\n-- \n2.39.2\n\n"},{"id":"473431","messageId":"20230312201520.370234-7-rybak.a.v@gmail.com","threadId":"59381","inReplyTo":"20230312201520.370234-1-rybak.a.v@gmail.com","subject":"[PATCH v1 5/7] t1400: assert output of update-ref","fromName":"Andrei Rybak","fromEmail":"rybak.a.v@gmail.com","sentAt":"2023-03-12T20:15:18Z","receivedAt":"2023-03-12T20:16:27Z","isPatch":true,"sender":{"key":"rybak.a.v@gmail.com","avatar":"https://avatars.githubusercontent.com/u/624072?v=4"},"body":"In t1400-update-ref.sh test 'transaction can create and delete' creates\nfiles \"expect\" and \"actual\", but doesn't compare them.  Similarly, test\n'transaction cannot restart ongoing transaction' redirects output of\n\"git update-ref\" to file \"actual\", but doesn't check its contents with\nany assertions.\n\nAssert output of \"git update-ref\" in tests to improve test coverage in\nt1400-update-ref.sh.\n\nSigned-off-by: Andrei Rybak <rybak.a.v@gmail.com>\n---\n t/t1400-update-ref.sh | 3 +++\n 1 file changed, 3 insertions(+)\n\ndiff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh\nindex cf58cf025c..4d66cd7f4a 100755\n--- a/t/t1400-update-ref.sh\n+++ b/t/t1400-update-ref.sh\n@@ -1568,6 +1568,7 @@ test_expect_success 'transaction can create and delete' '\n \tEOF\n \tgit update-ref --stdin <stdin >actual &&\n \tprintf \"%s: ok\\n\" start commit start commit >expect &&\n+\ttest_cmp expect actual &&\n \ttest_must_fail git show-ref --verify refs/heads/create-and-delete\n '\n \n@@ -1595,6 +1596,8 @@ test_expect_success 'transaction cannot restart ongoing transaction' '\n \tcommit\n \tEOF\n \ttest_must_fail git update-ref --stdin <stdin >actual &&\n+\tprintf \"%s: ok\\n\" start >expect &&\n+\ttest_cmp expect actual &&\n \ttest_must_fail git show-ref --verify refs/heads/restart\n '\n \n-- \n2.39.2\n\n"},{"id":"473432","messageId":"20230312201520.370234-8-rybak.a.v@gmail.com","threadId":"59381","inReplyTo":"20230312201520.370234-1-rybak.a.v@gmail.com","subject":"[PATCH v1 6/7] t1404: don't create unused file","fromName":"Andrei Rybak","fromEmail":"rybak.a.v@gmail.com","sentAt":"2023-03-12T20:15:19Z","receivedAt":"2023-03-12T20:16:29Z","isPatch":true,"sender":{"key":"rybak.a.v@gmail.com","avatar":"https://avatars.githubusercontent.com/u/624072?v=4"},"body":"Some tests in file t1404-update-ref-errors.sh create file \"unchanged\" as\nthe expected side for a test_cmp assertion at the end of the test for\noutput of \"git for-each-ref\".  The filename conveys the expectation that\nthe output won't change between two invocations of \"git for-each-ref\".\n\nTest 'no bogus intermediate values during delete' also creates a file\nnamed \"unchanged\".  However, in this test the reference is being\ndeleted, i.e. it _does change_.  The file itself isn't used for any\nassertions in the test.\n\nDon't create the unused and slightly misleading file \"unchanged\".\n\nSigned-off-by: Andrei Rybak <rybak.a.v@gmail.com>\n---\n t/t1404-update-ref-errors.sh | 1 -\n 1 file changed, 1 deletion(-)\n\ndiff --git a/t/t1404-update-ref-errors.sh b/t/t1404-update-ref-errors.sh\nindex b5606d93b5..937ae0d733 100755\n--- a/t/t1404-update-ref-errors.sh\n+++ b/t/t1404-update-ref-errors.sh\n@@ -551,7 +551,6 @@ test_expect_success REFFILES 'no bogus intermediate values during delete' '\n \tgit update-ref $prefix/foo $C &&\n \tgit pack-refs --all &&\n \tgit update-ref $prefix/foo $D &&\n-\tgit for-each-ref $prefix >unchanged &&\n \t# Now try to update the reference, but hold the `packed-refs` lock\n \t# for a while to see what happens while the process is blocked:\n \t: >.git/packed-refs.lock &&\n-- \n2.39.2\n\n"},{"id":"473433","messageId":"20230312201520.370234-9-rybak.a.v@gmail.com","threadId":"59381","inReplyTo":"20230312201520.370234-1-rybak.a.v@gmail.com","subject":"[PATCH v1 7/7] t1507: assert output of rev-parse","fromName":"Andrei Rybak","fromEmail":"rybak.a.v@gmail.com","sentAt":"2023-03-12T20:15:20Z","receivedAt":"2023-03-12T20:16:30Z","isPatch":true,"sender":{"key":"rybak.a.v@gmail.com","avatar":"https://avatars.githubusercontent.com/u/624072?v=4"},"body":"Tests in t1507-rev-parse-upstream.sh compare files \"expect\" and \"actual\"\nto assert the output of \"git rev-parse\", \"git show\", and \"git log\".\nHowever, two of the tests '@{reflog}-parsing does not look beyond colon'\nand '@{upstream}-parsing does not look beyond colon' don't inspect the\ncontents of the created files.\n\nAssert output of \"git rev-parse\" in tests in t1507-rev-parse-upstream.sh\nto improve test coverage.\n\nSigned-off-by: Andrei Rybak <rybak.a.v@gmail.com>\n---\n t/t1507-rev-parse-upstream.sh | 6 ++++--\n 1 file changed, 4 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t1507-rev-parse-upstream.sh b/t/t1507-rev-parse-upstream.sh\nindex c34714ffe3..4458820168 100755\n--- a/t/t1507-rev-parse-upstream.sh\n+++ b/t/t1507-rev-parse-upstream.sh\n@@ -258,7 +258,8 @@ test_expect_success '@{reflog}-parsing does not look beyond colon' '\n \tgit add @{yesterday} &&\n \tgit commit -m \"funny reflog file\" &&\n \tgit hash-object @{yesterday} >expect &&\n-\tgit rev-parse HEAD:@{yesterday} >actual\n+\tgit rev-parse HEAD:@{yesterday} >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success '@{upstream}-parsing does not look beyond colon' '\n@@ -266,7 +267,8 @@ test_expect_success '@{upstream}-parsing does not look beyond colon' '\n \tgit add @{upstream} &&\n \tgit commit -m \"funny upstream file\" &&\n \tgit hash-object @{upstream} >expect &&\n-\tgit rev-parse HEAD:@{upstream} >actual\n+\tgit rev-parse HEAD:@{upstream} >actual &&\n+\ttest_cmp expect actual\n '\n \n test_done\n-- \n2.39.2\n\n"},{"id":"473434","messageId":"ab612514-1dbd-e5e4-204c-cc77f896ccb6@gmail.com","threadId":"59381","inReplyTo":"20230312201520.370234-3-rybak.a.v@gmail.com","subject":"Re: [PATCH v1 1/1] t1507: assert output of rev-parse","fromName":"Andrei Rybak","fromEmail":"rybak.a.v@gmail.com","sentAt":"2023-03-12T20:24:34Z","receivedAt":"2023-03-12T20:24:56Z","isPatch":true,"sender":{"key":"rybak.a.v@gmail.com","avatar":"https://avatars.githubusercontent.com/u/624072?v=4"},"body":"I've sent this patch twice by accident.  Please ignore this version.\n\nThe correct version has subject \"[PATCH v1 7/7] t1507: assert output of rev-parse\".\nhttps://lore.kernel.org/git/20230312201520.370234-9-rybak.a.v@gmail.com/\n"},{"id":"473477","messageId":"xmqqsfe8s56p.fsf@gitster.g","threadId":"59381","inReplyTo":"20230312201520.370234-5-rybak.a.v@gmail.com","subject":"Re: [PATCH v1 3/7] t1010: assert empty output of mktree","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-03-13T21:38:06Z","receivedAt":"2023-03-13T21:38:12Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Andrei Rybak <rybak.a.v@gmail.com> writes:\n\n>  test_expect_success 'mktree refuses to read ls-tree -r output (1)' '\n> -\ttest_must_fail git mktree <all >actual\n> +\ttest_must_fail git mktree <all >actual &&\n> +\ttest_must_be_empty actual\n>  '\n>  \n>  test_expect_success 'mktree refuses to read ls-tree -r output (2)' '\n> -\ttest_must_fail git mktree <all.withsub >actual\n> +\ttest_must_fail git mktree <all.withsub >actual &&\n> +\ttest_must_be_empty actual\n>  '\n\nI am ambivalent.  As long as a failing command signals its failure\nwith its non-zero exit status value, the consumer of the output\nshould not blindly use the output from such a failing command.  Is\nthere a strong reason why we want users rely on the command to be\nsilent when it fails?\n\nAn obvious alternative is to stop producing \"actual\" file, and it\nmight be a better idea; unless there is a good reason why we should\nexpect the command to be silent, that is.\n\nThanks.\n"},{"id":"473478","messageId":"xmqqo7ows4bv.fsf@gitster.g","threadId":"59381","inReplyTo":"20230312201520.370234-8-rybak.a.v@gmail.com","subject":"Re: [PATCH v1 6/7] t1404: don't create unused file","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-03-13T21:56:36Z","receivedAt":"2023-03-13T21:56:41Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Andrei Rybak <rybak.a.v@gmail.com> writes:\n\n> Some tests in file t1404-update-ref-errors.sh create file \"unchanged\" as\n> the expected side for a test_cmp assertion at the end of the test for\n> output of \"git for-each-ref\".  The filename conveys the expectation that\n> the output won't change between two invocations of \"git for-each-ref\".\n>\n> Test 'no bogus intermediate values during delete' also creates a file\n> named \"unchanged\".  However, in this test the reference is being\n> deleted, i.e. it _does change_.  The file itself isn't used for any\n> assertions in the test.\n\nI think the name \"unchanged\" is a reference to: the state recorded\nin this file is before all the interesting changes done in this\ntest.\n\nSo another for-each-ref, after the \"lock, start a process that waits\nfor and then removes the ref\" begins but while the other process is\nstill waiting, whose output is compared with \"unchanged\" may have\nbeen another way to perform this test, but we have \"it could be $D\nthat is what we want, and two plausible 'wrong' answers are $C and\nundefined\" that is sufficient.  So I agree with removing the line\nthat creates \"unchanged\".\n\nThe other test to the file added by the same commit 6a2a7736 (t1404:\ndemonstrate two problems with reference transactions, 2017-09-08)\ncreates the \"unchanged\" file in the same way, but it does get used\nafter running \"update-ref\" that is tested.  I would not be surprised\nif the one removed by this patch was created by a cut-and-paste by\nmistake.\n\nThanks.\n\n> Don't create the unused and slightly misleading file \"unchanged\".\n>\n> Signed-off-by: Andrei Rybak <rybak.a.v@gmail.com>\n> ---\n>  t/t1404-update-ref-errors.sh | 1 -\n>  1 file changed, 1 deletion(-)\n>\n> diff --git a/t/t1404-update-ref-errors.sh b/t/t1404-update-ref-errors.sh\n> index b5606d93b5..937ae0d733 100755\n> --- a/t/t1404-update-ref-errors.sh\n> +++ b/t/t1404-update-ref-errors.sh\n> @@ -551,7 +551,6 @@ test_expect_success REFFILES 'no bogus intermediate values during delete' '\n>  \tgit update-ref $prefix/foo $C &&\n>  \tgit pack-refs --all &&\n>  \tgit update-ref $prefix/foo $D &&\n> -\tgit for-each-ref $prefix >unchanged &&\n>  \t# Now try to update the reference, but hold the `packed-refs` lock\n>  \t# for a while to see what happens while the process is blocked:\n>  \t: >.git/packed-refs.lock &&\n"},{"id":"473481","messageId":"xmqq7cvks28n.fsf@gitster.g","threadId":"59381","inReplyTo":"20230312201520.370234-1-rybak.a.v@gmail.com","subject":"Re: [PATCH v1 0/7] t: fix unused files, part 1","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-03-13T22:41:44Z","receivedAt":"2023-03-13T22:41:48Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Andrei Rybak <rybak.a.v@gmail.com> writes:\n\n> Here are the fixes for the issues I've found so far -- I've gone through t0???\n> and t1???.\n\nI think it is better not to insist that a failing 'mktree' is\nsilent, and I think the filename \"unchanged\" is understandable and\nis unfair to call it \"misleading\" (but the patch itself to remove\nthe line that creates the unused file makes perfect sense).  Other\nthan these two small nits, I found everything else in the series\ngood changes.\n\nThanks for a pleasant read.\n\n>\n> Andrei Rybak (7):\n>   t1005: assert output of ls-files\n>   t1006: assert error output of cat-file\n>   t1010: assert empty output of mktree\n>   t1302: don't create unused file\n>   t1400: assert output of update-ref\n>   t1404: don't create unused file\n>   t1507: assert output of rev-parse\n>\n>  t/t1005-read-tree-reset.sh    | 15 ++++++++++-----\n>  t/t1006-cat-file.sh           |  3 ++-\n>  t/t1010-mktree.sh             |  6 ++++--\n>  t/t1302-repo-version.sh       |  2 +-\n>  t/t1400-update-ref.sh         |  3 +++\n>  t/t1404-update-ref-errors.sh  |  1 -\n>  t/t1507-rev-parse-upstream.sh |  6 ++++--\n>  7 files changed, 24 insertions(+), 12 deletions(-)\n"},{"id":"473495","messageId":"167878391659.3913.5697119728018854973.git@grubix.eu","threadId":"59381","inReplyTo":"20230312201520.370234-2-rybak.a.v@gmail.com","subject":"Re: [PATCH v1 1/7] t1005: assert output of ls-files","fromName":"Michael J Gruber","fromEmail":"git@grubix.eu","sentAt":"2023-03-14T08:51:56Z","receivedAt":"2023-03-14T09:00:54Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Andrei Rybak venit, vidit, dixit 2023-03-12 21:15:13:\n> Test 'reset should work' in t1005-read-tree-reset.sh compares two files\n> \"expect\" and \"actual\" to assert the expected output of \"git ls-files\".\n> Several other tests in the same file also create files \"expect\" and\n> \"actual\", but don't use them in assertions.\n> \n> Assert output of \"git ls-files\" in t1005-read-tree-reset.sh to improve\n> test coverage.\n> \n> Signed-off-by: Andrei Rybak <rybak.a.v@gmail.com>\n> ---\n>  t/t1005-read-tree-reset.sh | 15 ++++++++++-----\n>  1 file changed, 10 insertions(+), 5 deletions(-)\n> \n> diff --git a/t/t1005-read-tree-reset.sh b/t/t1005-read-tree-reset.sh\n> index 12e30d77d0..26be4a2b5a 100755\n> --- a/t/t1005-read-tree-reset.sh\n> +++ b/t/t1005-read-tree-reset.sh\n> @@ -41,7 +41,8 @@ test_expect_success 'reset should remove remnants from a failed merge' '\n>         git ls-files -s &&\n>         read_tree_u_must_succeed --reset -u HEAD &&\n>         git ls-files -s >actual &&\n> -       ! test -f old\n> +       ! test -f old &&\n> +       test_cmp expect actual\n>  '\n>  \n>  test_expect_success 'two-way reset should remove remnants too' '\n> @@ -56,7 +57,8 @@ test_expect_success 'two-way reset should remove remnants too' '\n>         git ls-files -s &&\n>         read_tree_u_must_succeed --reset -u HEAD HEAD &&\n>         git ls-files -s >actual &&\n> -       ! test -f old\n> +       ! test -f old &&\n> +       test_cmp expect actual\n>  '\n>  \n>  test_expect_success 'Porcelain reset should remove remnants too' '\n> @@ -71,7 +73,8 @@ test_expect_success 'Porcelain reset should remove remnants too' '\n>         git ls-files -s &&\n>         git reset --hard &&\n>         git ls-files -s >actual &&\n> -       ! test -f old\n> +       ! test -f old &&\n> +       test_cmp expect actual\n>  '\n>  \n>  test_expect_success 'Porcelain checkout -f should remove remnants too' '\n> @@ -86,7 +89,8 @@ test_expect_success 'Porcelain checkout -f should remove remnants too' '\n>         git ls-files -s &&\n>         git checkout -f &&\n>         git ls-files -s >actual &&\n> -       ! test -f old\n> +       ! test -f old &&\n> +       test_cmp expect actual\n>  '\n>  \n>  test_expect_success 'Porcelain checkout -f HEAD should remove remnants too' '\n> @@ -101,7 +105,8 @@ test_expect_success 'Porcelain checkout -f HEAD should remove remnants too' '\n>         git ls-files -s &&\n>         git checkout -f HEAD &&\n>         git ls-files -s >actual &&\n> -       ! test -f old\n> +       ! test -f old &&\n> +       test_cmp expect actual\n>  '\n>  \n>  test_done\n> -- \n> 2.39.2\n> \n\nJust in case someone else was wondering, too:\n\nAll these subtests write to `expect` just before the provided context\nlines, so there indeed is something to compare to, and it is the output\nof `git ls-files -s` before any changes and resets. As a consequence,\nthese subtests checked only removal of remnants in the woring tree\nbefore the patch, and they check removal of index bits after the patch\n(additionally).\n\nLooks fine to me - though one could probably use `git ls-files -s -o` or\nsuch instead, the suggested version is more \"explicit\".\n\nMichael\n"},{"id":"473507","messageId":"ed09dca5-0885-0ea7-7bbb-b4cc09f0eefa@gmail.com","threadId":"59381","inReplyTo":"xmqq7cvks28n.fsf@gitster.g","subject":"Re: [PATCH v1 0/7] t: fix unused files, part 1","fromName":"Andrei Rybak","fromEmail":"rybak.a.v@gmail.com","sentAt":"2023-03-14T20:43:59Z","receivedAt":"2023-03-14T20:44:24Z","isPatch":true,"sender":{"key":"rybak.a.v@gmail.com","avatar":"https://avatars.githubusercontent.com/u/624072?v=4"},"body":"On 13/03/2023 23:41, Junio C Hamano wrote:\n> \n> I think it is better not to insist that a failing 'mktree' is\n> silent, and I think the filename \"unchanged\" is understandable and\n> is unfair to call it \"misleading\" (but the patch itself to remove\n> the line that creates the unused file makes perfect sense).  Other\n> than these two small nits, I found everything else in the series\n> good changes.\n> \n> Thanks for a pleasant read.\n\nThank you for review.  I have limited bandwidth this week, but I'll\ntry to send a v2 incorporating this feedback on the weekend.\n"},{"id":"473682","messageId":"fa093fe4-e237-6f65-6ac5-7088f263b91f@gmail.com","threadId":"59381","inReplyTo":"167878391659.3913.5697119728018854973.git@grubix.eu","subject":"Re: [PATCH v1 1/7] t1005: assert output of ls-files","fromName":"Andrei Rybak","fromEmail":"rybak.a.v@gmail.com","sentAt":"2023-03-18T15:17:21Z","receivedAt":"2023-03-18T15:17:32Z","isPatch":true,"sender":{"key":"rybak.a.v@gmail.com","avatar":"https://avatars.githubusercontent.com/u/624072?v=4"},"body":"On 14/03/2023 09:51, Michael J Gruber wrote:\n> Andrei Rybak venit, vidit, dixit 2023-03-12 21:15:13:\n>>   t/t1005-read-tree-reset.sh | 15 ++++++++++-----\n>>   1 file changed, 10 insertions(+), 5 deletions(-)\n>>\n>> [...]\n> \n> Just in case someone else was wondering, too:\n> \n> All these subtests write to `expect` just before the provided context\n> lines, so there indeed is something to compare to, and it is the output\n> of `git ls-files -s` before any changes and resets. As a consequence,\n> these subtests checked only removal of remnants in the woring tree\n> before the patch, and they check removal of index bits after the patch\n> (additionally).\n> \n> Looks fine to me - though one could probably use `git ls-files -s -o` or\n> such instead, the suggested version is more \"explicit\".\n\nThank you for reviewing this.\n\nNone the tests (both in t1005 and other files) use this combination of flags\nfor `ls-files` right now.  Checked using:\n\n     $ git grep 'ls-files.*[^a-z-][-][os][^|]*[^a-z-][-][so]' || echo none\n     none\n     $ git grep -E 'ls-files .* --(stage|others)'\n     Documentation/git-ls-files.txt:'git ls-files --unmerged' and 'git ls-files --stage' can be used to examine\n     contrib/hg-to-git/hg-to-git.py:    os.system('git ls-files -x .hg --others | git update-index --add --stdin')\n     t/t1092-sparse-checkout-compatibility.sh:       git -C sparse-index ls-files --sparse --stage >cache &&\n     t/t1092-sparse-checkout-compatibility.sh:       git -C sparse-index ls-files --sparse --stage >cache &&\n     t/t1306-xdg-files.sh:    git ls-files --exclude-standard --ignored --others >actual) &&\n\nIn this topic, I plan to focus on just fixes of unused files and to leave\nflags of `git ls-files` as is for now.\n"},{"id":"473685","messageId":"20230318154646.131344-1-rybak.a.v@gmail.com","threadId":"59381","inReplyTo":"20230312201520.370234-1-rybak.a.v@gmail.com","subject":"[PATCH v2 0/7] t: fix unused files, part 1","fromName":"Andrei Rybak","fromEmail":"rybak.a.v@gmail.com","sentAt":"2023-03-18T15:46:39Z","receivedAt":"2023-03-18T15:47:04Z","isPatch":true,"sender":{"key":"rybak.a.v@gmail.com","avatar":"https://avatars.githubusercontent.com/u/624072?v=4"},"body":"Here's a v2 for various fixes of unused files in t0??? and t1???.\nOriginal cover letter is at\n  https://lore.kernel.org/git/20230312201520.370234-1-rybak.a.v@gmail.com/T/#m63071efd1e2f876fdcbd0c384130b0ec7859f885\n\nChanges since v1 address Junio's review:\n\n  - just don't redirect output of mktree in patch 3/7\n  - rewritten commit message of patch 6/7, where I'd completely misunderstood\n    the code of the tests.\n\nRange diff:\n\n1:  017f1d8173 = 1:  59a868c0b8 t1005: assert output of ls-files\n2:  7a75864e00 = 2:  a3514687ad t1006: assert error output of cat-file\n3:  e23a16e560 ! 3:  4cb07fa965 t1010: assert empty output of mktree\n    @@ Metadata\n     Author: Andrei Rybak <rybak.a.v@gmail.com>\n     \n      ## Commit message ##\n    -    t1010: assert empty output of mktree\n    +    t1010: don't create unused files\n     \n         Builtin \"git mktree\" writes the the object name of the tree object built\n         to the standard output.  Tests 'mktree refuses to read ls-tree -r output\n    @@ Commit message\n         \"t1010-mktree.sh\" redirect output of \"git mktree\" to a file, but don't\n         use its contents in assertions.\n     \n    -    Assert that the output of \"git mktree\" is empty when it refuses to build\n    -    a tree object.\n    +    Don't redirect output of \"git mktree\" to file \"actual\" in tests that\n    +    assert that an invocation of \"git mktree\" must fail.\n    +\n    +    Output of \"git mktree\" is empty when it refuses to build a tree object.\n    +    So, alternatively, the test could assert that the output is empty.\n    +    However, there isn't a good reason for the user to expect the command to\n    +    be silent in such cases, so we shouldn't enforce it.  The user shouldn't\n    +    use the output of a failing command anyway.\n     \n         Signed-off-by: Andrei Rybak <rybak.a.v@gmail.com>\n     \n    @@ t/t1010-mktree.sh: test_expect_success 'allow missing object with --missing' '\n      \n      test_expect_success 'mktree refuses to read ls-tree -r output (1)' '\n     -  test_must_fail git mktree <all >actual\n    -+  test_must_fail git mktree <all >actual &&\n    -+  test_must_be_empty actual\n    ++  test_must_fail git mktree <all\n      '\n      \n      test_expect_success 'mktree refuses to read ls-tree -r output (2)' '\n     -  test_must_fail git mktree <all.withsub >actual\n    -+  test_must_fail git mktree <all.withsub >actual &&\n    -+  test_must_be_empty actual\n    ++  test_must_fail git mktree <all.withsub\n      '\n      \n      test_done\n4:  462cfa7025 = 4:  1ed6030a4f t1302: don't create unused file\n5:  9fa04e479c = 5:  002942d81c t1400: assert output of update-ref\n6:  e79566cc32 ! 6:  2e3446fc2f t1404: don't create unused file\n    @@ Commit message\n     \n         Some tests in file t1404-update-ref-errors.sh create file \"unchanged\" as\n         the expected side for a test_cmp assertion at the end of the test for\n    -    output of \"git for-each-ref\".  The filename conveys the expectation that\n    -    the output won't change between two invocations of \"git for-each-ref\".\n    +    output of \"git for-each-ref\".  Test 'no bogus intermediate values during\n    +    delete' also creates a file named \"unchanged\" using \"git for-each-ref\".\n    +    However, the file isn't used for any assertions in the test.  Instead,\n    +    \"git rev-parse\" is used to compare the reference with variable $D.\n     \n    -    Test 'no bogus intermediate values during delete' also creates a file\n    -    named \"unchanged\".  However, in this test the reference is being\n    -    deleted, i.e. it _does change_.  The file itself isn't used for any\n    -    assertions in the test.\n    -\n    -    Don't create the unused and slightly misleading file \"unchanged\".\n    +    Don't create unused file \"unchanged\" in test 'no bogus intermediate\n    +    values during delete' of t1404-update-ref-errors.sh.\n     \n         Signed-off-by: Andrei Rybak <rybak.a.v@gmail.com>\n     \n7:  5a7df840a8 = 7:  e11a7d8e02 t1507: assert output of rev-parse\n\n\nAndrei Rybak (7):\n  t1005: assert output of ls-files\n  t1006: assert error output of cat-file\n  t1010: don't create unused files\n  t1302: don't create unused file\n  t1400: assert output of update-ref\n  t1404: don't create unused file\n  t1507: assert output of rev-parse\n\n t/t1005-read-tree-reset.sh    | 15 ++++++++++-----\n t/t1006-cat-file.sh           |  3 ++-\n t/t1010-mktree.sh             |  4 ++--\n t/t1302-repo-version.sh       |  2 +-\n t/t1400-update-ref.sh         |  3 +++\n t/t1404-update-ref-errors.sh  |  1 -\n t/t1507-rev-parse-upstream.sh |  6 ++++--\n 7 files changed, 22 insertions(+), 12 deletions(-)\n\n-- \n2.40.0\n\n"},{"id":"473686","messageId":"20230318154646.131344-2-rybak.a.v@gmail.com","threadId":"59381","inReplyTo":"20230312201520.370234-1-rybak.a.v@gmail.com","subject":"[PATCH v2 1/7] t1005: assert output of ls-files","fromName":"Andrei Rybak","fromEmail":"rybak.a.v@gmail.com","sentAt":"2023-03-18T15:46:40Z","receivedAt":"2023-03-18T15:47:05Z","isPatch":true,"sender":{"key":"rybak.a.v@gmail.com","avatar":"https://avatars.githubusercontent.com/u/624072?v=4"},"body":"Test 'reset should work' in t1005-read-tree-reset.sh compares two files\n\"expect\" and \"actual\" to assert the expected output of \"git ls-files\".\nSeveral other tests in the same file also create files \"expect\" and\n\"actual\", but don't use them in assertions.\n\nAssert output of \"git ls-files\" in t1005-read-tree-reset.sh to improve\ntest coverage.\n\nSigned-off-by: Andrei Rybak <rybak.a.v@gmail.com>\n---\n t/t1005-read-tree-reset.sh | 15 ++++++++++-----\n 1 file changed, 10 insertions(+), 5 deletions(-)\n\ndiff --git a/t/t1005-read-tree-reset.sh b/t/t1005-read-tree-reset.sh\nindex 12e30d77d0..26be4a2b5a 100755\n--- a/t/t1005-read-tree-reset.sh\n+++ b/t/t1005-read-tree-reset.sh\n@@ -41,7 +41,8 @@ test_expect_success 'reset should remove remnants from a failed merge' '\n \tgit ls-files -s &&\n \tread_tree_u_must_succeed --reset -u HEAD &&\n \tgit ls-files -s >actual &&\n-\t! test -f old\n+\t! test -f old &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success 'two-way reset should remove remnants too' '\n@@ -56,7 +57,8 @@ test_expect_success 'two-way reset should remove remnants too' '\n \tgit ls-files -s &&\n \tread_tree_u_must_succeed --reset -u HEAD HEAD &&\n \tgit ls-files -s >actual &&\n-\t! test -f old\n+\t! test -f old &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success 'Porcelain reset should remove remnants too' '\n@@ -71,7 +73,8 @@ test_expect_success 'Porcelain reset should remove remnants too' '\n \tgit ls-files -s &&\n \tgit reset --hard &&\n \tgit ls-files -s >actual &&\n-\t! test -f old\n+\t! test -f old &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success 'Porcelain checkout -f should remove remnants too' '\n@@ -86,7 +89,8 @@ test_expect_success 'Porcelain checkout -f should remove remnants too' '\n \tgit ls-files -s &&\n \tgit checkout -f &&\n \tgit ls-files -s >actual &&\n-\t! test -f old\n+\t! test -f old &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success 'Porcelain checkout -f HEAD should remove remnants too' '\n@@ -101,7 +105,8 @@ test_expect_success 'Porcelain checkout -f HEAD should remove remnants too' '\n \tgit ls-files -s &&\n \tgit checkout -f HEAD &&\n \tgit ls-files -s >actual &&\n-\t! test -f old\n+\t! test -f old &&\n+\ttest_cmp expect actual\n '\n \n test_done\n-- \n2.40.0\n\n"},{"id":"473687","messageId":"20230318154646.131344-3-rybak.a.v@gmail.com","threadId":"59381","inReplyTo":"20230312201520.370234-1-rybak.a.v@gmail.com","subject":"[PATCH v2 2/7] t1006: assert error output of cat-file","fromName":"Andrei Rybak","fromEmail":"rybak.a.v@gmail.com","sentAt":"2023-03-18T15:46:41Z","receivedAt":"2023-03-18T15:47:07Z","isPatch":true,"sender":{"key":"rybak.a.v@gmail.com","avatar":"https://avatars.githubusercontent.com/u/624072?v=4"},"body":"Test \"cat-file $arg1 $arg2 error on missing full OID\" in\nt1006-cat-file.sh compares files \"expect.err\" and \"err.actual\" to assert\nthe expected error output of \"git cat-file\".  A similar test in the same\nfile named \"cat-file $arg1 $arg2 error on missing short OID\" also\ncreates these two files, but doesn't use them in assertions.\n\nAssert error output of \"git cat-file\" in test \"cat-file $arg1 $arg2\nerror on missing short OID\" of t1006-cat-file.sh to improve test\ncoverage.\n\nSigned-off-by: Andrei Rybak <rybak.a.v@gmail.com>\n---\n t/t1006-cat-file.sh | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git a/t/t1006-cat-file.sh b/t/t1006-cat-file.sh\nindex 2d875b17d8..8eac74b59c 100755\n--- a/t/t1006-cat-file.sh\n+++ b/t/t1006-cat-file.sh\n@@ -603,7 +603,8 @@ do\n \t\t\tfatal: Not a valid object name $(test_oid deadbeef_short)\n \t\t\tEOF\n \t\t\ttest_must_fail git cat-file $arg1 $arg2 $(test_oid deadbeef_short) >out 2>err.actual &&\n-\t\t\ttest_must_be_empty out\n+\t\t\ttest_must_be_empty out &&\n+\t\t\ttest_cmp expect.err err.actual\n \t\t'\n \n \t\ttest_expect_success \"cat-file $arg1 $arg2 error on missing full OID\" '\n-- \n2.40.0\n\n"},{"id":"473688","messageId":"20230318154646.131344-4-rybak.a.v@gmail.com","threadId":"59381","inReplyTo":"20230312201520.370234-1-rybak.a.v@gmail.com","subject":"[PATCH v2 3/7] t1010: don't create unused files","fromName":"Andrei Rybak","fromEmail":"rybak.a.v@gmail.com","sentAt":"2023-03-18T15:46:42Z","receivedAt":"2023-03-18T15:47:09Z","isPatch":true,"sender":{"key":"rybak.a.v@gmail.com","avatar":"https://avatars.githubusercontent.com/u/624072?v=4"},"body":"Builtin \"git mktree\" writes the the object name of the tree object built\nto the standard output.  Tests 'mktree refuses to read ls-tree -r output\n(1)' and 'mktree refuses to read ls-tree -r output (2)' in\n\"t1010-mktree.sh\" redirect output of \"git mktree\" to a file, but don't\nuse its contents in assertions.\n\nDon't redirect output of \"git mktree\" to file \"actual\" in tests that\nassert that an invocation of \"git mktree\" must fail.\n\nOutput of \"git mktree\" is empty when it refuses to build a tree object.\nSo, alternatively, the test could assert that the output is empty.\nHowever, there isn't a good reason for the user to expect the command to\nbe silent in such cases, so we shouldn't enforce it.  The user shouldn't\nuse the output of a failing command anyway.\n\nSigned-off-by: Andrei Rybak <rybak.a.v@gmail.com>\n---\n t/t1010-mktree.sh | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t1010-mktree.sh b/t/t1010-mktree.sh\nindex 3c08194526..22875ba598 100755\n--- a/t/t1010-mktree.sh\n+++ b/t/t1010-mktree.sh\n@@ -60,11 +60,11 @@ test_expect_success 'allow missing object with --missing' '\n '\n \n test_expect_success 'mktree refuses to read ls-tree -r output (1)' '\n-\ttest_must_fail git mktree <all >actual\n+\ttest_must_fail git mktree <all\n '\n \n test_expect_success 'mktree refuses to read ls-tree -r output (2)' '\n-\ttest_must_fail git mktree <all.withsub >actual\n+\ttest_must_fail git mktree <all.withsub\n '\n \n test_done\n-- \n2.40.0\n\n"},{"id":"473689","messageId":"20230318154646.131344-5-rybak.a.v@gmail.com","threadId":"59381","inReplyTo":"20230312201520.370234-1-rybak.a.v@gmail.com","subject":"[PATCH v2 4/7] t1302: don't create unused file","fromName":"Andrei Rybak","fromEmail":"rybak.a.v@gmail.com","sentAt":"2023-03-18T15:46:43Z","receivedAt":"2023-03-18T15:47:10Z","isPatch":true,"sender":{"key":"rybak.a.v@gmail.com","avatar":"https://avatars.githubusercontent.com/u/624072?v=4"},"body":"Test 'gitdir selection on unsupported repo' in t1302-repo-version.sh\nwrites output of a \"git config\" invocation to file \"actual\".  However,\nthe test doesn't have any assertions for the file.  The file was used by\nthis test until commit b9605bc4f2 (config: only read .git/config from\nconfigured repos, 2016-09-12), before which \"git config\" was expected to\nprint the bogus value of \"core.repositoryformatversion\" to standard\noutput.\n\nDon't redirect output of \"git config\" to file \"actual\" in test 'gitdir\nselection on unsupported repo'.\n\nSigned-off-by: Andrei Rybak <rybak.a.v@gmail.com>\n---\n t/t1302-repo-version.sh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/t/t1302-repo-version.sh b/t/t1302-repo-version.sh\nindex 70389fa2eb..179474fa65 100755\n--- a/t/t1302-repo-version.sh\n+++ b/t/t1302-repo-version.sh\n@@ -37,7 +37,7 @@ test_expect_success 'gitdir selection on normal repos' '\n \n test_expect_success 'gitdir selection on unsupported repo' '\n \t# Make sure it would stop at test2, not trash\n-\ttest_expect_code 1 git -C test2 config core.repositoryformatversion >actual\n+\ttest_expect_code 1 git -C test2 config core.repositoryformatversion\n '\n \n test_expect_success 'gitdir not required mode' '\n-- \n2.40.0\n\n"},{"id":"473690","messageId":"20230318154646.131344-6-rybak.a.v@gmail.com","threadId":"59381","inReplyTo":"20230312201520.370234-1-rybak.a.v@gmail.com","subject":"[PATCH v2 5/7] t1400: assert output of update-ref","fromName":"Andrei Rybak","fromEmail":"rybak.a.v@gmail.com","sentAt":"2023-03-18T15:46:44Z","receivedAt":"2023-03-18T15:47:11Z","isPatch":true,"sender":{"key":"rybak.a.v@gmail.com","avatar":"https://avatars.githubusercontent.com/u/624072?v=4"},"body":"In t1400-update-ref.sh test 'transaction can create and delete' creates\nfiles \"expect\" and \"actual\", but doesn't compare them.  Similarly, test\n'transaction cannot restart ongoing transaction' redirects output of\n\"git update-ref\" to file \"actual\", but doesn't check its contents with\nany assertions.\n\nAssert output of \"git update-ref\" in tests to improve test coverage in\nt1400-update-ref.sh.\n\nSigned-off-by: Andrei Rybak <rybak.a.v@gmail.com>\n---\n t/t1400-update-ref.sh | 3 +++\n 1 file changed, 3 insertions(+)\n\ndiff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh\nindex cf58cf025c..4d66cd7f4a 100755\n--- a/t/t1400-update-ref.sh\n+++ b/t/t1400-update-ref.sh\n@@ -1568,6 +1568,7 @@ test_expect_success 'transaction can create and delete' '\n \tEOF\n \tgit update-ref --stdin <stdin >actual &&\n \tprintf \"%s: ok\\n\" start commit start commit >expect &&\n+\ttest_cmp expect actual &&\n \ttest_must_fail git show-ref --verify refs/heads/create-and-delete\n '\n \n@@ -1595,6 +1596,8 @@ test_expect_success 'transaction cannot restart ongoing transaction' '\n \tcommit\n \tEOF\n \ttest_must_fail git update-ref --stdin <stdin >actual &&\n+\tprintf \"%s: ok\\n\" start >expect &&\n+\ttest_cmp expect actual &&\n \ttest_must_fail git show-ref --verify refs/heads/restart\n '\n \n-- \n2.40.0\n\n"},{"id":"473691","messageId":"20230318154646.131344-8-rybak.a.v@gmail.com","threadId":"59381","inReplyTo":"20230312201520.370234-1-rybak.a.v@gmail.com","subject":"[PATCH v2 7/7] t1507: assert output of rev-parse","fromName":"Andrei Rybak","fromEmail":"rybak.a.v@gmail.com","sentAt":"2023-03-18T15:46:46Z","receivedAt":"2023-03-18T15:47:13Z","isPatch":true,"sender":{"key":"rybak.a.v@gmail.com","avatar":"https://avatars.githubusercontent.com/u/624072?v=4"},"body":"Tests in t1507-rev-parse-upstream.sh compare files \"expect\" and \"actual\"\nto assert the output of \"git rev-parse\", \"git show\", and \"git log\".\nHowever, two of the tests '@{reflog}-parsing does not look beyond colon'\nand '@{upstream}-parsing does not look beyond colon' don't inspect the\ncontents of the created files.\n\nAssert output of \"git rev-parse\" in tests in t1507-rev-parse-upstream.sh\nto improve test coverage.\n\nSigned-off-by: Andrei Rybak <rybak.a.v@gmail.com>\n---\n t/t1507-rev-parse-upstream.sh | 6 ++++--\n 1 file changed, 4 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t1507-rev-parse-upstream.sh b/t/t1507-rev-parse-upstream.sh\nindex c34714ffe3..4458820168 100755\n--- a/t/t1507-rev-parse-upstream.sh\n+++ b/t/t1507-rev-parse-upstream.sh\n@@ -258,7 +258,8 @@ test_expect_success '@{reflog}-parsing does not look beyond colon' '\n \tgit add @{yesterday} &&\n \tgit commit -m \"funny reflog file\" &&\n \tgit hash-object @{yesterday} >expect &&\n-\tgit rev-parse HEAD:@{yesterday} >actual\n+\tgit rev-parse HEAD:@{yesterday} >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success '@{upstream}-parsing does not look beyond colon' '\n@@ -266,7 +267,8 @@ test_expect_success '@{upstream}-parsing does not look beyond colon' '\n \tgit add @{upstream} &&\n \tgit commit -m \"funny upstream file\" &&\n \tgit hash-object @{upstream} >expect &&\n-\tgit rev-parse HEAD:@{upstream} >actual\n+\tgit rev-parse HEAD:@{upstream} >actual &&\n+\ttest_cmp expect actual\n '\n \n test_done\n-- \n2.40.0\n\n"},{"id":"473692","messageId":"20230318154646.131344-7-rybak.a.v@gmail.com","threadId":"59381","inReplyTo":"20230312201520.370234-1-rybak.a.v@gmail.com","subject":"[PATCH v2 6/7] t1404: don't create unused file","fromName":"Andrei Rybak","fromEmail":"rybak.a.v@gmail.com","sentAt":"2023-03-18T15:46:45Z","receivedAt":"2023-03-18T15:47:14Z","isPatch":true,"sender":{"key":"rybak.a.v@gmail.com","avatar":"https://avatars.githubusercontent.com/u/624072?v=4"},"body":"Some tests in file t1404-update-ref-errors.sh create file \"unchanged\" as\nthe expected side for a test_cmp assertion at the end of the test for\noutput of \"git for-each-ref\".  Test 'no bogus intermediate values during\ndelete' also creates a file named \"unchanged\" using \"git for-each-ref\".\nHowever, the file isn't used for any assertions in the test.  Instead,\n\"git rev-parse\" is used to compare the reference with variable $D.\n\nDon't create unused file \"unchanged\" in test 'no bogus intermediate\nvalues during delete' of t1404-update-ref-errors.sh.\n\nSigned-off-by: Andrei Rybak <rybak.a.v@gmail.com>\n---\n t/t1404-update-ref-errors.sh | 1 -\n 1 file changed, 1 deletion(-)\n\ndiff --git a/t/t1404-update-ref-errors.sh b/t/t1404-update-ref-errors.sh\nindex b5606d93b5..937ae0d733 100755\n--- a/t/t1404-update-ref-errors.sh\n+++ b/t/t1404-update-ref-errors.sh\n@@ -551,7 +551,6 @@ test_expect_success REFFILES 'no bogus intermediate values during delete' '\n \tgit update-ref $prefix/foo $C &&\n \tgit pack-refs --all &&\n \tgit update-ref $prefix/foo $D &&\n-\tgit for-each-ref $prefix >unchanged &&\n \t# Now try to update the reference, but hold the `packed-refs` lock\n \t# for a while to see what happens while the process is blocked:\n \t: >.git/packed-refs.lock &&\n-- \n2.40.0\n\n"},{"id":"474123","messageId":"20230324205434.93754-1-rybak.a.v@gmail.com","threadId":"59381","inReplyTo":"20230312201520.370234-1-rybak.a.v@gmail.com","subject":"[PATCH v3 0/7] t: fix unused files, part 1","fromName":"Andrei Rybak","fromEmail":"rybak.a.v@gmail.com","sentAt":"2023-03-24T20:54:27Z","receivedAt":"2023-03-24T20:54:44Z","isPatch":true,"sender":{"key":"rybak.a.v@gmail.com","avatar":"https://avatars.githubusercontent.com/u/624072?v=4"},"body":"I messed up when sending v2 (incorrectly used format-patch with --in-reply-to),\nand v2 didn't get any response.  So here's v3 which is just a resend of v2.\n\nOriginal cover letter is at\n  https://lore.kernel.org/git/20230312201520.370234-1-rybak.a.v@gmail.com/T/#m63071efd1e2f876fdcbd0c384130b0ec7859f885\n\nChanges since v1 address Junio's review:\n\n  - just don't redirect output of mktree in patch 3/7\n    Cf. https://lore.kernel.org/git/20230312201520.370234-1-rybak.a.v@gmail.com/T/#m0c7b88dcf0af59f65262c00f30dee353170c3b2e\n  - rewritten commit message of patch 6/7, where I'd completely misunderstood\n    the code of the tests.\n    Cf. https://lore.kernel.org/git/20230312201520.370234-1-rybak.a.v@gmail.com/T/#m65f0666a8e94a1d44434dab58ee7002491b13df0\n\nRange diff:\n\n1:  017f1d8173 = 1:  59a868c0b8 t1005: assert output of ls-files\n2:  7a75864e00 = 2:  a3514687ad t1006: assert error output of cat-file\n3:  e23a16e560 ! 3:  4cb07fa965 t1010: assert empty output of mktree\n    @@ Metadata\n     Author: Andrei Rybak <rybak.a.v@gmail.com>\n\n      ## Commit message ##\n    -    t1010: assert empty output of mktree\n    +    t1010: don't create unused files\n\n         Builtin \"git mktree\" writes the the object name of the tree object built\n         to the standard output.  Tests 'mktree refuses to read ls-tree -r output\n    @@ Commit message\n         \"t1010-mktree.sh\" redirect output of \"git mktree\" to a file, but don't\n         use its contents in assertions.\n\n    -    Assert that the output of \"git mktree\" is empty when it refuses to build\n    -    a tree object.\n    +    Don't redirect output of \"git mktree\" to file \"actual\" in tests that\n    +    assert that an invocation of \"git mktree\" must fail.\n    +\n    +    Output of \"git mktree\" is empty when it refuses to build a tree object.\n    +    So, alternatively, the test could assert that the output is empty.\n    +    However, there isn't a good reason for the user to expect the command to\n    +    be silent in such cases, so we shouldn't enforce it.  The user shouldn't\n    +    use the output of a failing command anyway.\n\n         Signed-off-by: Andrei Rybak <rybak.a.v@gmail.com>\n\n    @@ t/t1010-mktree.sh: test_expect_success 'allow missing object with --missing' '\n\n      test_expect_success 'mktree refuses to read ls-tree -r output (1)' '\n     -  test_must_fail git mktree <all >actual\n    -+  test_must_fail git mktree <all >actual &&\n    -+  test_must_be_empty actual\n    ++  test_must_fail git mktree <all\n      '\n\n      test_expect_success 'mktree refuses to read ls-tree -r output (2)' '\n     -  test_must_fail git mktree <all.withsub >actual\n    -+  test_must_fail git mktree <all.withsub >actual &&\n    -+  test_must_be_empty actual\n    ++  test_must_fail git mktree <all.withsub\n      '\n\n      test_done\n4:  462cfa7025 = 4:  1ed6030a4f t1302: don't create unused file\n5:  9fa04e479c = 5:  002942d81c t1400: assert output of update-ref\n6:  e79566cc32 ! 6:  2e3446fc2f t1404: don't create unused file\n    @@ Commit message\n\n         Some tests in file t1404-update-ref-errors.sh create file \"unchanged\" as\n         the expected side for a test_cmp assertion at the end of the test for\n    -    output of \"git for-each-ref\".  The filename conveys the expectation that\n    -    the output won't change between two invocations of \"git for-each-ref\".\n    +    output of \"git for-each-ref\".  Test 'no bogus intermediate values during\n    +    delete' also creates a file named \"unchanged\" using \"git for-each-ref\".\n    +    However, the file isn't used for any assertions in the test.  Instead,\n    +    \"git rev-parse\" is used to compare the reference with variable $D.\n\n    -    Test 'no bogus intermediate values during delete' also creates a file\n    -    named \"unchanged\".  However, in this test the reference is being\n    -    deleted, i.e. it _does change_.  The file itself isn't used for any\n    -    assertions in the test.\n    -\n    -    Don't create the unused and slightly misleading file \"unchanged\".\n    +    Don't create unused file \"unchanged\" in test 'no bogus intermediate\n    +    values during delete' of t1404-update-ref-errors.sh.\n\n         Signed-off-by: Andrei Rybak <rybak.a.v@gmail.com>\n\n7:  5a7df840a8 = 7:  e11a7d8e02 t1507: assert output of rev-parse\n\nAndrei Rybak (7):\n  t1005: assert output of ls-files\n  t1006: assert error output of cat-file\n  t1010: don't create unused files\n  t1302: don't create unused file\n  t1400: assert output of update-ref\n  t1404: don't create unused file\n  t1507: assert output of rev-parse\n\n t/t1005-read-tree-reset.sh    | 15 ++++++++++-----\n t/t1006-cat-file.sh           |  3 ++-\n t/t1010-mktree.sh             |  4 ++--\n t/t1302-repo-version.sh       |  2 +-\n t/t1400-update-ref.sh         |  3 +++\n t/t1404-update-ref-errors.sh  |  1 -\n t/t1507-rev-parse-upstream.sh |  6 ++++--\n 7 files changed, 22 insertions(+), 12 deletions(-)\n\n-- \n2.40.0\n\n"},{"id":"474124","messageId":"20230324205434.93754-2-rybak.a.v@gmail.com","threadId":"59381","inReplyTo":"20230324205434.93754-1-rybak.a.v@gmail.com","subject":"[PATCH v3 1/7] t1005: assert output of ls-files","fromName":"Andrei Rybak","fromEmail":"rybak.a.v@gmail.com","sentAt":"2023-03-24T20:54:28Z","receivedAt":"2023-03-24T20:54:47Z","isPatch":true,"sender":{"key":"rybak.a.v@gmail.com","avatar":"https://avatars.githubusercontent.com/u/624072?v=4"},"body":"Test 'reset should work' in t1005-read-tree-reset.sh compares two files\n\"expect\" and \"actual\" to assert the expected output of \"git ls-files\".\nSeveral other tests in the same file also create files \"expect\" and\n\"actual\", but don't use them in assertions.\n\nAssert output of \"git ls-files\" in t1005-read-tree-reset.sh to improve\ntest coverage.\n\nSigned-off-by: Andrei Rybak <rybak.a.v@gmail.com>\n---\n t/t1005-read-tree-reset.sh | 15 ++++++++++-----\n 1 file changed, 10 insertions(+), 5 deletions(-)\n\ndiff --git a/t/t1005-read-tree-reset.sh b/t/t1005-read-tree-reset.sh\nindex 12e30d77d0..26be4a2b5a 100755\n--- a/t/t1005-read-tree-reset.sh\n+++ b/t/t1005-read-tree-reset.sh\n@@ -41,7 +41,8 @@ test_expect_success 'reset should remove remnants from a failed merge' '\n \tgit ls-files -s &&\n \tread_tree_u_must_succeed --reset -u HEAD &&\n \tgit ls-files -s >actual &&\n-\t! test -f old\n+\t! test -f old &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success 'two-way reset should remove remnants too' '\n@@ -56,7 +57,8 @@ test_expect_success 'two-way reset should remove remnants too' '\n \tgit ls-files -s &&\n \tread_tree_u_must_succeed --reset -u HEAD HEAD &&\n \tgit ls-files -s >actual &&\n-\t! test -f old\n+\t! test -f old &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success 'Porcelain reset should remove remnants too' '\n@@ -71,7 +73,8 @@ test_expect_success 'Porcelain reset should remove remnants too' '\n \tgit ls-files -s &&\n \tgit reset --hard &&\n \tgit ls-files -s >actual &&\n-\t! test -f old\n+\t! test -f old &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success 'Porcelain checkout -f should remove remnants too' '\n@@ -86,7 +89,8 @@ test_expect_success 'Porcelain checkout -f should remove remnants too' '\n \tgit ls-files -s &&\n \tgit checkout -f &&\n \tgit ls-files -s >actual &&\n-\t! test -f old\n+\t! test -f old &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success 'Porcelain checkout -f HEAD should remove remnants too' '\n@@ -101,7 +105,8 @@ test_expect_success 'Porcelain checkout -f HEAD should remove remnants too' '\n \tgit ls-files -s &&\n \tgit checkout -f HEAD &&\n \tgit ls-files -s >actual &&\n-\t! test -f old\n+\t! test -f old &&\n+\ttest_cmp expect actual\n '\n \n test_done\n-- \n2.40.0\n\n"},{"id":"474125","messageId":"20230324205434.93754-3-rybak.a.v@gmail.com","threadId":"59381","inReplyTo":"20230324205434.93754-1-rybak.a.v@gmail.com","subject":"[PATCH v3 2/7] t1006: assert error output of cat-file","fromName":"Andrei Rybak","fromEmail":"rybak.a.v@gmail.com","sentAt":"2023-03-24T20:54:29Z","receivedAt":"2023-03-24T20:54:48Z","isPatch":true,"sender":{"key":"rybak.a.v@gmail.com","avatar":"https://avatars.githubusercontent.com/u/624072?v=4"},"body":"Test \"cat-file $arg1 $arg2 error on missing full OID\" in\nt1006-cat-file.sh compares files \"expect.err\" and \"err.actual\" to assert\nthe expected error output of \"git cat-file\".  A similar test in the same\nfile named \"cat-file $arg1 $arg2 error on missing short OID\" also\ncreates these two files, but doesn't use them in assertions.\n\nAssert error output of \"git cat-file\" in test \"cat-file $arg1 $arg2\nerror on missing short OID\" of t1006-cat-file.sh to improve test\ncoverage.\n\nSigned-off-by: Andrei Rybak <rybak.a.v@gmail.com>\n---\n t/t1006-cat-file.sh | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git a/t/t1006-cat-file.sh b/t/t1006-cat-file.sh\nindex 2d875b17d8..8eac74b59c 100755\n--- a/t/t1006-cat-file.sh\n+++ b/t/t1006-cat-file.sh\n@@ -603,7 +603,8 @@ do\n \t\t\tfatal: Not a valid object name $(test_oid deadbeef_short)\n \t\t\tEOF\n \t\t\ttest_must_fail git cat-file $arg1 $arg2 $(test_oid deadbeef_short) >out 2>err.actual &&\n-\t\t\ttest_must_be_empty out\n+\t\t\ttest_must_be_empty out &&\n+\t\t\ttest_cmp expect.err err.actual\n \t\t'\n \n \t\ttest_expect_success \"cat-file $arg1 $arg2 error on missing full OID\" '\n-- \n2.40.0\n\n"},{"id":"474126","messageId":"20230324205434.93754-4-rybak.a.v@gmail.com","threadId":"59381","inReplyTo":"20230324205434.93754-1-rybak.a.v@gmail.com","subject":"[PATCH v3 3/7] t1010: don't create unused files","fromName":"Andrei Rybak","fromEmail":"rybak.a.v@gmail.com","sentAt":"2023-03-24T20:54:30Z","receivedAt":"2023-03-24T20:54:50Z","isPatch":true,"sender":{"key":"rybak.a.v@gmail.com","avatar":"https://avatars.githubusercontent.com/u/624072?v=4"},"body":"Builtin \"git mktree\" writes the the object name of the tree object built\nto the standard output.  Tests 'mktree refuses to read ls-tree -r output\n(1)' and 'mktree refuses to read ls-tree -r output (2)' in\n\"t1010-mktree.sh\" redirect output of \"git mktree\" to a file, but don't\nuse its contents in assertions.\n\nDon't redirect output of \"git mktree\" to file \"actual\" in tests that\nassert that an invocation of \"git mktree\" must fail.\n\nOutput of \"git mktree\" is empty when it refuses to build a tree object.\nSo, alternatively, the test could assert that the output is empty.\nHowever, there isn't a good reason for the user to expect the command to\nbe silent in such cases, so we shouldn't enforce it.  The user shouldn't\nuse the output of a failing command anyway.\n\nSigned-off-by: Andrei Rybak <rybak.a.v@gmail.com>\n---\n t/t1010-mktree.sh | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t1010-mktree.sh b/t/t1010-mktree.sh\nindex 3c08194526..22875ba598 100755\n--- a/t/t1010-mktree.sh\n+++ b/t/t1010-mktree.sh\n@@ -60,11 +60,11 @@ test_expect_success 'allow missing object with --missing' '\n '\n \n test_expect_success 'mktree refuses to read ls-tree -r output (1)' '\n-\ttest_must_fail git mktree <all >actual\n+\ttest_must_fail git mktree <all\n '\n \n test_expect_success 'mktree refuses to read ls-tree -r output (2)' '\n-\ttest_must_fail git mktree <all.withsub >actual\n+\ttest_must_fail git mktree <all.withsub\n '\n \n test_done\n-- \n2.40.0\n\n"},{"id":"474127","messageId":"20230324205434.93754-6-rybak.a.v@gmail.com","threadId":"59381","inReplyTo":"20230324205434.93754-1-rybak.a.v@gmail.com","subject":"[PATCH v3 5/7] t1400: assert output of update-ref","fromName":"Andrei Rybak","fromEmail":"rybak.a.v@gmail.com","sentAt":"2023-03-24T20:54:32Z","receivedAt":"2023-03-24T20:54:56Z","isPatch":true,"sender":{"key":"rybak.a.v@gmail.com","avatar":"https://avatars.githubusercontent.com/u/624072?v=4"},"body":"In t1400-update-ref.sh test 'transaction can create and delete' creates\nfiles \"expect\" and \"actual\", but doesn't compare them.  Similarly, test\n'transaction cannot restart ongoing transaction' redirects output of\n\"git update-ref\" to file \"actual\", but doesn't check its contents with\nany assertions.\n\nAssert output of \"git update-ref\" in tests to improve test coverage in\nt1400-update-ref.sh.\n\nSigned-off-by: Andrei Rybak <rybak.a.v@gmail.com>\n---\n t/t1400-update-ref.sh | 3 +++\n 1 file changed, 3 insertions(+)\n\ndiff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh\nindex cf58cf025c..4d66cd7f4a 100755\n--- a/t/t1400-update-ref.sh\n+++ b/t/t1400-update-ref.sh\n@@ -1568,6 +1568,7 @@ test_expect_success 'transaction can create and delete' '\n \tEOF\n \tgit update-ref --stdin <stdin >actual &&\n \tprintf \"%s: ok\\n\" start commit start commit >expect &&\n+\ttest_cmp expect actual &&\n \ttest_must_fail git show-ref --verify refs/heads/create-and-delete\n '\n \n@@ -1595,6 +1596,8 @@ test_expect_success 'transaction cannot restart ongoing transaction' '\n \tcommit\n \tEOF\n \ttest_must_fail git update-ref --stdin <stdin >actual &&\n+\tprintf \"%s: ok\\n\" start >expect &&\n+\ttest_cmp expect actual &&\n \ttest_must_fail git show-ref --verify refs/heads/restart\n '\n \n-- \n2.40.0\n\n"},{"id":"474128","messageId":"20230324205434.93754-5-rybak.a.v@gmail.com","threadId":"59381","inReplyTo":"20230324205434.93754-1-rybak.a.v@gmail.com","subject":"[PATCH v3 4/7] t1302: don't create unused file","fromName":"Andrei Rybak","fromEmail":"rybak.a.v@gmail.com","sentAt":"2023-03-24T20:54:31Z","receivedAt":"2023-03-24T20:54:56Z","isPatch":true,"sender":{"key":"rybak.a.v@gmail.com","avatar":"https://avatars.githubusercontent.com/u/624072?v=4"},"body":"Test 'gitdir selection on unsupported repo' in t1302-repo-version.sh\nwrites output of a \"git config\" invocation to file \"actual\".  However,\nthe test doesn't have any assertions for the file.  The file was used by\nthis test until commit b9605bc4f2 (config: only read .git/config from\nconfigured repos, 2016-09-12), before which \"git config\" was expected to\nprint the bogus value of \"core.repositoryformatversion\" to standard\noutput.\n\nDon't redirect output of \"git config\" to file \"actual\" in test 'gitdir\nselection on unsupported repo'.\n\nSigned-off-by: Andrei Rybak <rybak.a.v@gmail.com>\n---\n t/t1302-repo-version.sh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/t/t1302-repo-version.sh b/t/t1302-repo-version.sh\nindex 70389fa2eb..179474fa65 100755\n--- a/t/t1302-repo-version.sh\n+++ b/t/t1302-repo-version.sh\n@@ -37,7 +37,7 @@ test_expect_success 'gitdir selection on normal repos' '\n \n test_expect_success 'gitdir selection on unsupported repo' '\n \t# Make sure it would stop at test2, not trash\n-\ttest_expect_code 1 git -C test2 config core.repositoryformatversion >actual\n+\ttest_expect_code 1 git -C test2 config core.repositoryformatversion\n '\n \n test_expect_success 'gitdir not required mode' '\n-- \n2.40.0\n\n"},{"id":"474129","messageId":"20230324205434.93754-7-rybak.a.v@gmail.com","threadId":"59381","inReplyTo":"20230324205434.93754-1-rybak.a.v@gmail.com","subject":"[PATCH v3 6/7] t1404: don't create unused file","fromName":"Andrei Rybak","fromEmail":"rybak.a.v@gmail.com","sentAt":"2023-03-24T20:54:33Z","receivedAt":"2023-03-24T20:54:56Z","isPatch":true,"sender":{"key":"rybak.a.v@gmail.com","avatar":"https://avatars.githubusercontent.com/u/624072?v=4"},"body":"Some tests in file t1404-update-ref-errors.sh create file \"unchanged\" as\nthe expected side for a test_cmp assertion at the end of the test for\noutput of \"git for-each-ref\".  Test 'no bogus intermediate values during\ndelete' also creates a file named \"unchanged\" using \"git for-each-ref\".\nHowever, the file isn't used for any assertions in the test.  Instead,\n\"git rev-parse\" is used to compare the reference with variable $D.\n\nDon't create unused file \"unchanged\" in test 'no bogus intermediate\nvalues during delete' of t1404-update-ref-errors.sh.\n\nSigned-off-by: Andrei Rybak <rybak.a.v@gmail.com>\n---\n t/t1404-update-ref-errors.sh | 1 -\n 1 file changed, 1 deletion(-)\n\ndiff --git a/t/t1404-update-ref-errors.sh b/t/t1404-update-ref-errors.sh\nindex b5606d93b5..937ae0d733 100755\n--- a/t/t1404-update-ref-errors.sh\n+++ b/t/t1404-update-ref-errors.sh\n@@ -551,7 +551,6 @@ test_expect_success REFFILES 'no bogus intermediate values during delete' '\n \tgit update-ref $prefix/foo $C &&\n \tgit pack-refs --all &&\n \tgit update-ref $prefix/foo $D &&\n-\tgit for-each-ref $prefix >unchanged &&\n \t# Now try to update the reference, but hold the `packed-refs` lock\n \t# for a while to see what happens while the process is blocked:\n \t: >.git/packed-refs.lock &&\n-- \n2.40.0\n\n"},{"id":"474130","messageId":"20230324205434.93754-8-rybak.a.v@gmail.com","threadId":"59381","inReplyTo":"20230324205434.93754-1-rybak.a.v@gmail.com","subject":"[PATCH v3 7/7] t1507: assert output of rev-parse","fromName":"Andrei Rybak","fromEmail":"rybak.a.v@gmail.com","sentAt":"2023-03-24T20:54:34Z","receivedAt":"2023-03-24T20:55:00Z","isPatch":true,"sender":{"key":"rybak.a.v@gmail.com","avatar":"https://avatars.githubusercontent.com/u/624072?v=4"},"body":"Tests in t1507-rev-parse-upstream.sh compare files \"expect\" and \"actual\"\nto assert the output of \"git rev-parse\", \"git show\", and \"git log\".\nHowever, two of the tests '@{reflog}-parsing does not look beyond colon'\nand '@{upstream}-parsing does not look beyond colon' don't inspect the\ncontents of the created files.\n\nAssert output of \"git rev-parse\" in tests in t1507-rev-parse-upstream.sh\nto improve test coverage.\n\nSigned-off-by: Andrei Rybak <rybak.a.v@gmail.com>\n---\n t/t1507-rev-parse-upstream.sh | 6 ++++--\n 1 file changed, 4 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t1507-rev-parse-upstream.sh b/t/t1507-rev-parse-upstream.sh\nindex c34714ffe3..4458820168 100755\n--- a/t/t1507-rev-parse-upstream.sh\n+++ b/t/t1507-rev-parse-upstream.sh\n@@ -258,7 +258,8 @@ test_expect_success '@{reflog}-parsing does not look beyond colon' '\n \tgit add @{yesterday} &&\n \tgit commit -m \"funny reflog file\" &&\n \tgit hash-object @{yesterday} >expect &&\n-\tgit rev-parse HEAD:@{yesterday} >actual\n+\tgit rev-parse HEAD:@{yesterday} >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success '@{upstream}-parsing does not look beyond colon' '\n@@ -266,7 +267,8 @@ test_expect_success '@{upstream}-parsing does not look beyond colon' '\n \tgit add @{upstream} &&\n \tgit commit -m \"funny upstream file\" &&\n \tgit hash-object @{upstream} >expect &&\n-\tgit rev-parse HEAD:@{upstream} >actual\n+\tgit rev-parse HEAD:@{upstream} >actual &&\n+\ttest_cmp expect actual\n '\n \n test_done\n-- \n2.40.0\n\n"},{"id":"474327","messageId":"xmqqjzz0g4l5.fsf@gitster.g","threadId":"59381","inReplyTo":"20230324205434.93754-1-rybak.a.v@gmail.com","subject":"Re: [PATCH v3 0/7] t: fix unused files, part 1","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-03-28T17:37:10Z","receivedAt":"2023-03-28T17:38:13Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Andrei Rybak <rybak.a.v@gmail.com> writes:\n\n> I messed up when sending v2 (incorrectly used format-patch with --in-reply-to),\n> and v2 didn't get any response.  So here's v3 which is just a resend of v2.\n\nEverything in this iteration looks good to me.\n\nLet's merge the topic down to 'next'.\n\nThanks for cleaning up these tests.\n\n\n"}]}