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
Philip Oakley <philipoakley@iee.org>
Date
Feb 8, 2014, 13:04 UTC
Message-ID
<52F62B49.7080709@iee.org>
In-Reply-To
<20140207235058.GJ635004@vauxhall.crustytoothpaste.net>
On 07/02/14 23:50, brian m. carlson wrote:
Show 27 quoted lines
> On Mon, Feb 03, 2014 at 01:42:06PM -0800, Junio C Hamano wrote:
>>> +	--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.
Same here:

For other readers, I found most google results were only partial on the issue, missing the '#' symbol option. Here's a more complete ref http://www.gnu.org/software/bash/manual/bashref.html#Shell-Parameter-Expansion-1 for fellow learners.

Philip --

>
Previous: brian m. carlsonNext: brian m. carlson
Message 13 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.