git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v4] fetch-pack: support negotiation tip whitelist

From
Duy Nguyen <pclouds@gmail.com>
Date
Jul 22, 2018, 09:09 UTC
Message-ID
<CACsJy8A02Au1ROU3_B1EmPnAHaRSBDJKNr9UeBSn0D7g=o4mZA@mail.gmail.com>
In-Reply-To
<20180702223944.224755-1-jonathantanmy@google.com>
On Tue, Jul 3, 2018 at 12:41 AM Jonathan Tan <jonathantanmy@google.com> wrote:
Show 12 quoted lines
> +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
Show 27 quoted lines
> +                       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
Previous: Jonathan TanNext: Ævar Arnfjörð Bjarmason
Message 12 of 14 in “fetch-pack: support negotiation tip whitelist”
  1. fetch-pack: support negotiation tip whitelistJonathan Tan, Jun 25, 2018
  2. Jonathan NiederJun 26, 2018
  3. Junio C HamanoJun 26, 2018
  4. fetch-pack: support negotiation tip whitelistJonathan Tan, Jun 27, 2018
  5. Brandon WilliamsJun 28, 2018
  6. Jonathan TanJun 28, 2018
  7. Brandon WilliamsJun 28, 2018
  8. fetch-pack: support negotiation tip whitelistJonathan Tan, Jun 28, 2018
  9. Brandon WilliamsJun 28, 2018
  10. Junio C HamanoJun 29, 2018
  11. fetch-pack: support negotiation tip whitelistJonathan Tan, Jul 2, 2018
  12. Duy NguyenJul 22, 2018
  13. Ævar Arnfjörð BjarmasonJun 18, 2019
  14. Jonathan TanJun 18, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.