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

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

 



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@xxxxxxxxxxx>'"
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

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]