Re: [PATCH 1/2] submodule: preserve all arguments exactly when recursing

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

 



On Nov 2, 2010, at 9:37 PM, Jonathan Nieder wrote:

> Hi Kevin,
> 
> Kevin Ballard wrote:
> 
>>           It's also a reasonable model for how to handle this problem
>> in other shell commands.
> 
> This caught my attention. :)
> 
>> +# Emit a quoted version of the all argument suitable for passing to `eval`
>> +# $@ = words to quote
>> +#
>> +# This is intended to be used like the following:
>> +#   orig_args="$(quote_words "$@")"
>> +#   # do some work that includes calling shift
>> +#   eval "set - $orig_args"
>> +#   # now $@ has been restored, suitable for passing to another command
>> +#
>> +# Note that you cannot simply save off $@ into another variable because
>> +# the shell gives $@ and $* special handling in parameter expansion
>> +#
>> +quote_words ()
> 
> Have you looked into "git rev-parse --sq-quote"?

Well crud, I wish I'd seen that before. Looks like it does pretty much the
exact same thing as my quote_words function. I'll send out another patch
that uses this instead of quote_words. Thanks for the info!

-Kevin Ballard--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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