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

Fish (and other shells) support #132

Open
Zopolis4 opened this issue Oct 7, 2022 · 3 comments
Open

Fish (and other shells) support #132

Zopolis4 opened this issue Oct 7, 2022 · 3 comments

Comments

@Zopolis4
Copy link

Zopolis4 commented Oct 7, 2022

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?

@andy-5
Copy link
Owner

andy-5 commented Oct 27, 2022

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.

@Zopolis4
Copy link
Author

Zopolis4 commented Oct 27, 2022

... Did I understand that correctly?

Yeah, that's essentially my request.

@rosahay-silabs
Copy link

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:

  • Git Extensions 4.1.0.16698
  • Build 1fe52a137acef1fbd2b653dea263b44ad5844177
  • Git 2.41.0
  • Microsoft Windows NT 10.0.19045.0
  • .NET 6.0.21
  • DPI 120dpi (125% scaling)
  • Portable: False

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.

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

3 participants