{"thread":{"id":"29196","subject":"Escape character for .gitconfig","startedAt":"2011-12-17T10:10:37Z","lastAt":"2011-12-21T13:59:01Z","messageCount":9,"participants":["Erik Blake","Jeff King","Dirk Süsserott","Peter Krefting","demerphq"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"181391","messageId":"4EEC6A9D.1060005@icefield.yk.ca","threadId":"29196","inReplyTo":null,"subject":"Escape character for .gitconfig","fromName":"Erik Blake","fromEmail":"erik@icefield.yk.ca","sentAt":"2011-12-17T10:10:37Z","receivedAt":"2011-12-17T10:10:37Z","isPatch":false,"sender":{"key":"erik@icefield.yk.ca","avatar":null},"body":"I have an editor path that includes \"(\" and \")\". No matter how I try to \nescape this character, I get either variations on:\n\nC:/Program Files (x86)/Notepad++/notepad++.exe: -c: line 0: syntax error \nnear unexpected token `('\nC:/Program Files (x86)/Notepad++/notepad++.exe: -c: line 0: `C:/Program \nFiles (x86)/Notepad++/notepad++.exe \\$@\\'\nerror: There was a problem with the editor 'C:/Program Files \n(x86)/Notepad++/notepad++.exe'.\nPlease supply the message using either -m or -F option.\n\nor:\n\nfatal: bad config file line 5 in C:\\Users\\xxx/.gitconfig\n\nAs you can see, I'm running git on a Win7 64 machine. Is there any way \nto escape the brackets? Or do I need to reinstall notepad++ on a \ndifferent path?\n"},{"id":"181393","messageId":"20111217105806.GB23935@sigill.intra.peff.net","threadId":"29196","inReplyTo":"4EEC6A9D.1060005@icefield.yk.ca","subject":"Re: Escape character for .gitconfig","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2011-12-17T10:58:06Z","receivedAt":"2011-12-17T10:58:06Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sat, Dec 17, 2011 at 11:10:37AM +0100, Erik Blake wrote:\n\n> I have an editor path that includes \"(\" and \")\". No matter how I try\n> to escape this character, I get either variations on:\n> \n> C:/Program Files (x86)/Notepad++/notepad++.exe: -c: line 0: syntax\n> error near unexpected token `('\n> C:/Program Files (x86)/Notepad++/notepad++.exe: -c: line 0:\n> `C:/Program Files (x86)/Notepad++/notepad++.exe \\$@\\'\n> error: There was a problem with the editor 'C:/Program Files\n> (x86)/Notepad++/notepad++.exe'.\n> Please supply the message using either -m or -F option.\n> \n> or:\n> \n> fatal: bad config file line 5 in C:\\Users\\xxx/.gitconfig\n\nYou didn't tell us what you actually tried, so I don't know where you\nwent wrong.\n\nBut you will need to quote the whole value for git to read from your\ngitconfig, and then quote any metacharacters in the value so that the\nshell doesn't interpret them. I think you want:\n\n  [core]\n    editor = \"'C:/Program Files (x86)/Notepad++/notepad++.exe'\"\n\n-Peff\n"},{"id":"181432","messageId":"4EED9BE5.8060600@icefield.yk.ca","threadId":"29196","inReplyTo":"20111217105806.GB23935@sigill.intra.peff.net","subject":"Re: Escape character for .gitconfig","fromName":"Erik Blake","fromEmail":"erik@icefield.yk.ca","sentAt":"2011-12-18T07:53:09Z","receivedAt":"2011-12-18T07:53:09Z","isPatch":false,"sender":{"key":"erik@icefield.yk.ca","avatar":null},"body":"Thanks Jeff,\nThat did the trick for this git newb. For the record, I had tried \\(, \n/(, double- and single-quoting the entire path (note that git config \n--global had removed the quotes that were originally around the string). \nDid not think of \"nested\" quotes.\n\nNow, however, I have a different problem in that notepad++ is somehow \nsignalling git that editing is complete before I even get a chance to \nedit the file. I am trying the command\n >git commit --amend\n\nNotepad++ opens with the message, but git completes the commit before I \nget a chance to make any changes. I suspect the issue is that git fires \nup a new instance of notepad++ (which in my case is already running with \nsome other files open). notepad++ sees the new instance starting and \nsubsumes it under the pre-existing instance and then closes the new \ninstance. git sees the task close and assumes I am done editing.\n\nOh well. Cannot use notepad.exe because it does not handle <lf> line \nendings. I guess I'll stick to the git gui.\n\ne.\n\nOn 2011-12-17 11:58, Jeff King wrote:\n> On Sat, Dec 17, 2011 at 11:10:37AM +0100, Erik Blake wrote:\n>\n>> I have an editor path that includes \"(\" and \")\". No matter how I try\n>> to escape this character, I get either variations on:\n>>\n>> C:/Program Files (x86)/Notepad++/notepad++.exe: -c: line 0: syntax\n>> error near unexpected token `('\n>> C:/Program Files (x86)/Notepad++/notepad++.exe: -c: line 0:\n>> `C:/Program Files (x86)/Notepad++/notepad++.exe \\$@\\'\n>> error: There was a problem with the editor 'C:/Program Files\n>> (x86)/Notepad++/notepad++.exe'.\n>> Please supply the message using either -m or -F option.\n>>\n>> or:\n>>\n>> fatal: bad config file line 5 in C:\\Users\\xxx/.gitconfig\n>\n> You didn't tell us what you actually tried, so I don't know where you\n> went wrong.\n>\n> But you will need to quote the whole value for git to read from your\n> gitconfig, and then quote any metacharacters in the value so that the\n> shell doesn't interpret them. I think you want:\n>\n>    [core]\n>      editor = \"'C:/Program Files (x86)/Notepad++/notepad++.exe'\"\n>\n> -Peff\n"},{"id":"181433","messageId":"20111218095120.GA2290@sigill.intra.peff.net","threadId":"29196","inReplyTo":"4EED9BE5.8060600@icefield.yk.ca","subject":"Re: Escape character for .gitconfig","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2011-12-18T09:51:20Z","receivedAt":"2011-12-18T09:51:20Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sun, Dec 18, 2011 at 08:53:09AM +0100, Erik Blake wrote:\n\n> That did the trick for this git newb. For the record, I had tried \\(,\n> /(, double- and single-quoting the entire path (note that git config\n> --global had removed the quotes that were originally around the\n> string). Did not think of \"nested\" quotes.\n\nYeah, if you are using \"git config\" to enter it on the command line,\nyou'll have to put an extra layer of quoting around it to pass it\nthrough the shell you're currently running. That's why I showed the\nexample as the actual config file text. :)\n\n> Now, however, I have a different problem in that notepad++ is somehow\n> signalling git that editing is complete before I even get a chance to\n> edit the file. I am trying the command\n> >git commit --amend\n\nYep. This is a general problem with editors that open files in an\nexisting session. The only signal git has of the user being done editing\nis when when the editor process exits. For many editors, there is an\noption or other trick for sticking around until the file is closed.\n\nI know nothing about notepad++, but a quick google turned up the\n\"-multiInst\" option, which would avoid attaching to the existing\ninstance. That might work for you.\n\n-Peff\n"},{"id":"181469","messageId":"4EEF5F59.8030802@dirk.my1.cc","threadId":"29196","inReplyTo":"20111218095120.GA2290@sigill.intra.peff.net","subject":"Re: Escape character for .gitconfig","fromName":"Dirk Süsserott","fromEmail":"newsletter@dirk.my1.cc","sentAt":"2011-12-19T15:59:21Z","receivedAt":"2011-12-19T15:59:21Z","isPatch":false,"sender":{"key":"newsletter@dirk.my1.cc","avatar":null},"body":"Am 18.12.2011 10:51 schrieb Jeff King:\n> On Sun, Dec 18, 2011 at 08:53:09AM +0100, Erik Blake wrote:\n> \n[...]\n>> Now, however, I have a different problem in that notepad++ is somehow\n>> signalling git that editing is complete before I even get a chance to\n>> edit the file. I am trying the command\n>>> git commit --amend\n[...]\n> \n> I know nothing about notepad++, but a quick google turned up the\n> \"-multiInst\" option, which would avoid attaching to the existing\n> instance. That might work for you.\n> \n> -Peff\n\nJeff is right! I also use notepad++ and have set\n\nexport GIT_EDITOR='notepad++ -multiInst'\n\nin my .bashrc (msysGit). And btw: notepad++ DOES handle cr/lf. Look at\nthe \"Format\" menu.\n\n    Dirk\n"},{"id":"181517","messageId":"4EF04199.1010008@icefield.yk.ca","threadId":"29196","inReplyTo":"4EEF5F59.8030802@dirk.my1.cc","subject":"Re: Escape character for .gitconfig","fromName":"Erik Blake","fromEmail":"erik@icefield.yk.ca","sentAt":"2011-12-20T08:04:41Z","receivedAt":"2011-12-20T08:04:41Z","isPatch":false,"sender":{"key":"erik@icefield.yk.ca","avatar":null},"body":"Hi Dirk,\n\nI ended up using \"'C:/Program Files (x86)/Notepad++/notepad++.exe' \n-multiInst -notabbar -nosession -noPlugin\" which works nicely for me \n(note the placement of the inner quotations).\n\nIt is notepad.exe (the default Windows editor) that fails on files with \nonly <lf> termination. That's why I was trying to set notepad++ as the \ngit editor as it is vastly superior.\n\nCheers,\nErik\n\nOn 2011-12-19 16:59, Dirk Süsserott wrote:\n> Am 18.12.2011 10:51 schrieb Jeff King:\n>> On Sun, Dec 18, 2011 at 08:53:09AM +0100, Erik Blake wrote:\n>>\n> [...]\n>>> Now, however, I have a different problem in that notepad++ is somehow\n>>> signalling git that editing is complete before I even get a chance to\n>>> edit the file. I am trying the command\n>>>> git commit --amend\n> [...]\n>> I know nothing about notepad++, but a quick google turned up the\n>> \"-multiInst\" option, which would avoid attaching to the existing\n>> instance. That might work for you.\n>>\n>> -Peff\n> Jeff is right! I also use notepad++ and have set\n>\n> export GIT_EDITOR='notepad++ -multiInst'\n>\n> in my .bashrc (msysGit). And btw: notepad++ DOES handle cr/lf. Look at\n> the \"Format\" menu.\n>\n>      Dirk\n"},{"id":"181532","messageId":"4EF0E624.1090500@dirk.my1.cc","threadId":"29196","inReplyTo":"4EF04199.1010008@icefield.yk.ca","subject":"Re: Escape character for .gitconfig","fromName":"Dirk Süsserott","fromEmail":"newsletter@dirk.my1.cc","sentAt":"2011-12-20T19:46:44Z","receivedAt":"2011-12-20T19:46:44Z","isPatch":false,"sender":{"key":"newsletter@dirk.my1.cc","avatar":null},"body":"Am 20.12.2011 09:04 schrieb Erik Blake:\n> Hi Dirk,\n>\n> I ended up using \"'C:/Program Files (x86)/Notepad++/notepad++.exe'\n> -multiInst -notabbar -nosession -noPlugin\" which works nicely for me\n> (note the placement of the inner quotations).\n>\n> It is notepad.exe (the default Windows editor) that fails on files with\n> only <lf> termination. That's why I was trying to set notepad++ as the\n> git editor as it is vastly superior.\n>\n> Cheers,\n> Erik\n\nHi Erik,\n\noops, I overread that you talked about notepad (not notepad++) and the\n<lf> stuff. My fault. I use the portable version of notepad++ and don't\nhave the \"space in path\" problem. But if you mainly use the git-bash (as\nI do) instead of cmd.exe, then probably you could tweak your .bashrc:\n\nexport PATH=\"/C:/Program Files (x86)/Notepad++\":$PATH\n\nand then run notepad++ w/o giving the absolute path.\n\nCheers,\n    Dirk\n"},{"id":"181572","messageId":"alpine.DEB.2.00.1112211352580.17957@ds9.cixit.se","threadId":"29196","inReplyTo":"4EEC6A9D.1060005@icefield.yk.ca","subject":"Re: Escape character for .gitconfig","fromName":"Peter Krefting","fromEmail":"peter@softwolves.pp.se","sentAt":"2011-12-21T12:54:30Z","receivedAt":"2011-12-21T12:54:30Z","isPatch":false,"sender":{"key":"peter@softwolves.pp.se","avatar":"https://avatars.githubusercontent.com/u/990764?v=4"},"body":"Erik Blake:\n\n> As you can see, I'm running git on a Win7 64 machine. Is there any way to \n> escape the brackets? Or do I need to reinstall notepad++ on a different path?\n\nJust use the 8.3 path instead, using either \"C:/Progra~1\" or \"C:/Progra~2\" \n(depending on how the system got installed). You can mix 8.3 and long paths \nin the same command (so keeping the \"Notepad++\" component is fine).\n\n-- \n\\\\// Peter - http://www.softwolves.pp.se/\n"},{"id":"181574","messageId":"CANgJU+U4Bq0yHmJYndV_4xaymFca2JVNg7sfuN9jB92ts=aFkg@mail.gmail.com","threadId":"29196","inReplyTo":"alpine.DEB.2.00.1112211352580.17957@ds9.cixit.se","subject":"Re: Escape character for .gitconfig","fromName":"demerphq","fromEmail":"demerphq@gmail.com","sentAt":"2011-12-21T13:59:01Z","receivedAt":"2011-12-21T13:59:01Z","isPatch":false,"sender":{"key":"demerphq@gmail.com","avatar":null},"body":"On 21 December 2011 13:54, Peter Krefting <peter@softwolves.pp.se> wrote:\n> Erik Blake:\n>\n>\n>> As you can see, I'm running git on a Win7 64 machine. Is there any way to\n>> escape the brackets? Or do I need to reinstall notepad++ on a different\n>> path?\n>\n>\n> Just use the 8.3 path instead, using either \"C:/Progra~1\" or \"C:/Progra~2\"\n> (depending on how the system got installed). You can mix 8.3 and long paths\n> in the same command (so keeping the \"Notepad++\" component is fine).\n\nOr use a junction to make an alias of the name without strange chars....\n\nYves\n\n\n-- \nperl -Mre=debug -e \"/just|another|perl|hacker/\"\n"}]}