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

Re: [PATCH 3/4] push: accept push options

From
Stefan Beller <sbeller@google.com>
Date
Jul 8, 2016, 22:59 UTC
Message-ID
<CAGZ79kbkbb=qYUYmKnuKwJCBtidymXua3eAZGANpXDHT56pqGQ@mail.gmail.com>
In-Reply-To
<xmqq60shp3w9.fsf@gitster.mtv.corp.google.com>
On Thu, Jul 7, 2016 at 1:52 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 11 quoted lines
> Stefan Beller <sbeller@google.com> writes:
>
>> +-L::
>> +--push-option::
>> +     Transmit the given string to the server, which passes them to
>> +     the pre-receive as well as the post-receive hook. Only C strings
>> +     containing no new lines are allowed.
>
> This is to affect what happens at the remote end, so I would have
> understood "-R".  I also would have understood "-P" as a short-hand
> for "--push-option".  What is the justification of "-L"?
It was made up. The actual code took -o for option. Changed that.
>
> What does "C strings" mean?  Did you mean to say "A sequence of
> bytes excluding NUL is passed verbatim"?
>
> I do not think I saw anything in the code I reviewed so far that
> requires "no LF" limitation.

It is enforced server side, but an additional client side enforcement may be better indeed.

The rationale for no enforcement on the client side is an easier way forward if we allow it on the server as the client would "just work" and it's up to the server to complain.

That makes me wonder if we want to document that, i.e.:
-o::
--push-option::
    Transmit the given argument to the server, which passes them to
    the pre-receive as well as the post-receive hook. As it is up to the
    server to react on these push options, it may reject push options
    that contain new line or NUL characters. .
Show 6 quoted lines
>
> ... Ahh, OK, you want to make sure that push-options are
> one-per-line in the push certificate.  While I do not think it is
> absolutely necessary, starting with a possibly tighter than
> necessary limitation is much better than starting loose and having
> to tighten it later.

This is not what I had in mind, but rather the pain of dealing with multi line environment variables.

Show 7 quoted lines
>>                       transport_get(remote, NULL);
>> -
>> +             if (flags & TRANSPORT_PUSH_OPTIONS)
>> +                     transport->push_options = push_options;
>
> The result would be easier to read without the removal of a blank
> that separates decl/defn and stmt here.
ok
Show 6 quoted lines
>> +             OPT_STRING_LIST('o', "push-option", &push_options, N_("server-specific"), N_("option to transmit")),
>
> Here it seems to expect "-o".  If we really want a short option,
> "-o" would probably be OK, as I do not think "git push" wants to
> have "send the output to this file" option.
>
Ok, will update the documentation.
Show 11 quoted lines
>
> by adding this between the two lines in the pre-context of this
> hunk, i.e.
>
>         if (push_cert_nonce[0])
>                 strbuf_addf(&cert, "nonce %s\n", push_cert_nonce);
>         if (args->push_options)
>                 for_each_string_list_item(item, args->push_options)
>                         strbuf_addf(&cert, "push-option %s\n", item->string);
>         strbuf_addstr(&cert, "\n");
>
makes sense.
Previous: Junio C HamanoNext: Junio C Hamano
Message 22 of 31 in “[PATCHv3 0/4] Push options in C Git”
  1. Stefan BellerJul 7, 2016
  2. 2/4 receive-pack: implement advertising and receiving push optionsStefan Beller, Jul 7, 2016
  3. Junio C HamanoJul 7, 2016
  4. Stefan BellerJul 7, 2016
  5. Jeff KingJul 7, 2016
  6. Stefan BellerJul 7, 2016
  7. Jeff KingJul 7, 2016
  8. Junio C HamanoJul 7, 2016
  9. Jonathan NiederJul 8, 2016
  10. Junio C HamanoJul 8, 2016
  11. Stefan BellerJul 8, 2016
  12. Jeff KingJul 8, 2016
  13. Stefan BellerJul 8, 2016
  14. Jeff KingJul 8, 2016
  15. Stefan BellerJul 8, 2016
  16. Jeff KingJul 8, 2016
  17. Stefan BellerJul 8, 2016
  18. Jeff KingJul 8, 2016
  19. Stefan BellerJul 8, 2016
  20. 3/4 push: accept push optionsStefan Beller, Jul 7, 2016
  21. Junio C HamanoJul 7, 2016
  22. Stefan BellerJul 8, 2016
  23. Junio C HamanoJul 11, 2016
  24. 1/4 push options: {pre,post}-receive hook learns about push optionsStefan Beller, Jul 7, 2016
  25. Junio C HamanoJul 7, 2016
  26. Stefan BellerJul 7, 2016
  27. Junio C HamanoJul 7, 2016
  28. 4/4 add a test for push optionsStefan Beller, Jul 7, 2016
  29. Junio C HamanoJul 7, 2016
  30. Junio C HamanoJul 7, 2016
  31. Stefan BellerJul 7, 2016

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.