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

When making a merge commit, git hangs waiting for the commit message even though I saved and closed the editor (VS Code) #1875

Closed
1 task done
Admiralfeb opened this issue Oct 10, 2018 · 8 comments

Comments

@Admiralfeb
Copy link

Admiralfeb commented Oct 10, 2018

  • I was not able to find an open or closed issue matching what I'm seeing

Setup

  • Which version of Git for Windows are you using? Is it 32-bit or 64-bit?
$ git --version --build-options

git version 2.19.1.windows.1
cpu: x86_64
built from commit: 11a3092e18f2201acd53e45aaa006f1601b6c02a
sizeof-long: 4
sizeof-size_t: 8
  • Which version of Windows are you running? Vista, 7, 8, 10? Is it 32-bit or 64-bit?
$ cmd.exe /c ver

Microsoft Windows [Version 10.0.16299.665]
  • What options did you set as part of the installation? Or did you choose the
    defaults?
# One of the following:
> type "C:\Program Files\Git\etc\install-options.txt"
> type "C:\Program Files (x86)\Git\etc\install-options.txt"
> type "%USERPROFILE%\AppData\Local\Programs\Git\etc\install-options.txt"
$ cat /etc/install-options.txt

Editor Option: VisualStudioCode
Custom Editor Path:
Path Option: Cmd
SSH Option: OpenSSH
CURL Option: WinSSL
CRLF Option: CRLFCommitAsIs
Bash Terminal Option: MinTTY
Performance Tweaks FSCache: Enabled
Use Credential Manager: Enabled
Enable Symlinks: Disabled
Enable Builtin Rebase: Enabled
Enable Builtin Stash: Enabled

  • Any other interesting things about your environment that might be related
    to the issue you're seeing?

I had specified the editor at one point before the installer queried for you.

[core]
	editor = 'C:\\Users\\zachary.bryant\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe' --wait

Details

  • Which terminal/shell are you running Git from? e.g Bash/CMD/PowerShell/other

Bash

git merge
  • What did you expect to occur after running these commands?

As git cannot run a fast-forward as there are commits on both sides of the merge, it makes a merge commit and prompts me in my default editor (VS Code) to specify the commit message since I didn't provide one.
Once VS Code/the commit message file is closed, git should resume normal operation.

  • What actually happened instead?

I closed VS Code/the commit message file and git is still frozen waiting for the file to close. Ctrl-C does not end the process. I have to close the bash window.

  • If the problem was occurring with a specific repository, can you provide the
    URL to that repository to help us with testing?

** insert URL here **

@joaomoreno
Copy link

joaomoreno commented Oct 22, 2018

VS Code dev here.

The problem here is that Git is setting up Code as the default editor and pointing directly to Code.exe, when it should point to bin\code.cmd instead.

Unfortunately, looking at https://github.com/git-for-windows/build-extra/blob/fafef64ee09410734571e181d578261d5cf700bb/installer/install.iss#L1291 there doesn't seem to be a good way to fix this...

@dscho
Copy link
Member

dscho commented Oct 22, 2018

@joaomoreno we wanted to avoid that extra process. Creating processes on Windows is really expensive, as you know...

@melak47
Copy link

melak47 commented Oct 23, 2018

Forcing the user to terminate git or close their VS Code instance is also expensive :)

@dscho
Copy link
Member

dscho commented Oct 23, 2018

Look, it has been advertised for years that you should use code --wait as core.editor setting if you want to use VS Code. And that's what we do, and it took quite a bit of time out of my busy schedule to set aside to get this support working. And it took more contributors more work to adapt to the user-wide installation of VS Code.

@melak47 if you now come and chime in from the sidelines, you will understand what my emotional response is, right? And I am sure that you want to set things right, too. Please feel free to do so.

@melak47
Copy link

melak47 commented Oct 23, 2018

Look, it has been advertised for years that you should use code --wait as core.editor setting if you want to use VS Code.

That's what I use, too.

And that's what we do, and it took quite a bit of time out of my busy schedule to set aside to get this support working.
And it took more contributors more work to adapt to the user-wide installation of VS Code.

I was pleasantly surprised when the git for windows installer offered to configure VS Code as the editor, so thank you and anybody else who worked on making that work!
But then I was surprised to find e.g. git commit waiting for the whole VS Code instance to close, instead of just the editor for the commit message. After some googling I ended up here, and found that it had indeed replaced the code --wait I had in my config before with "P:\\ath\\to\\Code.exe" --wait.

@melak47 if you now come and chime in from the sidelines, you will understand what my emotional response is, right? And I am sure that you want to set things right, too. Please feel free to do so.

All I meant was that using code.exe --wait instead of code.bat --wait would be a fine optimization if it worked the same, but currently it doesn't appear to do that.

@joaomoreno
Copy link

joaomoreno commented Oct 23, 2018

VS Code should actually support this. I'll push my way in microsoft/vscode#60192 and make sure the current configuration works.

@joaomoreno
Copy link

Great news! A fix for VS Code is in master. It will be release to our insider users next week and to our stable users next month.

microsoft/vscode#60192

@dscho
Copy link
Member

dscho commented Feb 27, 2019

So this ticket can be closed, right?

@dscho dscho closed this as completed Feb 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants