All of lore.kernel.org
 help / color / mirror / Atom feed
* Escape character for .gitconfig
@ 2011-12-17 10:10 Erik Blake
  2011-12-17 10:58 ` Jeff King
  2011-12-21 12:54 ` Peter Krefting
  0 siblings, 2 replies; 9+ messages in thread
From: Erik Blake @ 2011-12-17 10:10 UTC (permalink / raw)
  To: git

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

As you can see, I'm running git on a Win7 64 machine. Is there any way 
to escape the brackets? Or do I need to reinstall notepad++ on a 
different path?

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Escape character for .gitconfig
  2011-12-17 10:10 Escape character for .gitconfig Erik Blake
@ 2011-12-17 10:58 ` Jeff King
  2011-12-18  7:53   ` Erik Blake
  2011-12-21 12:54 ` Peter Krefting
  1 sibling, 1 reply; 9+ messages in thread
From: Jeff King @ 2011-12-17 10:58 UTC (permalink / raw)
  To: Erik Blake; +Cc: git

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Escape character for .gitconfig
  2011-12-17 10:58 ` Jeff King
@ 2011-12-18  7:53   ` Erik Blake
  2011-12-18  9:51     ` Jeff King
  0 siblings, 1 reply; 9+ messages in thread
From: Erik Blake @ 2011-12-18  7:53 UTC (permalink / raw)
  To: Jeff King; +Cc: git

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Escape character for .gitconfig
  2011-12-18  7:53   ` Erik Blake
@ 2011-12-18  9:51     ` Jeff King
  2011-12-19 15:59       ` Dirk Süsserott
  0 siblings, 1 reply; 9+ messages in thread
From: Jeff King @ 2011-12-18  9:51 UTC (permalink / raw)
  To: Erik Blake; +Cc: git

On Sun, Dec 18, 2011 at 08:53:09AM +0100, Erik Blake wrote:

> 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.

Yeah, if you are using "git config" to enter it on the command line,
you'll have to put an extra layer of quoting around it to pass it
through the shell you're currently running. That's why I showed the
example as the actual config file text. :)

> 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

Yep. This is a general problem with editors that open files in an
existing session. The only signal git has of the user being done editing
is when when the editor process exits. For many editors, there is an
option or other trick for sticking around until the file is closed.

I know nothing about notepad++, but a quick google turned up the
"-multiInst" option, which would avoid attaching to the existing
instance. That might work for you.

-Peff

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Escape character for .gitconfig
  2011-12-18  9:51     ` Jeff King
@ 2011-12-19 15:59       ` Dirk Süsserott
  2011-12-20  8:04         ` Erik Blake
  0 siblings, 1 reply; 9+ messages in thread
From: Dirk Süsserott @ 2011-12-19 15:59 UTC (permalink / raw)
  To: Jeff King; +Cc: Erik Blake, git

Am 18.12.2011 10:51 schrieb Jeff King:
> On Sun, Dec 18, 2011 at 08:53:09AM +0100, Erik Blake wrote:
> 
[...]
>> 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
[...]
> 
> I know nothing about notepad++, but a quick google turned up the
> "-multiInst" option, which would avoid attaching to the existing
> instance. That might work for you.
> 
> -Peff

Jeff is right! I also use notepad++ and have set

export GIT_EDITOR='notepad++ -multiInst'

in my .bashrc (msysGit). And btw: notepad++ DOES handle cr/lf. Look at
the "Format" menu.

    Dirk

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Escape character for .gitconfig
  2011-12-19 15:59       ` Dirk Süsserott
@ 2011-12-20  8:04         ` Erik Blake
  2011-12-20 19:46           ` Dirk Süsserott
  0 siblings, 1 reply; 9+ messages in thread
From: Erik Blake @ 2011-12-20  8:04 UTC (permalink / raw)
  To: Dirk Süsserott; +Cc: Jeff King, git

Hi Dirk,

I ended up using "'C:/Program Files (x86)/Notepad++/notepad++.exe' 
-multiInst -notabbar -nosession -noPlugin" which works nicely for me 
(note the placement of the inner quotations).

It is notepad.exe (the default Windows editor) that fails on files with 
only <lf> termination. That's why I was trying to set notepad++ as the 
git editor as it is vastly superior.

Cheers,
Erik

On 2011-12-19 16:59, Dirk Süsserott wrote:
> Am 18.12.2011 10:51 schrieb Jeff King:
>> On Sun, Dec 18, 2011 at 08:53:09AM +0100, Erik Blake wrote:
>>
> [...]
>>> 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
> [...]
>> I know nothing about notepad++, but a quick google turned up the
>> "-multiInst" option, which would avoid attaching to the existing
>> instance. That might work for you.
>>
>> -Peff
> Jeff is right! I also use notepad++ and have set
>
> export GIT_EDITOR='notepad++ -multiInst'
>
> in my .bashrc (msysGit). And btw: notepad++ DOES handle cr/lf. Look at
> the "Format" menu.
>
>      Dirk

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Escape character for .gitconfig
  2011-12-20  8:04         ` Erik Blake
@ 2011-12-20 19:46           ` Dirk Süsserott
  0 siblings, 0 replies; 9+ messages in thread
From: Dirk Süsserott @ 2011-12-20 19:46 UTC (permalink / raw)
  To: Erik Blake; +Cc: git

Am 20.12.2011 09:04 schrieb Erik Blake:
> Hi Dirk,
>
> I ended up using "'C:/Program Files (x86)/Notepad++/notepad++.exe'
> -multiInst -notabbar -nosession -noPlugin" which works nicely for me
> (note the placement of the inner quotations).
>
> It is notepad.exe (the default Windows editor) that fails on files with
> only <lf> termination. That's why I was trying to set notepad++ as the
> git editor as it is vastly superior.
>
> Cheers,
> Erik

Hi Erik,

oops, I overread that you talked about notepad (not notepad++) and the
<lf> stuff. My fault. I use the portable version of notepad++ and don't
have the "space in path" problem. But if you mainly use the git-bash (as
I do) instead of cmd.exe, then probably you could tweak your .bashrc:

export PATH="/C:/Program Files (x86)/Notepad++":$PATH

and then run notepad++ w/o giving the absolute path.

Cheers,
    Dirk

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Escape character for .gitconfig
  2011-12-17 10:10 Escape character for .gitconfig Erik Blake
  2011-12-17 10:58 ` Jeff King
@ 2011-12-21 12:54 ` Peter Krefting
  2011-12-21 13:59   ` demerphq
  1 sibling, 1 reply; 9+ messages in thread
From: Peter Krefting @ 2011-12-21 12:54 UTC (permalink / raw)
  To: Erik Blake; +Cc: Git Mailing List

Erik Blake:

> As you can see, I'm running git on a Win7 64 machine. Is there any way to 
> escape the brackets? Or do I need to reinstall notepad++ on a different path?

Just use the 8.3 path instead, using either "C:/Progra~1" or "C:/Progra~2" 
(depending on how the system got installed). You can mix 8.3 and long paths 
in the same command (so keeping the "Notepad++" component is fine).

-- 
\\// Peter - http://www.softwolves.pp.se/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Escape character for .gitconfig
  2011-12-21 12:54 ` Peter Krefting
@ 2011-12-21 13:59   ` demerphq
  0 siblings, 0 replies; 9+ messages in thread
From: demerphq @ 2011-12-21 13:59 UTC (permalink / raw)
  To: Peter Krefting; +Cc: Erik Blake, Git Mailing List

On 21 December 2011 13:54, Peter Krefting <peter@softwolves.pp.se> wrote:
> Erik Blake:
>
>
>> As you can see, I'm running git on a Win7 64 machine. Is there any way to
>> escape the brackets? Or do I need to reinstall notepad++ on a different
>> path?
>
>
> Just use the 8.3 path instead, using either "C:/Progra~1" or "C:/Progra~2"
> (depending on how the system got installed). You can mix 8.3 and long paths
> in the same command (so keeping the "Notepad++" component is fine).

Or use a junction to make an alias of the name without strange chars....

Yves


-- 
perl -Mre=debug -e "/just|another|perl|hacker/"

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-12-21 13:59 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-17 10:10 Escape character for .gitconfig Erik Blake
2011-12-17 10:58 ` Jeff King
2011-12-18  7:53   ` Erik Blake
2011-12-18  9:51     ` Jeff King
2011-12-19 15:59       ` Dirk Süsserott
2011-12-20  8:04         ` Erik Blake
2011-12-20 19:46           ` Dirk Süsserott
2011-12-21 12:54 ` Peter Krefting
2011-12-21 13:59   ` demerphq

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.