gitextensions / gitextensions

Git Extensions is a standalone UI tool for managing git repositories. It also integrates with Windows Explorer and Microsoft Visual Studio (2015/2017/2019).
https://gitextensions.github.io/
Other
7.7k stars 2.08k forks source link

Git-flow and WSL: problem with editor #11840

Closed lgall3t closed 3 weeks ago

lgall3t commented 1 month ago

Environment

Issue description

Hello.

When I want to finish a release branch on git repository in wsl folder (\wsl$\XXX), the GitFlow extension hang on the step where I must write a comment for the action.

If I run a « ps -ef » in a WSL shell, I see:

user  11580 11579  0 09:23 pts/0    00:00:00 git flow release finish V1.0.0
user  11581 11580  0 09:23 pts/0    00:00:00 /bin/sh /usr/bin/git-flow release finish V1.0.0
user  12048 11581  0 09:23 pts/0    00:00:00 git tag -a V1.0.0
user  12049 12048  0 09:23 pts/0    00:00:00 /usr/bin/editor /home/user/folder/.git/TAG_EDITMSG

If I kill "/usr/bin/editor" process in WSL shell, Git Extensions come back to life and show:

error: editor died of signal 9
error: There was a problem with the editor 'editor'.

So it's a problem with the fact "WSL Git will be use for WSL repositories" (seen in settings). Vi, the editor that is associated with "editor", say "Warning: Output not to a terminal" (same problem with nano). I have'nt found a parameter to force use of Git for Windows on WSL repositories.

In Git Extensions 3.5, I have no problem with GitFlow extension and WSL. I don't remember than Git Extension 3.5 use WSL Git for WSL repositories.

A workaround is to run "git flow releaser finish XXX" in WSL console.

More generaly, force use of WSL Git with WSL repositories is, for me, a bad idea. Yes, it run actions faster but you should be confronted to other problems. For example: there is a problem with WSL and VPN in Windows 10 (WSL Linux can't access to network if VPN is enabled). So if I work at home for my organization (with VPN), I can't push commit to remote repositories from Git Extensions, because it use WSL Git… I am forced to use git on windows command line or concurrent software that run in Windows "only" mode (TortoiseGit for example).

Steps to reproduce

1/ Create a git repository on a folder in WSL Linux. 2/ Init. git flow. 3/ Create some files and commit them. 4/ Create a release branch wit gitflow extension in GitExtensions. 5/ Run a finish action on the release branch. => hang

Did this work in previous version of GitExtensions?

Yes, it's work on GitExtension 3.5.

Diagnostics

No response

gerhardol commented 1 month ago

See the documentation for how to force Win git: https://git-extensions-documentation.readthedocs.io/en/main/settings.html#wsl-git-notes After som MS or IT updates, Win Git in WSL is not just slow, it is basically unusable for me.

But you should set Git core.editor in WSL to a GUI editor, for instance GE file editor.

For WSL and network issues, Win11 and mirrored networking mode works better. With Win10 (and NAT), I have to change the VPN fw rules.

lgall3t commented 1 month ago

Forcing WinGit with drive letter mapping to wsl directory works, but it isn't very good: WSL distribution start with Windows explorer and WSL aren't stop automatically because explorer is linked to WSL directory. I don't use WSL every day, so it consumes CPU and RAM for nothing.

Finally, I use the workaround with GUI editor. Setting GUI editor executable directly in "core.editor" doesn't work because GUI editor don't find display. I think Git Extensions run another shell than bash or non interactive bash, because DISPLAY variable are initialized by my .bashrc file. So, I have created a script who set DISPLAY variable and run GUI editor. It works with this method.

Thanks for the tips @gerhardol .

Note: I have no admin rights, so I can't modify VPN params or network card params on my enterprise PC. I am blocked on this point.

I think a param in Git Extensions to force Wingit use will be a interesting feature.

mstv commented 1 month ago

I think a param in Git Extensions to force Wingit use will be a interesting feature.

It exists: WslGitEnabled. But it needs to manually be added to the settings file.

lgall3t commented 1 month ago

It exists: WslGitEnabled. But it needs to manually be added to the settings file.

Thanks, it works. With this parameter set to "false" in config file, I retrieve the old behavior: Windows GUI editor is launched when Git-Flow branch is finished.

It's just missing this param in Git Extensions GUI and this issue could be close.