Re: [PATCH] cherry-pick, revert: add the --gpg-sign option

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

 



On Sun, Nov 03, 2013 at 07:46:15PM +0100, Nicolas Vigier wrote:
> diff --git a/sequencer.c b/sequencer.c
> index 06e52b4c83ff..2048cd81b3b2 100644
> --- a/sequencer.c
> +++ b/sequencer.c
> @@ -392,11 +392,18 @@ static int run_git_commit(const char *defmsg, struct replay_opts *opts,
>  {
>  	struct argv_array array;
>  	int rc;
> +	char *gpg_sign;
>  
>  	argv_array_init(&array);
>  	argv_array_push(&array, "commit");
>  	argv_array_push(&array, "-n");
>  
> +	if (opts->gpg_sign) {
> +		gpg_sign = xmalloc(3 + strlen(opts->gpg_sign));
> +		sprintf(gpg_sign, "-S%s", opts->gpg_sign);
> +		argv_array_push(&array, gpg_sign);
> +		free(gpg_sign);
> +	}
>  	if (opts->signoff)
>  		argv_array_push(&array, "-s");
>  	if (!opts->edit) {
> @@ -808,6 +815,8 @@ static int populate_opts_cb(const char *key, const char *value, void *data)
>  		opts->mainline = git_config_int(key, value);
>  	else if (!strcmp(key, "options.strategy"))
>  		git_config_string(&opts->strategy, key, value);
> +	else if (!strcmp(key, "options.gpg-sign"))
> +		git_config_string(&opts->gpg_sign, key, value);
>  	else if (!strcmp(key, "options.strategy-option")) {
>  		ALLOC_GROW(opts->xopts, opts->xopts_nr + 1, opts->xopts_alloc);
>  		opts->xopts[opts->xopts_nr++] = xstrdup(value);
> @@ -981,6 +990,8 @@ static void save_opts(struct replay_opts *opts)
>  	}
>  	if (opts->strategy)
>  		git_config_set_in_file(opts_file, "options.strategy", opts->strategy);
> +	if (opts->gpg_sign)
> +		git_config_set_in_file(opts_file, "options.gpg-sign", opts->gpg_sign);
>  	if (opts->xopts) {
>  		int i;
>  		for (i = 0; i < opts->xopts_nr; i++)

Looks much better.  That's essentially what I did when I was patching
that particular area.  Thanks for posting this patch set; it's something
I've wanted for a while, but never got around to actually doing myself.

-- 
brian m. carlson / brian with sandals: Houston, Texas, US
+1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only
OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187

Attachment: signature.asc
Description: Digital signature


[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]