Re: [GSoC][PATCH 2/2] t: add test for git refs exists subcommand

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 21 Aug 2025 at 15:51, Patrick Steinhardt <ps@xxxxxx> wrote:
>
> 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?
>
Thanks for the review. You're right, splitting the test commit into two is
cleaner. I'll make that change and send out a v2 shortly.

> Patrick

Thanks,
Meet.




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux