From: John Cai <johncai86@gmail.com>
To: Patrick Steinhardt <ps@pks.im>
Cc: John Cai via GitGitGadget <gitgitgadget@gmail.com>, git@vger.kernel.org
Subject: Re: [PATCH 10/12] t3903: move reffiles specific tests to t0600
Date: Fri, 19 Jan 2024 10:47:05 -0500 [thread overview]
Message-ID: <06EEFC6C-5ACE-49D7-AF24-C0D950241E86@gmail.com> (raw)
In-Reply-To: <Zap7jfZlwlm-UZ1X@tanuki>
Hi Patrick,
On 19 Jan 2024, at 8:39, Patrick Steinhardt wrote:
> 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.
>
> 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
> '
next prev parent reply other threads:[~2024-01-19 15:47 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-17 19:52 [PATCH 00/12] Group reffiles tests John Cai via GitGitGadget
2024-01-17 19:52 ` [PATCH 01/12] t3210: move to t0602 John Cai via GitGitGadget
2024-01-18 0:40 ` Junio C Hamano
2024-01-18 11:32 ` Patrick Steinhardt
2024-01-18 16:25 ` John Cai
2024-01-17 19:52 ` [PATCH 02/12] remove REFFILES prerequisite John Cai via GitGitGadget
2024-01-18 0:46 ` Junio C Hamano
2024-01-18 11:21 ` Patrick Steinhardt
2024-01-17 19:52 ` [PATCH 03/12] t1414: convert test to use Git commands instead of writing refs manually John Cai via GitGitGadget
2024-01-18 0:56 ` Junio C Hamano
2024-01-17 19:52 ` [PATCH 04/12] t1404: move reffiles specific tests to t0600 John Cai via GitGitGadget
2024-01-19 13:27 ` Patrick Steinhardt
2024-01-17 19:52 ` [PATCH 05/12] t1405: " John Cai via GitGitGadget
2024-01-17 19:52 ` [PATCH 06/12] t1406: " John Cai via GitGitGadget
2024-01-17 19:52 ` [PATCH 07/12] t1410: " John Cai via GitGitGadget
2024-01-17 19:52 ` [PATCH 08/12] t1415: " John Cai via GitGitGadget
2024-01-19 13:29 ` Patrick Steinhardt
2024-01-17 19:52 ` [PATCH 09/12] t1503: " John Cai via GitGitGadget
2024-01-17 19:52 ` [PATCH 10/12] t3903: " John Cai via GitGitGadget
2024-01-19 13:39 ` Patrick Steinhardt
2024-01-19 15:47 ` John Cai [this message]
2024-01-17 19:52 ` [PATCH 11/12] t4202: " John Cai via GitGitGadget
2024-01-17 19:52 ` [PATCH 12/12] t5312: " John Cai via GitGitGadget
2024-01-19 13:40 ` Patrick Steinhardt
2024-01-18 1:17 ` [PATCH 00/12] Group reffiles tests Junio C Hamano
2024-01-18 11:38 ` Patrick Steinhardt
2024-01-18 20:00 ` Junio C Hamano
2024-01-19 20:18 ` [PATCH v2 " John Cai via GitGitGadget
2024-01-19 20:18 ` [PATCH v2 01/12] t3210: move to t0601 John Cai via GitGitGadget
2024-01-22 11:31 ` Patrick Steinhardt
2024-01-19 20:18 ` [PATCH v2 02/12] remove REFFILES prerequisite for some tests in t1405 and t2017 John Cai via GitGitGadget
2024-01-19 20:18 ` [PATCH v2 03/12] t1414: convert test to use Git commands instead of writing refs manually John Cai via GitGitGadget
2024-01-19 20:18 ` [PATCH v2 04/12] t1404: move reffiles specific tests to t0600 John Cai via GitGitGadget
2024-01-22 11:31 ` Patrick Steinhardt
2024-01-19 20:18 ` [PATCH v2 05/12] t1405: move reffiles specific tests to t0601 John Cai via GitGitGadget
2024-01-19 20:18 ` [PATCH v2 06/12] t1406: move reffiles specific tests to t0600 John Cai via GitGitGadget
2024-01-19 20:18 ` [PATCH v2 07/12] t1410: " John Cai via GitGitGadget
2024-01-22 14:12 ` Karthik Nayak
2024-01-19 20:18 ` [PATCH v2 08/12] t1415: move reffiles specific tests to t0601 John Cai via GitGitGadget
2024-01-22 14:12 ` Karthik Nayak
2024-01-19 20:18 ` [PATCH v2 09/12] t1503: move reffiles specific tests to t0600 John Cai via GitGitGadget
2024-01-19 20:18 ` [PATCH v2 10/12] t3903: make drop stash test ref backend agnostic John Cai via GitGitGadget
2024-01-19 20:18 ` [PATCH v2 11/12] t4202: move reffiles specific tests to t0600 John Cai via GitGitGadget
2024-01-19 20:19 ` [PATCH v2 12/12] t5312: move reffiles specific tests to t0601 John Cai via GitGitGadget
2024-01-22 11:36 ` [PATCH v2 00/12] Group reffiles tests Patrick Steinhardt
2024-01-23 0:01 ` Junio C Hamano
2024-01-24 21:37 ` John Cai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=06EEFC6C-5ACE-49D7-AF24-C0D950241E86@gmail.com \
--to=johncai86@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=ps@pks.im \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).