Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Complex git core.editor setting fails with hub #1482

Open
hesselink opened this issue May 19, 2017 · 5 comments · May be fixed by #2214
Open

Complex git core.editor setting fails with hub #1482

hesselink opened this issue May 19, 2017 · 5 comments · May be fixed by #2214
Labels

Comments

@hesselink
Copy link

I have my core.editor set to something complex (to get it to work cross machine):

[core]
    editor = "which mvim > /dev/null 2>&1 && mvim --remote-tab-wait-silent $@ || vim"

When trying hub create issue, I get:

/Users/ehesselink/.local/bin/mvim
/Users/ehesselink/.local/bin/mvim
/usr/bin/vim
error using text editor for issue message

The setting works with plain git though. I see this was discussed before in #881, but that was marked as fixed.

$ hub version
git version 2.9.2
hub version 2.2.9
@mislav
Copy link
Owner

mislav commented Jun 26, 2017

Thanks for reporting! It seems that we will need to evaluate the core.editor setting in context of a shell to be fully compatible with git. Previously we improved our core.editor support by supporting environment variables within it, but it seems that this wasn't enough.

Related: #721

@shreyasminocha
Copy link

Similar issue with editor = code -rwg $1:2

Arguments in `--goto` mode should be in the format of `FILE(:LINE(:CHARACTER))`.

@shawwn
Copy link

shawwn commented May 21, 2019

See also #881 (comment)

@mislav
Copy link
Owner

mislav commented May 21, 2019

@shawwn The gvim --remote-wait as editor setting is not complex at all and it should work.

What is shown for you for git var GIT_EDITOR?

In which way this editor configuraion fails for you if you try to invoke a hub commands that edits a file, such as hub pull-request?

@bk2204
Copy link

bk2204 commented Jul 29, 2019

I have a branch, shell-editor, on my remote which passes the editor command to the shell, which is the only way to get correct behavior here. It works fine on macOS, and I have no reason to believe it will work anything other than fine under Linux. Unfortunately, since sh is not in the PATH on Windows except under Git Bash, there's no way to make this work there as it stands.

There are some ways forward:

  • We simply accept that things are broken on Windows and can't be fixed.
  • We check for sh to be in the PATH, and fall back to the broken behavior on Windows if not.
  • We require the user to always have sh in the PATH and fail if not.
  • We do something unsavory to the PATH on Windows by finding the location of git.exe and find sh by appending the equivalent of $(dirname "$(which git)")/../bin to the PATH. That should work both under Git Bash and Powershell, since under Git Bash we'll already have sh in the PATH, but there may still be cases where things don't work. In particular, I'm unclear how PortableGit will work.
  • Someone else comes up with a great solution and we adopt that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants