From: Duy Nguyen <pclouds@gmail.com>
To: Jonathan Tan <jonathantanmy@google.com>
Cc: Git Mailing List <git@vger.kernel.org>,
Brandon Williams <bmwill@google.com>,
Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH v4] fetch-pack: support negotiation tip whitelist
Date: Sun, 22 Jul 2018 11:09:22 +0200 [thread overview]
Message-ID: <CACsJy8A02Au1ROU3_B1EmPnAHaRSBDJKNr9UeBSn0D7g=o4mZA@mail.gmail.com> (raw)
In-Reply-To: <20180702223944.224755-1-jonathantanmy@google.com>
On Tue, Jul 3, 2018 at 12:41 AM Jonathan Tan <jonathantanmy@google.com> wrote:
> +static void add_negotiation_tips(struct git_transport_options *smart_options)
> +{
> + struct oid_array *oids = xcalloc(1, sizeof(*oids));
> + int i;
> +
> + for (i = 0; i < negotiation_tip.nr; i++) {
> + const char *s = negotiation_tip.items[i].string;
> + int old_nr;
> + if (!has_glob_specials(s)) {
> + struct object_id oid;
> + if (get_oid(s, &oid))
> + die("%s is not a valid object", s);
Please _() this string and the warning() below
> + oid_array_append(oids, &oid);
> + continue;
> + }
> + old_nr = oids->nr;
> + for_each_glob_ref(add_oid, s, oids);
> + if (old_nr == oids->nr)
> + warning("Ignoring --negotiation-tip=%s because it does not match any refs",
> + s);
> + }
> + smart_options->negotiation_tips = oids;
> +}
> +
> static struct transport *prepare_transport(struct remote *remote, int deepen)
> {
> struct transport *transport;
> @@ -1075,6 +1112,12 @@ static struct transport *prepare_transport(struct remote *remote, int deepen)
> filter_options.filter_spec);
> set_option(transport, TRANS_OPT_FROM_PROMISOR, "1");
> }
> + if (negotiation_tip.nr) {
> + if (transport->smart_options)
> + add_negotiation_tips(transport->smart_options);
> + else
> + warning("Ignoring --negotiation-tip because the protocol does not support it.");
> + }
> return transport;
> }
--
Duy
next prev parent reply other threads:[~2018-07-22 9:09 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-25 19:37 [PATCH] fetch-pack: support negotiation tip whitelist Jonathan Tan
2018-06-26 17:53 ` Jonathan Nieder
2018-06-26 18:59 ` Junio C Hamano
2018-06-27 18:28 ` [PATCH v2] " Jonathan Tan
2018-06-28 15:56 ` Brandon Williams
2018-06-28 16:12 ` Jonathan Tan
2018-06-28 16:16 ` Brandon Williams
2018-06-28 22:15 ` [PATCH v3] " Jonathan Tan
2018-06-28 22:20 ` Brandon Williams
2018-06-29 16:28 ` Junio C Hamano
2018-07-02 22:39 ` [PATCH v4] " Jonathan Tan
2018-07-22 9:09 ` Duy Nguyen [this message]
2019-06-18 13:36 ` Ævar Arnfjörð Bjarmason
2019-06-18 17:30 ` Jonathan Tan
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CACsJy8A02Au1ROU3_B1EmPnAHaRSBDJKNr9UeBSn0D7g=o4mZA@mail.gmail.com' \
--to=pclouds@gmail.com \
--cc=bmwill@google.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jonathantanmy@google.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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).