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

Re: [PATCH 10/12] t3903: move reffiles specific tests to t0600

From
John Cai <johncai86@gmail.com>
Date
Jan 19, 2024, 15:47 UTC
Message-ID
<06EEFC6C-5ACE-49D7-AF24-C0D950241E86@gmail.com>
In-Reply-To
<Zap7jfZlwlm-UZ1X@tanuki>
Hi Patrick,
On 19 Jan 2024, at 8:39, Patrick Steinhardt wrote:
Show 58 quoted lines
> On Wed, Jan 17, 2024 at 07:52:33PM +0000, John Cai via GitGitGadget wrote:
>> From: John Cai <johncai86@gmail.com>
>>
>> Move this test into t0600 with other reffiles specific tests since it
>> modifies reflog refs manually and thus is specific to the reffiles
>> backend.
>>
>> This change also consolidates setup_stash() into test-lib-functions.sh
>>
>> Signed-off-by: John Cai <johncai86@gmail.com>
>> ---
>>  t/t0600-reffiles-backend.sh | 27 +++++++++++++++++++++++
>>  t/t3903-stash.sh            | 43 -------------------------------------
>>  t/test-lib-functions.sh     | 16 ++++++++++++++
>>  3 files changed, 43 insertions(+), 43 deletions(-)
>>
>> diff --git a/t/t0600-reffiles-backend.sh b/t/t0600-reffiles-backend.sh
>> index 704b73fdc54..bee61b2d19d 100755
>> --- a/t/t0600-reffiles-backend.sh
>> +++ b/t/t0600-reffiles-backend.sh
>> @@ -527,4 +527,31 @@ test_expect_success SYMLINKS 'ref resolution not confused by broken symlinks' '
>>         test_must_fail git rev-parse --verify broken
>>  '
>>
>> +test_expect_success 'drop stash reflog updates refs/stash with rewrite' '
>> +	git init repo &&
>> +	(
>> +		cd repo &&
>> +		setup_stash
>> +	) &&
>> +	echo 9 >repo/file &&
>> +
>> +	old_oid="$(git -C repo rev-parse stash@{0})" &&
>> +	git -C repo stash &&
>> +	new_oid="$(git -C repo rev-parse stash@{0})" &&
>> +
>> +	cat >expect <<-EOF &&
>> +	$(test_oid zero) $old_oid
>> +	$old_oid $new_oid
>> +	EOF
>> +	cut -d" " -f1-2 repo/.git/logs/refs/stash >actual &&
>> +	test_cmp expect actual &&
>> +
>> +	git -C repo stash drop stash@{1} &&
>> +	cut -d" " -f1-2 repo/.git/logs/refs/stash >actual &&
>> +	cat >expect <<-EOF &&
>> +	$(test_oid zero) $new_oid
>> +	EOF
>> +	test_cmp expect actual
>> +'
>
> I think that there is no need to make this backend-specific. What we're
> testing here is that `git stash drop` is able to drop the latest reflog
> entry. The calls to cut(1) are only used to verify that the contents of
> the reflog entry look as expected while only verifying the old and new
> object IDs.
>
> So how about below patch to make it generic instead?
Nice catch. This sounds perfect to me.
Show 40 quoted lines
>
> Patrick
>
> -- >8 --
>
> diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh
> index 34faeac3f1..3319240515 100755
> --- a/t/t3903-stash.sh
> +++ b/t/t3903-stash.sh
> @@ -200,7 +200,7 @@ test_expect_success 'drop stash reflog updates refs/stash' '
>  	test_cmp expect actual
>  '
>
> -test_expect_success REFFILES 'drop stash reflog updates refs/stash with rewrite' '
> +test_expect_success 'drop stash reflog updates refs/stash with rewrite' '
>  	git init repo &&
>  	(
>  		cd repo &&
> @@ -213,16 +213,16 @@ test_expect_success REFFILES 'drop stash reflog updates refs/stash with rewrite'
>  	new_oid="$(git -C repo rev-parse stash@{0})" &&
>
>  	cat >expect <<-EOF &&
> -	$(test_oid zero) $old_oid
> -	$old_oid $new_oid
> +	$new_oid
> +	$old_oid
>  	EOF
> -	cut -d" " -f1-2 repo/.git/logs/refs/stash >actual &&
> +	git -C repo reflog show refs/stash --format=%H >actual &&
>  	test_cmp expect actual &&
>
>  	git -C repo stash drop stash@{1} &&
> -	cut -d" " -f1-2 repo/.git/logs/refs/stash >actual &&
> +	git -C repo reflog show refs/stash --format=%H >actual &&
>  	cat >expect <<-EOF &&
> -	$(test_oid zero) $new_oid
> +	$new_oid
>  	EOF
>  	test_cmp expect actual
>  '
Previous: Patrick SteinhardtNext: John Cai via GitGitGadget
Message 21 of 47 in “Group reffiles tests”
  1. 00/12 Group reffiles testsJohn Cai via GitGitGadget, Jan 17, 2024
  2. 01/12 t3210: move to t0602John Cai via GitGitGadget, Jan 17, 2024
  3. Junio C HamanoJan 18, 2024
  4. Patrick SteinhardtJan 18, 2024
  5. John CaiJan 18, 2024
  6. 02/12 remove REFFILES prerequisiteJohn Cai via GitGitGadget, Jan 17, 2024
  7. Junio C HamanoJan 18, 2024
  8. Patrick SteinhardtJan 18, 2024
  9. 03/12 t1414: convert test to use Git commands instead of writing refs manuallyJohn Cai via GitGitGadget, Jan 17, 2024
  10. Junio C HamanoJan 18, 2024
  11. 05/12 t1405: move reffiles specific tests to t0600John Cai via GitGitGadget, Jan 17, 2024
  12. 04/12 t1404: move reffiles specific tests to t0600John Cai via GitGitGadget, Jan 17, 2024
  13. Patrick SteinhardtJan 19, 2024
  14. 06/12 t1406: move reffiles specific tests to t0600John Cai via GitGitGadget, Jan 17, 2024
  15. 07/12 t1410: move reffiles specific tests to t0600John Cai via GitGitGadget, Jan 17, 2024
  16. 08/12 t1415: move reffiles specific tests to t0600John Cai via GitGitGadget, Jan 17, 2024
  17. Patrick SteinhardtJan 19, 2024
  18. 09/12 t1503: move reffiles specific tests to t0600John Cai via GitGitGadget, Jan 17, 2024
  19. 10/12 t3903: move reffiles specific tests to t0600John Cai via GitGitGadget, Jan 17, 2024
  20. Patrick SteinhardtJan 19, 2024
  21. John CaiJan 19, 2024
  22. 11/12 t4202: move reffiles specific tests to t0600John Cai via GitGitGadget, Jan 17, 2024
  23. 12/12 t5312: move reffiles specific tests to t0600John Cai via GitGitGadget, Jan 17, 2024
  24. Patrick SteinhardtJan 19, 2024
  25. Junio C HamanoJan 18, 2024
  26. Patrick SteinhardtJan 18, 2024
  27. Junio C HamanoJan 18, 2024
  28. 00/12 Group reffiles testsJohn Cai via GitGitGadget, Jan 19, 2024
  29. 01/12 t3210: move to t0601John Cai via GitGitGadget, Jan 19, 2024
  30. Patrick SteinhardtJan 22, 2024
  31. 02/12 remove REFFILES prerequisite for some tests in t1405 and t2017John Cai via GitGitGadget, Jan 19, 2024
  32. 03/12 t1414: convert test to use Git commands instead of writing refs manuallyJohn Cai via GitGitGadget, Jan 19, 2024
  33. 05/12 t1405: move reffiles specific tests to t0601John Cai via GitGitGadget, Jan 19, 2024
  34. 04/12 t1404: move reffiles specific tests to t0600John Cai via GitGitGadget, Jan 19, 2024
  35. Patrick SteinhardtJan 22, 2024
  36. 06/12 t1406: move reffiles specific tests to t0600John Cai via GitGitGadget, Jan 19, 2024
  37. 07/12 t1410: move reffiles specific tests to t0600John Cai via GitGitGadget, Jan 19, 2024
  38. Karthik NayakJan 22, 2024
  39. 08/12 t1415: move reffiles specific tests to t0601John Cai via GitGitGadget, Jan 19, 2024
  40. Karthik NayakJan 22, 2024
  41. 09/12 t1503: move reffiles specific tests to t0600John Cai via GitGitGadget, Jan 19, 2024
  42. 10/12 t3903: make drop stash test ref backend agnosticJohn Cai via GitGitGadget, Jan 19, 2024
  43. 11/12 t4202: move reffiles specific tests to t0600John Cai via GitGitGadget, Jan 19, 2024
  44. 12/12 t5312: move reffiles specific tests to t0601John Cai via GitGitGadget, Jan 19, 2024
  45. Patrick SteinhardtJan 22, 2024
  46. Junio C HamanoJan 23, 2024
  47. John CaiJan 24, 2024

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.