git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Brandon Williams <bmwill@google.com>
To: Jonathan Nieder <jrnieder@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 2/2] remote-curl: allow push options
Date: Wed, 22 Mar 2017 15:13:12 -0700	[thread overview]
Message-ID: <20170322221312.GD11254@google.com> (raw)
In-Reply-To: <20170322213826.GC26108@aiede.mtv.corp.google.com>

On 03/22, Jonathan Nieder wrote:

I agree with most of these changes,  I'll make them locally and send out
a reroll.

> Brandon Williams wrote:
> 
> > --- a/builtin/send-pack.c
> > +++ b/builtin/send-pack.c
> > @@ -152,6 +152,7 @@ int cmd_send_pack(int argc, const char **argv, const char *prefix)
> >  	int progress = -1;
> >  	int from_stdin = 0;
> >  	struct push_cas_option cas = {0};
> > +	struct string_list push_options = STRING_LIST_INIT_DUP;
> 
> It's safe for this to be NODUP, since the strings added to it live in
> argv.
> 
> >  
> >  	struct option options[] = {
> >  		OPT__VERBOSITY(&verbose),
> > @@ -171,6 +172,9 @@ int cmd_send_pack(int argc, const char **argv, const char *prefix)
> >  		OPT_BOOL(0, "stateless-rpc", &stateless_rpc, N_("use stateless RPC protocol")),
> >  		OPT_BOOL(0, "stdin", &from_stdin, N_("read refs from stdin")),
> >  		OPT_BOOL(0, "helper-status", &helper_status, N_("print status from remote helper")),
> > +		OPT_STRING_LIST('o', "push-option", &push_options,
> > +				N_("server-specific"),
> > +				N_("option to transmit")),
> 
> Does this need the short-and-sweet option name 'o'?  For this command,
> I think I'd prefer giving it no short name.
> 
> Should this option be documented in the manpage, too?
> 
> [...]
> > --- a/remote-curl.c
> > +++ b/remote-curl.c
> > @@ -22,6 +22,7 @@ struct options {
> >  	unsigned long depth;
> >  	char *deepen_since;
> >  	struct string_list deepen_not;
> > +	struct string_list push_options;
> >  	unsigned progress : 1,
> >  		check_self_contained_and_connected : 1,
> >  		cloning : 1,
> > @@ -139,6 +140,9 @@ static int set_option(const char *name, const char *value)
> >  		else
> >  			return -1;
> >  		return 0;
> > +	} else if (!strcmp(name, "push-option")) {
> > +		string_list_append(&options.push_options, value);
> > +		return 0;
> 
> push_options has strdup_strings enabled so this takes ownership of a
> copy of value.  Good.
> 
> [...]
> > --- a/t/t5545-push-options.sh
> > +++ b/t/t5545-push-options.sh
> > @@ -102,7 +102,9 @@ test_expect_success 'two push options work' '
> >  	test_cmp expect upstream/.git/hooks/post-receive.push_options
> >  '
> >  
> > -test_expect_success 'push option denied properly by http remote helper' '\
> > +test_expect_success 'push option denied properly by http server' '
> 
> Should this test use test_i18ngrep to check that the error message
> diagnoses the problem correctly instead of hitting an unrelated error
> condition?
> 
> [...]
> > @@ -113,6 +115,32 @@ test_expect_success 'push option denied properly by http remote helper' '\
> >  	git -C test_http_clone push origin master
> >  '
> >  
> > +test_expect_success 'push options work properly across http' '
> 
> Nice.
> 
> Tested-by: Jonathan Nieder <jrnieder@gmail.com>
> 
> With whatever subset of the following changes seems sensible to you
> squashed in,
> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
> 
> Thanks.
> 
> diff --git i/Documentation/git-send-pack.txt w/Documentation/git-send-pack.txt
> index a831dd0288..966abb0df8 100644
> --- i/Documentation/git-send-pack.txt
> +++ w/Documentation/git-send-pack.txt
> @@ -81,6 +81,12 @@ be in a separate packet, and the list must end with a flush packet.
>  	will also fail if the actual call to `gpg --sign` fails.  See
>  	linkgit:git-receive-pack[1] for the details on the receiving end.
>  
> +--push-option=<string>::
> +	Pass the specified string as a push option for consumption by
> +	hooks on the server side.  If the server doesn't support push
> +	options, error out.  See linkgit:git-push[1] and
> +	linkgit:githooks[5] for details.
> +
>  <host>::
>  	A remote host to house the repository.  When this
>  	part is specified, 'git-receive-pack' is invoked via
> diff --git i/builtin/send-pack.c w/builtin/send-pack.c
> index 6796f33687..832fd7ed0a 100644
> --- i/builtin/send-pack.c
> +++ w/builtin/send-pack.c
> @@ -144,6 +144,7 @@ int cmd_send_pack(int argc, const char **argv, const char *prefix)
>  	unsigned force_update = 0;
>  	unsigned quiet = 0;
>  	int push_cert = 0;
> +	struct string_list push_options = STRING_LIST_INIT_NODUP;
>  	unsigned use_thin_pack = 0;
>  	unsigned atomic = 0;
>  	unsigned stateless_rpc = 0;
> @@ -152,7 +153,6 @@ int cmd_send_pack(int argc, const char **argv, const char *prefix)
>  	int progress = -1;
>  	int from_stdin = 0;
>  	struct push_cas_option cas = {0};
> -	struct string_list push_options = STRING_LIST_INIT_DUP;
>  
>  	struct option options[] = {
>  		OPT__VERBOSITY(&verbose),
> @@ -166,15 +166,15 @@ int cmd_send_pack(int argc, const char **argv, const char *prefix)
>  		{ OPTION_CALLBACK,
>  		  0, "signed", &push_cert, "yes|no|if-asked", N_("GPG sign the push"),
>  		  PARSE_OPT_OPTARG, option_parse_push_signed },
> +		OPT_STRING_LIST(0, "push-option", &push_options,
> +				N_("server-specific"),
> +				N_("option to transmit")),
>  		OPT_BOOL(0, "progress", &progress, N_("force progress reporting")),
>  		OPT_BOOL(0, "thin", &use_thin_pack, N_("use thin pack")),
>  		OPT_BOOL(0, "atomic", &atomic, N_("request atomic transaction on remote side")),
>  		OPT_BOOL(0, "stateless-rpc", &stateless_rpc, N_("use stateless RPC protocol")),
>  		OPT_BOOL(0, "stdin", &from_stdin, N_("read refs from stdin")),
>  		OPT_BOOL(0, "helper-status", &helper_status, N_("print status from remote helper")),
> -		OPT_STRING_LIST('o', "push-option", &push_options,
> -				N_("server-specific"),
> -				N_("option to transmit")),
>  		{ OPTION_CALLBACK,
>  		  0, CAS_OPT_NAME, &cas, N_("refname>:<expect"),
>  		  N_("require old value of ref to be at this value"),

-- 
Brandon Williams

  reply	other threads:[~2017-03-22 22:13 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-22 19:51 [PATCH 0/2] push options across http Brandon Williams
2017-03-22 19:51 ` [PATCH 1/2] send-pack: send push options correctly in stateless-rpc case Brandon Williams
2017-03-22 21:15   ` Jonathan Nieder
2017-03-22 22:19     ` Brandon Williams
2017-03-22 19:51 ` [PATCH 2/2] remote-curl: allow push options Brandon Williams
2017-03-22 21:26   ` Junio C Hamano
2017-03-22 21:36     ` Brandon Williams
2017-03-22 21:38   ` Jonathan Nieder
2017-03-22 22:13     ` Brandon Williams [this message]
2017-03-22 21:17 ` [PATCH 0/2] push options across http Junio C Hamano
2017-03-22 21:20   ` Stefan Beller
2017-03-22 22:21 ` [PATCH v2 " Brandon Williams
2017-03-22 22:21   ` [PATCH v2 1/2] send-pack: send push options correctly in stateless-rpc case Brandon Williams
2017-03-22 22:22   ` [PATCH v2 2/2] remote-curl: allow push options Brandon Williams
2017-03-22 22:29   ` [PATCH v2 0/2] push options across http Jonathan Nieder

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=20170322221312.GD11254@google.com \
    --to=bmwill@google.com \
    --cc=git@vger.kernel.org \
    --cc=jrnieder@gmail.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.
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).