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

Re: [PATCH v1 6/7] t1404: don't create unused file

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 13, 2023, 21:56 UTC
Message-ID
<xmqqo7ows4bv.fsf@gitster.g>
In-Reply-To
<20230312201520.370234-8-rybak.a.v@gmail.com>
Andrei Rybak <rybak.a.v@gmail.com> writes:
Show 9 quoted lines
> 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".
>
> 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.

I think the name "unchanged" is a reference to: the state recorded in this file is before all the interesting changes done in this test.

So another for-each-ref, after the "lock, start a process that waits for and then removes the ref" begins but while the other process is still waiting, whose output is compared with "unchanged" may have been another way to perform this test, but we have "it could be $D that is what we want, and two plausible 'wrong' answers are $C and undefined" that is sufficient. So I agree with removing the line that creates "unchanged".

The other test to the file added by the same commit 6a2a7736 (t1404: demonstrate two problems with reference transactions, 2017-09-08) creates the "unchanged" file in the same way, but it does get used after running "update-ref" that is tested. I would not be surprised if the one removed by this patch was created by a cut-and-paste by mistake.

Thanks.
Show 19 quoted lines
> Don't create the unused and slightly misleading file "unchanged".
>
> Signed-off-by: Andrei Rybak <rybak.a.v@gmail.com>
> ---
>  t/t1404-update-ref-errors.sh | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/t/t1404-update-ref-errors.sh b/t/t1404-update-ref-errors.sh
> index b5606d93b5..937ae0d733 100755
> --- a/t/t1404-update-ref-errors.sh
> +++ b/t/t1404-update-ref-errors.sh
> @@ -551,7 +551,6 @@ test_expect_success REFFILES 'no bogus intermediate values during delete' '
>  	git update-ref $prefix/foo $C &&
>  	git pack-refs --all &&
>  	git update-ref $prefix/foo $D &&
> -	git for-each-ref $prefix >unchanged &&
>  	# Now try to update the reference, but hold the `packed-refs` lock
>  	# for a while to see what happens while the process is blocked:
>  	: >.git/packed-refs.lock &&
Previous: Andrei RybakNext: Andrei Rybak
Message 13 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.