Re: [PATCH] Allow passing of --directory to git-am.

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

 



Simon 'corecode' Schubert wrote:
> Jakub Narebski wrote:
>> Simon 'corecode' Schubert wrote:
 
>>> @@ -155,8 +156,9 @@ do
>>>   		;;
>>>   	--resolvemsg)
>>>   		shift; resolvemsg=$1 ;;
>>> -	--whitespace)
>>> -		git_apply_opt="$git_apply_opt $1=$2"; shift ;;
>>> +	--whitespace|--directory)
>>> +		quot=$(echo "$2" | sed -e "s/'/'\\\''/g")
>> 
>> Why not simply use "git rev-parse --sq"?
> 
> What I need is to convert $2 into a form suitable for quoting, does git 
> rev-parse --sq do that?

  $ git rev-parse --sq -- "don't do that"
  '--' 'don'\''t do that'

Without terminating newline. The '--' is needed because otherwise
git-rev-parse expects revisions... and doesn't find any.
 
By the way you could both simplify option parsing _and_ take care of
proper quoting by using --parseopt, i.e. use git-rev-parse in PARSEOPT
mode. But that is more involved change.

>>> @@ -454,7 +456,7 @@ do
>>>
>>>   	case "$resolved" in
>>>   	'')
>>> -		git apply $git_apply_opt --index "$dotest/patch"
>>> +		eval git apply $git_apply_opt --index '"$dotest/patch"'
>>
>> Why eval?
> 
> I quoted the above variable, so I now need to unquote it, that's done by eval.

Ah.
-- 
Jakub Narebski
Poland
--
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]

  Powered by Linux