Open Zopolis4 opened 1 year ago
Let me check if I understand your request correctly. You would like to change the shell executable through which the git
command is executed?
Currently wslgit
executes something like
wsl.exe /bin/bash -c "git --version"
and you would like to be able to change that to, e.g.
wsl.exe /usr/bin/fish -c "git --version"
(or some other shell). Did I understand that correctly?
Right now this is not possible, but I think we could add an environment variable to configure the shell executable. But this would be without any guarantees that a particular shell is supported. A quick check suggests that fish supports the -i
and -c
flags, like bash, so I think it would work.
... Did I understand that correctly?
Yeah, that's essentially my request.
I observed with WSL 2 atleast whatever I have the SHELL=/usr/bin/zsh
set to will be used by wslgit, I am using this with GitExtensions
and zsh
.
All was working fine until some update came along and broke "Current branch only" functionality with the setup. This works even now if you use bash
instead.
Error details:
Exit code: 1 Command: wsl Arguments: -d Ubuntu git -c log.showSignature=false log -z --pretty=format:"%H%T%P%n%at%n%ct%n%aN%n%aE%n%cN%n%cE%n%B" --max-count=500 --glob=refs/stas[h] ea3970a7f11cd227ac55917edaa835a2a9bc4fc8 -- Working directory: \wsl$\Ubuntu\home\user\repo\
GitExtUtils.ExternalOperationException: zsh:1: no matches found: --glob=refs/stas[h]
---> System.Exception: zsh:1: no matches found: --glob=refs/stas[h]
--- End of inner exception stack trace ---
at void GitUI.RevisionGridControl.PerformRefreshRevisions(Func<RefsFilter, IReadOnlyList<IGitRef>> getRefs, bool forceRefresh)+() => { } in C:/projects/gitextensions/GitUI/UserControls/RevisionGrid/RevisionGridControl.cs:line 1309
at async Task GitUI.GitUIExtensions.InvokeAsync(Control control, Action action, CancellationToken token) in C:/projects/gitextensions/GitUI/GitUIExtensions.cs:line 239
at async void GitUI.TaskManager.FileAndForget(Task task, Func<Exception, bool> fileOnlyIf)+(?) => { } in C:/projects/gitextensions/GitExtUtils/GitUI/TaskManager.cs:line 29
The fix was to do the following:
cp /etc/zsh/zshenv ~/.zshenv
echo "alias git=\"noglob git\"" >> ~/.zshenv
Now everything works as usual. Hope this helps someone facing the same issue.
I use fish as my exclusive shell in wsl, and have a variety of variables and functions set in config.fish that I frequently use in my git usage.
I would very much like not to have to port these over to bash, as they are in some cases impossible to port, so I was wondering if an option to use the default shell (set by chsh) or to set a specific shell could be added?