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

Re: [PATCH v3 1/9] cherry-pick, revert: add the --gpg-sign option

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 3, 2014, 20:50 UTC
Message-ID
<xmqq8utrex8w.fsf@gitster.dls.corp.google.com>
In-Reply-To
<1391221086-1044384-2-git-send-email-sandals@crustytoothpaste.net>
"brian m. carlson" <sandals@crustytoothpaste.net> writes:
Show 19 quoted lines
> diff --git a/sequencer.c b/sequencer.c
> index 90cac7b..bde5f04 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);
Perhaps
	argv_array_pushf(&array, "-S%s", opts->gpg_sign);
without any temporary?  That would save 5 lines in total.
> +	}
>  	if (opts->signoff)
>  		argv_array_push(&array, "-s");
>  	if (!opts->edit) {
diff --git a/sequencer.c b/sequencer.c
index bde5f04..b200dce 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -392,18 +392,13 @@ 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->gpg_sign)
+		argv_array_pushf(&array, "-S%s", opts->gpg_sign);
 	if (opts->signoff)
 		argv_array_push(&array, "-s");
 	if (!opts->edit) {
Previous: brian m. carlsonNext: brian m. carlson
Message 3 of 15 in “add --gpg-sign to rebase and pull”
  1. 0/9 add --gpg-sign to rebase and pullbrian m. carlson, Feb 1, 2014
  2. 1/9 cherry-pick, revert: add the --gpg-sign optionbrian m. carlson, Feb 1, 2014
  3. Junio C HamanoFeb 3, 2014
  4. 2/9 git-sh-setup.sh: add variable to use the stuck-long modebrian m. carlson, Feb 1, 2014
  5. 3/9 am: parse options in stuck-long modebrian m. carlson, Feb 1, 2014
  6. 4/9 am: add the --gpg-sign optionbrian m. carlson, Feb 1, 2014
  7. 5/9 rebase: remove useless arguments checkbrian m. carlson, Feb 1, 2014
  8. 6/9 rebase: don't try to match -M optionbrian m. carlson, Feb 1, 2014
  9. 7/9 rebase: parse options in stuck-long modebrian m. carlson, Feb 1, 2014
  10. 8/9 rebase: add the --gpg-sign optionbrian m. carlson, Feb 1, 2014
  11. Junio C HamanoFeb 3, 2014
  12. brian m. carlsonFeb 7, 2014
  13. Philip OakleyFeb 8, 2014
  14. 9/9 pull: add the --gpg-sign option.brian m. carlson, Feb 1, 2014
  15. Junio C HamanoFeb 3, 2014

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.