From: Junio C Hamano <gitster@pobox.com>
To: Ashlesh Gawande <git@ashlesh.me>
Cc: git@vger.kernel.org, sandals@crustytoothpaste.net
Subject: Re: [PATCH] t5550: add netrc tests for http 401/403
Date: Tue, 06 Jan 2026 19:20:35 +0900 [thread overview]
Message-ID: <xmqqjyxvjb4c.fsf@gitster.g> (raw)
In-Reply-To: <20260106093451.748761-1-git@ashlesh.me> (Ashlesh Gawande's message of "Tue, 6 Jan 2026 15:04:51 +0530")
Ashlesh Gawande <git@ashlesh.me> writes:
> Signed-off-by: Ashlesh Gawande <git@ashlesh.me>
> ---
> Sending netrc test patches as suggested in: https://lore.kernel.org/git/aPAg3gYwzA9fHCC3@fruit.crustytoothpaste.net
At the conceptual level, I am happy to have tests for features that
we claim to support. It is a different matter if we want to support
netrc, though ;-).
There are some nits.
> +set_netrc() {
Style. SP on both sides of (). I.e.
set_netrc () {
> + # $HOME=$TRASH_DIRECTORY
> + echo "machine $1 login $2 password $3" > $TRASH_DIRECTORY/.netrc
Style. No space between the redirection operator ">" and
redirection target.
Style. Enclose the redirection target inside a pair of double
quotes if it involves variable interpolation. I.e.
echo ... >"$TRASH_DIRECTORY/.netrc"
> +}
> +
> +clear_netrc() {
Ditto.
> + rm "$TRASH_DIRECTORY/.netrc"
> +}
Should this fail if .netrc did not exist in the first place, or is
the primary purpose of this helper to ensure the file does not exist
after it returns (in which case it would be desirable not to fail if
the file did not exist when it was called, with "rm -f")?
> expect_askpass() {
Ditto.
> +test_expect_success 'using credentials from netrc to clone successfully' '
> + set_askpass wrong &&
> + set_netrc 127.0.0.1 user@host pass@host &&
> + git clone "$HTTPD_URL/auth/dumb/repo.git" clone-auth-netrc &&
> + expect_askpass none
> +'
> +clear_netrc
We try not to run random shell functions outside the test_expect_*
blocks. A clean-up function like this is better called at the end
of each piece, arranged with the test_when_finished helper.
test_expect_success 'do random thing' '
test_when_finished clear_netrc &&
set_askpass wrong &&
set_netrc ... &&
...
'
next prev parent reply other threads:[~2026-01-06 10:20 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-06 9:34 [PATCH] t5550: add netrc tests for http 401/403 Ashlesh Gawande
2026-01-06 10:20 ` Junio C Hamano [this message]
2026-01-06 11:47 ` Ashlesh Gawande
2026-01-06 11:40 ` [PATCH v2] " Ashlesh Gawande
2026-01-07 0:32 ` Junio C Hamano
2026-01-07 7:47 ` [PATCH v3] " Ashlesh Gawande
2026-01-31 12:33 ` Ashlesh Gawande
2026-02-06 5:05 ` Junio C Hamano
2026-02-06 9:38 ` Jeff King
2026-02-06 15:25 ` Ashlesh Gawande
2026-02-06 15:53 ` Ashlesh Gawande
2026-02-06 20:44 ` Jeff King
2026-02-06 17:39 ` Junio C Hamano
2026-02-06 20:53 ` Jeff King
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=xmqqjyxvjb4c.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@ashlesh.me \
--cc=git@vger.kernel.org \
--cc=sandals@crustytoothpaste.net \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox