From: Jeff King <peff@peff.net>
To: Emily Shaffer <emilyshaffer@google.com>
Cc: git@vger.kernel.org, Christian Couder <christian.couder@gmail.com>
Subject: Re: [PATCH v2] promisor-remote: skip move_to_tail when no-op
Date: Thu, 26 Sep 2019 20:32:24 -0400 [thread overview]
Message-ID: <20190927003223.GA22473@sigill.intra.peff.net> (raw)
In-Reply-To: <20190926213156.88185-1-emilyshaffer@google.com>
On Thu, Sep 26, 2019 at 02:31:56PM -0700, Emily Shaffer wrote:
> ---
> Thanks Peff for pointing out this bug occurs any time the tail is being
> moved to tail in the promisors list. Modified patch to check just for
> "already at tail" condition.
>
> Added a test case based on Peff's reproduction steps (thanks!) and
> confirmed it failed before the patch, exiting gracelessly with a
> SIGABRT, and now fails gracefully (and passes test_must_fail condition).
Thanks, this is looking good, though I have a few nits.
> Signed-off-by: Emily Shaffer <emilyshaffer@google.com>
> Helped-by: Jeff King <peff@peff.net>
The trailers are supposed to be chronological. It probably doesn't
matter a lot here, but it's more important for something like a signoff
chain. I suppose you could also argue that you signed off and then I
helped but I think you signed off again after. :)
> diff --git a/promisor-remote.c b/promisor-remote.c
> index 9bc296cdde..9bd5b79d59 100644
> --- a/promisor-remote.c
> +++ b/promisor-remote.c
> @@ -89,6 +89,9 @@ static struct promisor_remote *promisor_remote_lookup(const char *remote_name,
> static void promisor_remote_move_to_tail(struct promisor_remote *r,
> struct promisor_remote *previous)
> {
> + if (r->next == NULL)
> + return;
> +
> if (previous)
> previous->next = r->next;
> else
Yeah, I think of all the discussed options, this one is pretty easy to
understand.
> --- a/t/t0410-partial-clone.sh
> +++ b/t/t0410-partial-clone.sh
> @@ -429,6 +429,18 @@ test_expect_success 'rev-list dies for missing objects on cmd line' '
> done
> '
>
> +test_expect_success 'single promisor remote can be re-initialized gracefully' '
> + # ensure one promisor is in the promisors list
> + rm -rf repo &&
> + test_create_repo repo &&
> + git -C repo remote add foo /wherever &&
> + git -C repo config remote.foo.promisor true &&
> + git -C repo config extensions.partialclone foo &&
> +
> + # reinitialize the promisors list; this must fail gracefully
> + test_must_fail git -C repo fetch --filter=blob:none foo 2>fetch_err
> +'
Could we make this a little more robust by using a real repo instead of
"/wherever", and confirming that the command actually succeeds?
As a side note, if we're not going to check the content of fetch_err, I
think we're better off not redirecting it (it goes to /dev/null by
default, or the user or log if running with "-v" or "--verbose-log").
-Peff
next prev parent reply other threads:[~2019-09-27 0:32 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-25 21:37 [PATCH] promisor-remote: skip move_to_tail when n=1 Emily Shaffer
2019-09-26 7:55 ` Jeff King
2019-09-26 17:53 ` Emily Shaffer
2019-09-26 18:06 ` Jeff King
2019-09-26 21:31 ` [PATCH v2] promisor-remote: skip move_to_tail when no-op Emily Shaffer
2019-09-27 0:32 ` Jeff King [this message]
2019-09-30 20:28 ` [PATCH v3] " Emily Shaffer
2019-09-30 21:27 ` Jeff King
2019-09-30 22:03 ` [PATCH v4] " Emily Shaffer
2019-10-01 5:12 ` Christian Couder
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=20190927003223.GA22473@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=christian.couder@gmail.com \
--cc=emilyshaffer@google.com \
--cc=git@vger.kernel.org \
/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).