-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Release 2.33.1 breaks opening visual code by git commit command #3471
Release 2.33.1 breaks opening visual code by git commit command #3471
Comments
This seems to have been missed in git-for-windows/build-extra#384. @segevfiner, help? |
@hansschuijff could you add more details here? I guess you installed VS Code system-wide? The report is a bit parsimonious with details. |
This does look like the path is combined correctly and then quoted correctly, but that quoting gets messed up along the way. |
Weird... I haven't touched the quotes in the command after all. I will try and repro. |
@dscho yes, I installed all software system-wide. and have setup code to use bash as terminal too. Please ask if you need any other details. I'm not sure what you need. |
P.S. As a workaround you can overwrite you can change your |
@hansschuijff Your |
@segevfiner the content of my .gitconfig is as below (mainly aliasses I got from knowthecode). I just performed an upgrade without any setting changes, before this error occurred. Could be I also updated vscode yesterday, but I'm not sure if it was before or after. Reinstalling didn't help and reinstalling the prev version did, so I guess it doesn't matter.
|
No, but you have replaced a call to an |
That would apply if VS Code was installed user-wide. But it is installed system-wide, hence the |
@hansschuijff could you start Git Bash as Administrator (e.g. hitting the Windows key, typing "Git Bash" and then pressing Ctrl+Shift+Enter), then call |
Something is messed up with EDIT: Might be just idiosyncratic PowerShell syntax, I'll try again in cmd. |
@dscho I tried your suggestion and removing .cmd works here. In the previous version the command said code.exe instead of code.cmd. With .cmd removed from core.editor code opens again when I do the commit to enter the commit message. |
They also include a `bin\code` bash script which seems to work, executing a `.cmd` doesn't seem to work for some reason. Signed-off-by: Segev Finer <[email protected]>
Excellent! Explanation:
@segevfiner how about including the information I provided in the commit message, and opening a PR? |
Oh, I see, there is already git-for-windows/build-extra#385... 😄 |
… Code There seems to be a quoting bug somewhere trying to execute an editor that is a .cmd script with spaces in its path. VS Code also includes a `bin\code` shell script which seems to work correctly even with spaces in the path. @dscho Explanation: * When executing .exe programs, the MSYS2 Bash (or the MSYS2 runtime) do not have to jump through special hoops, a simple CreateProcessW() is enough. * The core.editor setting is actually executed through a shell invocation, therefore it handles the double-quoted path correctly. * Shell scripts, or more correctly: files starting with a #!<path-to-interpreter> line, are not actually executed directly via CreateProcessW(). Instead, the MSYS2 runtime has provisions to execute the interpreter with the file name as the first parameter. * Batch files, i.e. .cmd and .bat files, are somehow executed via cmd.exe (but I haven't really figured out where, exactly, my guess is that the lpApplicationName is left at NULL, contrary to CreateProcessW()'s documentation which specifically asks for it to be set to cmd.exe to execute batch files). It is my guess that things go wrong here, as the command line for cmd.exe would need to be enclosed in extra double quotes. * By using the code shell script that is included in VS Code (instead of the code.cmd batch file), we neatly side-step all the intricacies of quoting the arguments for cmd.exe correctly: we simply let the MSYS2 runtime handle it all. Fixes git-for-windows/git#3471 Signed-off-by: Segev Finer <[email protected]>
Configuring a system-wide VS Code as Git's editor [was broken](git-for-windows/git#3471), which has been fixed. Signed-off-by: Johannes Schindelin <[email protected]>
@hansschuijff could I ask you to verify that the latest snapshot works as expected? |
@dscho I'm not sure what you're asking, but I installed the snapshot and it worked for me. Note that before installing I had already changed the config to remove the file extension in the code.editor setting, like you suggested, so it worked before installing the snapshot too. Hope it helps. Thanks for the swift response on this issue. |
Excellent!
Right, but the reinstallation would have overwritten your edits. That it works afterwards, still, means that we now write the correct value. |
After upgrading to version 2.33.1 I some git-commands didn't work any more on my win10 machine.
The reason seem to be the spaces in the path to code.cmd.
I tried reinstalling first, but the problem persisted and now I have reinstalled the previous version 2.33.0(2) and the problem is solved. I didn't know how to solve it otherwise and am stuck for now with the prev version.
I could still open vscode using the code command, but when git normally opens the editor (for instance in "git commit --amend" or even just "git commit") the response was an error about the path. I don't know if there are other commands too that open code and are broken, but the commit didn't work anymore after this update..
For instance this was the response to "git commit --amend" in git version 2.33.1.
C:\Users\Hans\Local Sites\sandbox\app\public\wp-content\plugins\genesis-connect-sensei-lms>git commit --amend
hint: Waiting for your editor to close the file... 'C:\Program' is not recognized as an internal or external command,
operable program or batch file.
error: There was a problem with the editor '"C:\Program Files\Microsoft VS Code\bin\code.cmd" --wait'.
Please supply the message using either -m or -F option.
Setup
The text was updated successfully, but these errors were encountered: