From: Jonathan Nieder <jrnieder@gmail.com>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] t5500: fix mistaken $SERVER reference in helper function
Date: Thu, 20 Jun 2024 11:27:58 +0200 [thread overview]
Message-ID: <ZnM3I11IRporu4sj@google.com> (raw)
In-Reply-To: <20240619125255.GA346466@coredump.intra.peff.net>
Hi,
Jeff King wrote:
> This happens to work out because the "server" directory from the first
> test is still hanging around, and the contents of the two are identical.
> But it was clearly not the intended behavior, and is fragile to cleaning
> up the leftovers from the first test.
>
> Signed-off-by: Jeff King <peff@peff.net>
> ---
> t/t5500-fetch-pack.sh | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Restating to make sure I understand correctly.
fetch_filter_blob_limit_zero is a helper for parameterized tests
taking two parameters. The first is the path to a repository we will
clone from, and the second is a clone URL to clone from that
repository. (That way, we can reuse the same logic for multiple URL
schemes.)
Those tests each do the following:
- set up $SERVER containing a test commit and allowing partial clone
- clone from $URL to client
- make a new commit in $SERVER, that client doesn't have
- fetch to catch up, with --filter=blob:none
- assert that the new commit was fetched and new blob wasn't
And in that assertion, we want to get the name of the new commit and
new blob from $SERVER, not client, since we wouldn't want a side
effect of causing them to be fetched in the process.
Alas, in a copy-and-paste gone wrong, 07ef3c6604 gets the name of the
blob (but not the commit) from "server" instead of $SERVER. And this
happens to work because the first time we call this helper, $SERVER is
"server". The only reason this happens to work at all is that we're
looking at a blob id; if we looked at the commit id, then the
timestamps wouldn't have matched.
Thanks, the fix is obviously correct.
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Particularly telling that the author of 07ef3c6604 introduced this
typo while trying to make the tests _more_ robust.
Once the library code is ready for it, this might be a good candidate
for moving most of the test cases into unit tests and just having one
or two less repetitive integration tests.
Thanks for catching and fixing it!
Jonathan
next prev parent reply other threads:[~2024-06-20 9:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-19 12:52 [PATCH] t5500: fix mistaken $SERVER reference in helper function Jeff King
2024-06-20 9:27 ` Jonathan Nieder [this message]
2024-06-20 15:22 ` Jeff King
2024-06-20 18:06 ` 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=ZnM3I11IRporu4sj@google.com \
--to=jrnieder@gmail.com \
--cc=git@vger.kernel.org \
--cc=peff@peff.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;
as well as URLs for NNTP newsgroup(s).