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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Stefan Beller <sbeller@xxxxxxxxxx> 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"?

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.

... 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.

>  	} else {
>  		struct transport *transport =
>  			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.

> @@ -533,6 +542,7 @@ int cmd_push(int argc, const char **argv, const char *prefix)
>  		  0, "signed", &push_cert, "yes|no|if-asked", N_("GPG sign the push"),
>  		  PARSE_OPT_OPTARG, option_parse_push_signed },
>  		OPT_BIT(0, "atomic", &flags, N_("request atomic transaction on remote side"), TRANSPORT_PUSH_ATOMIC),
> +		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.

> diff --git a/send-pack.c b/send-pack.c
> index 299d303..c943560 100644
> --- a/send-pack.c
> +++ b/send-pack.c
> @@ -260,6 +260,7 @@ static int generate_push_cert(struct strbuf *req_buf,
>  			      const char *push_cert_nonce)
>  {
>  	const struct ref *ref;
> +	struct string_list_item *item;
>  	char *signing_key = xstrdup(get_signing_key());
>  	const char *cp, *np;
>  	struct strbuf cert = STRBUF_INIT;
> @@ -278,6 +279,12 @@ static int generate_push_cert(struct strbuf *req_buf,
>  		strbuf_addf(&cert, "nonce %s\n", push_cert_nonce);
>  	strbuf_addstr(&cert, "\n");
>  
> +	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");

Why the extra blank?

I would actually have expected to see

	certificate version ...
        pusher ...
        <datestamp>
	pushee ...	# optional
        nonce ...	# optional
        push-option ... # optional
        push-option ... # optional

        <old> <new> <name>
        ...

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");

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]