public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks•im>
To: Meet Soni <meetsoni3017@gmail•com>
Cc: git@vger•kernel.org, shejialuo@gmail•com
Subject: Re: [GSoC][PATCH 2/2] t: add test for git refs exists subcommand
Date: Thu, 21 Aug 2025 12:21:40 +0200	[thread overview]
Message-ID: <aKbzNNcZZ-E0FVeI@pks.im> (raw)
In-Reply-To: <20250821085246.929307-3-meetsoni3017@gmail.com>

On Thu, Aug 21, 2025 at 02:22:46PM +0530, Meet Soni wrote:
> The new `git refs exists` subcommand must have identical behavior to its
> predecessor, `git show-ref --exists`. To avoid duplicating the entire
> test suite, refactor the existing tests into a shareable helper script.
> 
> Extract the tests for the `--exists` flag from `t1403-show-ref.sh` into
> a new `show-ref-exists-tests.sh` helper. The command under test is
> parameterized using the `$git_show_ref_exists` variable.
> 
> Source new helper to both `t1403-show-ref.sh` and the new test file,

s/new/this/, otherwise this reads grammatically wrong to me.

>  test_done
> diff --git a/t/t1462-refs-exists.sh b/t/t1462-refs-exists.sh
> new file mode 100755
> index 0000000000..c00d76cc9e
> --- /dev/null
> +++ b/t/t1462-refs-exists.sh
> @@ -0,0 +1,22 @@
> +#!/bin/sh
> +
> +test_description='refs exists'
> +GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
> +export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
> +
> +. ./test-lib.sh
> +
> +git_show_ref_exists='git refs exists'
> +
> +test_expect_success setup '
> +	test_commit --annotate A &&
> +	git checkout -b side &&
> +	test_commit --annotate B &&
> +	git checkout main &&
> +	test_commit C &&
> +	git branch B A^0
> +'

It's a bit weird that this setup needs to be replicated. I guess it
comes from the fact that t1403 also has a bunch of other tests for
git-show-ref(1) that are irrelevant to existence checks.

How about we instead split out the existence-checks in t1403 into a
separate test suite first and then pull out the whole logic from it in a
subsequent commit so that we can also share the setup?

Patrick

  reply	other threads:[~2025-08-21 10:21 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-21  8:52 [GSoC][PATCH 0/2] Add refs exists subcommand Meet Soni
2025-08-21  8:52 ` [GSoC][PATCH 1/2] builtin/refs: add 'exists' subcommand Meet Soni
2025-08-21 10:21   ` Patrick Steinhardt
2025-08-21  8:52 ` [GSoC][PATCH 2/2] t: add test for git refs exists subcommand Meet Soni
2025-08-21 10:21   ` Patrick Steinhardt [this message]
2025-08-22  4:59     ` Meet Soni
2025-08-21 10:21 ` [GSoC][PATCH 0/2] Add " Patrick Steinhardt
2025-08-21 16:01 ` Junio C Hamano
2025-08-22  4:27   ` Meet Soni
2025-08-23  6:00 ` [GSoC][PATCH v2 0/4] " Meet Soni
2025-08-23  6:00   ` [GSoC][PATCH v2 1/4] builtin/refs: add 'exists' subcommand Meet Soni
2025-08-23  6:00   ` [GSoC][PATCH v2 2/4] t1403: split 'show-ref --exists' tests into a separate file Meet Soni
2025-08-23  6:00   ` [GSoC][PATCH v2 3/4] t1422: refactor tests to be shareable Meet Soni
2025-08-24 16:58     ` Patrick Steinhardt
2025-08-23  6:00   ` [GSoC][PATCH v2 4/4] t: add test for git refs exists subcommand Meet Soni
2025-08-24 16:58   ` [GSoC][PATCH v2 0/4] Add " Patrick Steinhardt
2025-08-26  6:41   ` [GSoC][PATCH v3 " Meet Soni
2025-08-26  6:41     ` [GSoC][PATCH v3 1/4] builtin/refs: add 'exists' subcommand Meet Soni
2025-08-26  6:41     ` [GSoC][PATCH v3 2/4] t1403: split 'show-ref --exists' tests into a separate file Meet Soni
2025-08-26  6:41     ` [GSoC][PATCH v3 3/4] t1422: refactor tests to be shareable Meet Soni
2025-08-26  6:41     ` [GSoC][PATCH v3 4/4] t: add test for git refs exists subcommand Meet Soni
2025-09-02 11:52     ` [GSoC][PATCH v3 0/4] Add " Patrick Steinhardt
2025-09-02 16:57     ` Junio C Hamano

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aKbzNNcZZ-E0FVeI@pks.im \
    --to=ps@pks$(echo .)im \
    --cc=git@vger$(echo .)kernel.org \
    --cc=meetsoni3017@gmail$(echo .)com \
    --cc=shejialuo@gmail$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox