git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2 0/7] t: fix unused files, part 1

From
Andrei Rybak <rybak.a.v@gmail.com>
Date
Mar 18, 2023, 15:46 UTC
Message-ID
<20230318154646.131344-1-rybak.a.v@gmail.com>
In-Reply-To
<20230312201520.370234-1-rybak.a.v@gmail.com>
Here's a v2 for various fixes of unused files in t0??? and t1???.
Original cover letter is at
  https://lore.kernel.org/git/20230312201520.370234-1-rybak.a.v@gmail.com/T/#m63071efd1e2f876fdcbd0c384130b0ec7859f885
Changes since v1 address Junio's review:
  - just don't redirect output of mktree in patch 3/7
  - rewritten commit message of patch 6/7, where I'd completely misunderstood
    the code of the tests.
Range diff:
1:  017f1d8173 = 1:  59a868c0b8 t1005: assert output of ls-files
2:  7a75864e00 = 2:  a3514687ad t1006: assert error output of cat-file
3:  e23a16e560 ! 3:  4cb07fa965 t1010: assert empty output of mktree
    @@ Metadata
     Author: Andrei Rybak <rybak.a.v@gmail.com>
     
      ## Commit message ##
    -    t1010: assert empty output of mktree
    +    t1010: don't create unused files
     
         Builtin "git mktree" writes the the object name of the tree object built
         to the standard output.  Tests 'mktree refuses to read ls-tree -r output
    @@ Commit message
         "t1010-mktree.sh" redirect output of "git mktree" to a file, but don't
         use its contents in assertions.
     
    -    Assert that the output of "git mktree" is empty when it refuses to build
    -    a tree object.
    +    Don't redirect output of "git mktree" to file "actual" in tests that
    +    assert that an invocation of "git mktree" must fail.
    +
    +    Output of "git mktree" is empty when it refuses to build a tree object.
    +    So, alternatively, the test could assert that the output is empty.
    +    However, there isn't a good reason for the user to expect the command to
    +    be silent in such cases, so we shouldn't enforce it.  The user shouldn't
    +    use the output of a failing command anyway.
     
         Signed-off-by: Andrei Rybak <rybak.a.v@gmail.com>
     
    @@ t/t1010-mktree.sh: test_expect_success 'allow missing object with --missing' '
      
      test_expect_success 'mktree refuses to read ls-tree -r output (1)' '
     -  test_must_fail git mktree <all >actual
    -+  test_must_fail git mktree <all >actual &&
    -+  test_must_be_empty actual
    ++  test_must_fail git mktree <all
      '
      
      test_expect_success 'mktree refuses to read ls-tree -r output (2)' '
     -  test_must_fail git mktree <all.withsub >actual
    -+  test_must_fail git mktree <all.withsub >actual &&
    -+  test_must_be_empty actual
    ++  test_must_fail git mktree <all.withsub
      '
      
      test_done
4:  462cfa7025 = 4:  1ed6030a4f t1302: don't create unused file
5:  9fa04e479c = 5:  002942d81c t1400: assert output of update-ref
6:  e79566cc32 ! 6:  2e3446fc2f t1404: don't create unused file
    @@ Commit message
     
         Some tests in file t1404-update-ref-errors.sh create file "unchanged" as
         the expected side for a test_cmp assertion at the end of the test for
    -    output of "git for-each-ref".  The filename conveys the expectation that
    -    the output won't change between two invocations of "git for-each-ref".
    +    output of "git for-each-ref".  Test 'no bogus intermediate values during
    +    delete' also creates a file named "unchanged" using "git for-each-ref".
    +    However, the file isn't used for any assertions in the test.  Instead,
    +    "git rev-parse" is used to compare the reference with variable $D.
     
    -    Test 'no bogus intermediate values during delete' also creates a file
    -    named "unchanged".  However, in this test the reference is being
    -    deleted, i.e. it _does change_.  The file itself isn't used for any
    -    assertions in the test.
    -
    -    Don't create the unused and slightly misleading file "unchanged".
    +    Don't create unused file "unchanged" in test 'no bogus intermediate
    +    values during delete' of t1404-update-ref-errors.sh.
     
         Signed-off-by: Andrei Rybak <rybak.a.v@gmail.com>
     
7:  5a7df840a8 = 7:  e11a7d8e02 t1507: assert output of rev-parse
Andrei Rybak (7):
  t1005: assert output of ls-files
  t1006: assert error output of cat-file
  t1010: don't create unused files
  t1302: don't create unused file
  t1400: assert output of update-ref
  t1404: don't create unused file
  t1507: assert output of rev-parse
 t/t1005-read-tree-reset.sh    | 15 ++++++++++-----
 t/t1006-cat-file.sh           |  3 ++-
 t/t1010-mktree.sh             |  4 ++--
 t/t1302-repo-version.sh       |  2 +-
 t/t1400-update-ref.sh         |  3 +++
 t/t1404-update-ref-errors.sh  |  1 -
 t/t1507-rev-parse-upstream.sh |  6 ++++--
 7 files changed, 22 insertions(+), 12 deletions(-)
-- 
2.40.0
Previous: Andrei RybakNext: Andrei Rybak
Message 17 of 33 in “t: fix unused files, part 1”
  1. 0/7 t: fix unused files, part 1Andrei Rybak, Mar 12, 2023
  2. 1/7 t1005: assert output of ls-filesAndrei Rybak, Mar 12, 2023
  3. Michael J GruberMar 14, 2023
  4. Andrei RybakMar 18, 2023
  5. 1/1 t1507: assert output of rev-parseAndrei Rybak, Mar 12, 2023
  6. Andrei RybakMar 12, 2023
  7. 2/7 t1006: assert error output of cat-fileAndrei Rybak, Mar 12, 2023
  8. 3/7 t1010: assert empty output of mktreeAndrei Rybak, Mar 12, 2023
  9. Junio C HamanoMar 13, 2023
  10. 4/7 t1302: don't create unused fileAndrei Rybak, Mar 12, 2023
  11. 5/7 t1400: assert output of update-refAndrei Rybak, Mar 12, 2023
  12. 6/7 t1404: don't create unused fileAndrei Rybak, Mar 12, 2023
  13. Junio C HamanoMar 13, 2023
  14. 7/7 t1507: assert output of rev-parseAndrei Rybak, Mar 12, 2023
  15. Junio C HamanoMar 13, 2023
  16. Andrei RybakMar 14, 2023
  17. 0/7 t: fix unused files, part 1Andrei Rybak, Mar 18, 2023
  18. 1/7 t1005: assert output of ls-filesAndrei Rybak, Mar 18, 2023
  19. 2/7 t1006: assert error output of cat-fileAndrei Rybak, Mar 18, 2023
  20. 3/7 t1010: don't create unused filesAndrei Rybak, Mar 18, 2023
  21. 4/7 t1302: don't create unused fileAndrei Rybak, Mar 18, 2023
  22. 5/7 t1400: assert output of update-refAndrei Rybak, Mar 18, 2023
  23. 7/7 t1507: assert output of rev-parseAndrei Rybak, Mar 18, 2023
  24. 6/7 t1404: don't create unused fileAndrei Rybak, Mar 18, 2023
  25. 0/7 t: fix unused files, part 1Andrei Rybak, Mar 24, 2023
  26. 1/7 t1005: assert output of ls-filesAndrei Rybak, Mar 24, 2023
  27. 2/7 t1006: assert error output of cat-fileAndrei Rybak, Mar 24, 2023
  28. 3/7 t1010: don't create unused filesAndrei Rybak, Mar 24, 2023
  29. 5/7 t1400: assert output of update-refAndrei Rybak, Mar 24, 2023
  30. 4/7 t1302: don't create unused fileAndrei Rybak, Mar 24, 2023
  31. 6/7 t1404: don't create unused fileAndrei Rybak, Mar 24, 2023
  32. 7/7 t1507: assert output of rev-parseAndrei Rybak, Mar 24, 2023
  33. Junio C HamanoMar 28, 2023

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.