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

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

From
Jakub Narebski <jnareb@gmail.com>
Date
Dec 4, 2008, 22:46 UTC
Message-ID
<200812042346.33496.jnareb@gmail.com>
In-Reply-To
<493858CE.1030601@fs.ei.tum.de>
Simon 'corecode' Schubert wrote:
> Jakub Narebski wrote:
>> Simon 'corecode' Schubert wrote:
Show 13 quoted lines
>>> @@ -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.
Show 10 quoted lines
>>> @@ -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
Previous: Simon 'corecode' Schubert
Message 13 of 13 in “Allow passing of --directory to git-am.”
  1. Allow passing of --directory to git-am.Simon 'corecode' Schubert, Dec 4, 2008
  2. Jeff KingDec 4, 2008
  3. Junio C HamanoDec 4, 2008
  4. Simon 'corecode' SchubertDec 4, 2008
  5. Junio C HamanoDec 4, 2008
  6. Junio C HamanoDec 4, 2008
  7. git-am: propagate -C/-p as wellJunio C Hamano, Dec 4, 2008
  8. Simon 'corecode' SchubertDec 4, 2008
  9. Junio C HamanoDec 5, 2008
  10. Simon 'corecode' SchubertDec 5, 2008
  11. Jakub NarebskiDec 4, 2008
  12. Simon 'corecode' SchubertDec 4, 2008
  13. Jakub NarebskiDec 4, 2008

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.