Subject: Re: Escape character for .gitconfig

From: Erik Blake <[email-masked]>
Date: Sun, 18 Dec 2011 08:53:09 +0100

Thanks Jeff,
That did the trick for this git newb. For the record, I had tried \(, 
/(, double- and single-quoting the entire path (note that git config 
--global had removed the quotes that were originally around the string). 
Did not think of "nested" quotes.

Now, however, I have a different problem in that notepad++ is somehow 
signalling git that editing is complete before I even get a chance to 
edit the file. I am trying the command
 >git commit --amend

Notepad++ opens with the message, but git completes the commit before I 
get a chance to make any changes. I suspect the issue is that git fires 
up a new instance of notepad++ (which in my case is already running with 
some other files open). notepad++ sees the new instance starting and 
subsumes it under the pre-existing instance and then closes the new 
instance. git sees the task close and assumes I am done editing.

Oh well. Cannot use notepad.exe because it does not handle <lf> line 
endings. I guess I'll stick to the git gui.

e.

On 2011-12-17 11:58, Jeff King wrote:
> On Sat, Dec 17, 2011 at 11:10:37AM +0100, Erik Blake wrote:
>
>> I have an editor path that includes "(" and ")". No matter how I try
>> to escape this character, I get either variations on:
>>
>> C:/Program Files (x86)/Notepad++/notepad++.exe: -c: line 0: syntax
>> error near unexpected token `('
>> C:/Program Files (x86)/Notepad++/notepad++.exe: -c: line 0:
>> `C:/Program Files (x86)/Notepad++/notepad++.exe \$@\'
>> error: There was a problem with the editor 'C:/Program Files
>> (x86)/Notepad++/notepad++.exe'.
>> Please supply the message using either -m or -F option.
>>
>> or:
>>
>> fatal: bad config file line 5 in C:\Users\xxx/.gitconfig
>
> You didn't tell us what you actually tried, so I don't know where you
> went wrong.
>
> But you will need to quote the whole value for git to read from your
> gitconfig, and then quote any metacharacters in the value so that the
> shell doesn't interpret them. I think you want:
>
>    [core]
>      editor = "'C:/Program Files (x86)/Notepad++/notepad++.exe'"
>
> -Peff