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

Re: using gvim as editor on Windows

From
TTait <git.git@t41t.com>
Date
Mar 9, 2010, 02:45 UTC
Message-ID
<20100309024523.GU2480@ece.pdx.edu>
In-Reply-To
<201003090032.10037.markus.heidelberg@web.de>
> First of all: do you have the problems in cmd.exe or Git Bash or both?
cmd.exe
I've never used git bash until now, but the behavior is the same there.
Show 5 quoted lines
> > Does calling the .exe directly work for you? If I call gvim.exe directly
> > (with or without -f -- it doesn't matter), it opens a new file called
> > $@.
> 
> I don't know where the $@ should come from.
It comes from line 33 of editor.c, in launch_editor().
if (strcmp(editor, ":")) {
    /* ... */
    if (strcspn(editor, "$ \t'") != len) {
        /* there are specials */
        strbuf_addf(&arg0, "%s \"$@\"", editor);
        args[i++] = "sh";
        args[i++] = "-c";
        args[i++] = arg0.buf;
    }
    args[i++] = editor;
    args[i++] = path;
    args[i] = NULL;
    /* ... */
}

It looks like this was added to detect EDITOR=: but it also manages to catch Windows paths. I'm not familiar with the EDITOR=: convention. What is that supposed to indicate? Can we narrow the detection to that specific case, or does a : anywhere in EDITOR need to be handled this way?

Rebase doesn't use launch_editor, instead just calling the editor directly. Coming up with a combination of quoting and escaping that can pass both cases will be difficult or impossible.

It appears that e97c9a removed the code above from editor.c, but it's still present in prepare_shell_cmd() with even more legal filename characters like = and ;.

Thanks for the help Markus.
Tait
Previous: Markus HeidelbergNext: Junio C Hamano
Message 7 of 10 in “using gvim as editor on Windows”
  1. TaitMar 6, 2010
  2. Jacob HelwigMar 6, 2010
  3. TaitMar 6, 2010
  4. Markus HeidelbergMar 6, 2010
  5. TaitMar 8, 2010
  6. Markus HeidelbergMar 8, 2010
  7. TaitMar 9, 2010
  8. Junio C HamanoMar 9, 2010
  9. TaitMar 11, 2010
  10. Johannes SixtMar 11, 2010

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.