From: Junio C Hamano <gitster@pobox.com>
To: Patrick Steinhardt <ps@pks.im>
Cc: git@vger.kernel.org, "Ronan Pigott" <ronan@rjp.ie>,
shejialuo <shejialuo@gmail.com>, "René Scharfe" <l.s.r@web.de>
Subject: Re: [PATCH 1/2] t1305: exercise edge cases of "onbranch" includes
Date: Tue, 24 Sep 2024 09:05:56 -0700 [thread overview]
Message-ID: <xmqqed59vxy3.fsf@gitster.g> (raw)
In-Reply-To: <615df98339e9451bc237decea087716ca15d157d.1727171197.git.ps@pks.im> (Patrick Steinhardt's message of "Tue, 24 Sep 2024 12:05:42 +0200")
Patrick Steinhardt <ps@pks.im> writes:
> +test_expect_success 'onbranch without repository' '
> + test_when_finished "rm -f .gitconfig config.inc" &&
> + git config set -f .gitconfig "includeIf.onbranch:**.path" config.inc &&
> + git config set -f config.inc foo.bar baz &&
This assumes that the $(pwd) is the $HOME; so .gitconfig is the
per-user configuration that ought to apply everywhere; since
includeIf.<condition>.path that is relative is relative to the
including file, config.inc would be in cluded when the condition
holds in $HOME/.gitconfig. OK.
> + git config get foo.bar &&
This assumes that the $(pwd) that is $HOME is a valid repository,
and checks if includeIf.onbranch works from within a repository.
OK.
> + test_must_fail nongit git config get foo.bar
> +'
> +test_expect_failure 'onbranch without repository but explicit nonexistent Git directory' '
> + test_when_finished "rm -f .gitconfig config.inc" &&
> + git config set -f .gitconfig "includeIf.onbranch:**.path" config.inc &&
> + git config set -f config.inc foo.bar baz &&
The same set-up.
> + git config get foo.bar &&
> + test_must_fail nongit git --git-dir=nonexistent config get foo.bar
It has to work when $(pwd) is outside a repository, but is "nongit"
strictly necessary? IOW, even when we _could_ discover the top
level of a git-controlled working tree, wouldn't presence of --git-dir
that points at elsewhere make $(pwd) and the repository there irrelevant
to the operation?
I am not suggesting to just drop "nongit" from this test. I am
wondering if this is better split into two tests, with and without
"nongit" to test different situations.
> +'
> +
> test_done
Other than that, looks like good additions to the test coverage.
Thanks.
next prev parent reply other threads:[~2024-09-24 16:06 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-20 17:37 BUG: refs.c:1933: reference backend is unknown Ronan Pigott
2024-09-21 16:09 ` shejialuo
2024-09-21 18:06 ` Ronan Pigott
2024-09-21 21:22 ` René Scharfe
2024-09-22 6:51 ` shejialuo
2024-09-22 14:41 ` shejialuo
2024-09-24 10:05 ` [PATCH 0/2] config: fix evaluating "onbranch" with nonexistent git dir Patrick Steinhardt
2024-09-24 10:05 ` [PATCH 1/2] t1305: exercise edge cases of "onbranch" includes Patrick Steinhardt
2024-09-24 16:05 ` Junio C Hamano [this message]
2024-09-24 10:05 ` [PATCH 2/2] config: fix evaluating "onbranch" with nonexistent git dir Patrick Steinhardt
2024-09-24 14:11 ` shejialuo
2024-09-24 16:17 ` Junio C Hamano
2024-09-24 14:20 ` [PATCH 0/2] " shejialuo
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=xmqqed59vxy3.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=l.s.r@web.de \
--cc=ps@pks.im \
--cc=ronan@rjp.ie \
--cc=shejialuo@gmail.com \
/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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.