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

Re: [PATCH v3 8/9] rebase: add the --gpg-sign option

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Feb 7, 2014, 23:50 UTC
Message-ID
<20140207235058.GJ635004@vauxhall.crustytoothpaste.net>
In-Reply-To
<xmqqlhxrdgb5.fsf@gitster.dls.corp.google.com>
On Mon, Feb 03, 2014 at 01:42:06PM -0800, Junio C Hamano wrote:
Show 17 quoted lines
> > +	--gpg-sign)
> > +		gpg_sign_opt=-S
> > +		;;
> > +	--gpg-sign=*)
> > +		# Try to quote only the argument, as this will appear in human-readable
> > +		# output as well as being passed to commands.
> > +		gpg_sign_opt="-S$(git rev-parse --sq-quote "${1#--gpg-sign=}" |
> > +			sed 's/^ //')"
> 
> Isn't an invocation of sed excessive?
> 
> 	gpg_sign_opt=$(git rev-parse --sq-quote "${1#--gpg-sign=}") &&
> 	gpg_sign_opt=-S${gpg_sign_opt# }
> 
> if you really need to strip the leading SP, which I do not think is
> a necessary thing to do.  It is sufficient to remove the SP before
> the variable substitution in the human-readable messages, e.g.

I'm not sure that command line parsing of "-S 'foo <x@example.tld>'" will work exactly as expected due to the fact that -S doesn't always take an argument. Your suggestion to use # seems fine, though.

I'm a little embarrassed to admit that in my fifteen years of Unix experience, I've never learned the variable modifiers for shell, so it didn't occur to me to use them in this case. Guess it's time to learn them now.

-- 
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
Previous: Junio C HamanoNext: Philip Oakley
Message 12 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.