Issue with core.editor command line arguments with slashes

160 views
Skip to first unread message

Andrei Grigorev

unread,
Jan 28, 2021, 10:55:00 AM1/28/21
to git-for-windows
Hi,

I am using git version 2.30.0.windows.2.

I have the following entry in my .gitconfig:

[core]
editor = "\"c:\\Program Files\\Far Manager\\Far.exe\" /e"

The intent is to run "far.exe /e <filename>" when git wants to invoke an editor, unfortunately, for some reason it transforms into "far.exe e:/ <filename>" when git tries to invoke an editor.

Any suggestions?

git bugreport details:

What did you do before the bug happened? (Steps to reproduce your issue)
1. Install far manager x64: Far Manager Official Site : download;
2. Edit .gitconfig and set core.editor to "\"c:\\Program Files\\Far Manager\\Far.exe\" /e"
3. Do a "git commit" in an appropriate location, so git tries to open an editor
4. See that Far started in "regular" mode rather than in "editor" mode.
5. Check the command line Far was started with and notice the "E:\" as the first argument (can be done in Powershell: get-process far | Select-Object -ExpandProperty CommandLine)

What did you expect to happen? (Expected behavior)
"/e" is properly passed as the first executable argument.

What happened instead? (Actual behavior)
"E:/" is passed as the first argument

What's different between what you expected and what actually happened?
"/e" was replaced with "E:/"

Anything else you want to add:

Please review the rest of the bug report below.
You can delete any lines you don't wish to share.


[System Info]
git version:
git version 2.30.0.windows.2
cpu: x86_64
built from commit: f8cbc844b81bf6b9e72178bbe891a86c8bf5e9e7
sizeof-long: 4
sizeof-size_t: 8
shell-path: /bin/sh
uname: Windows 10.0 19042 
compiler info: gnuc: 10.2
libc info: no libc information available
$SHELL (typically, interactive shell): <unset>


[Enabled Hooks]

Johannes Schindelin

unread,
Feb 5, 2021, 10:49:00 AM2/5/21
to Andrei Grigorev, git-for-windows
Hi,

On Mon, 25 Jan 2021, Andrei Grigorev wrote:

> I am using git version 2.30.0.windows.2.
>
> I have the following entry in my .gitconfig:
>
> [core]
> editor = "\"c:\\Program Files\\Far Manager\\Far.exe\" /e"
>
> The intent is to run "far.exe /e <filename>" when git wants to invoke an
> editor, unfortunately, for some reason it transforms into "far.exe e:/
> <filename>" when git tries to invoke an editor.

Isn't this covered by
https://github.com/git-for-windows/build-extra/blob/master/ReleaseNotes.md#known-issues:

> If you specify command-line options starting with a slash,
> POSIX-to-Windows path conversion will kick in converting e.g.
> "/usr/bin/bash.exe" to "C:\Program Files\Git\usr\bin\bash.exe". When that
> is not desired -- e.g. "--upload-pack=/opt/git/bin/git-upload-pack" or
> "-L/regex/" -- you need to set the environment variable MSYS_NO_PATHCONV
> temporarily, like so:
>
> MSYS_NO_PATHCONV=1 git blame -L/pathconv/ msys2_path_conv.cc
>
> Alternatively, you can double the first slash to avoid POSIX-to-Windows
> path conversion, e.g. "//usr/bin/bash.exe".

So I would expect `//e` to be a viable workaround.

Ciao,
Johannes
> --
> You received this message because you are subscribed to the Google Groups "git-for-windows" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to git-for-windo...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/git-for-windows/7f31cff5-9284-4f3e-b584-d9297855b825n%40googlegroups.com.
>

Andrei Grigorev

unread,
Feb 5, 2021, 1:46:45 PM2/5/21
to Johannes Schindelin, git-for-windows
Reply all
Reply to author
Forward
0 new messages