Closed bozho closed 2 years ago
@bozho we fallback to git.exe
when the repo is on a shared drive (as otherwise it can't handle the location). The rule is as follows:
WSL_DISTRO_NAME
env var has a value/mnt/
Depending on how you enter, those conditions will not be met (and thus for those paths the segment will not show).
@JanDeDobbeleer When you say "can't handle the location" - do you mean that Linux git
would not be able to handle the repo on a shared drive?
I did a bit more testing and it looks like each tmux
session inherits existing tmux
sessions' env variables.
If I start tmux
from a local WSL/Debian session first, it will have WSL_DISTRO_NAME
env variable defined. If I then start another tmux
session from an SSH session to WSL/Debian, that tmux
will inherit environment from the already running (local) tmux
sesison, and oh-my-posh
will also look for git.exe
.
However, if I first start tmux
in the remote SSH session, it will not have WSL_DISTRO_NAME
env variable defined, and git
segment will work. If I then start another tmux
in the local WSL/Debian session, it will inherit remote tmux
environment (without WSL_DISTRO_NAME
env variable), and git
segment will work. When I run oh-my-posh --debug ...
command, it shows that it looks and find native git
command, so it looks like native git
can handle repos on shared drives.
Any idea about messed up powerline symbols on remote tmux
sessions?
The messed up symbols is something I have no idea about. My bet is that tmux ruins your terminal's encoding (or font rendering) I seem to remember there being a Windows Terminal issue about tmux ruining certain things, but that's definitely not oh-my-posh as it can't influence that.
@lnu do you remember why we fall back to git.exe
on shared WSL drives? Otherwise I'll look through the history.
The strange thing about tmux
messing up the symbols is that it only happens for for remote sessions. The prompt is fine in tmux
on a local session, as well as when I SSH into my WSL distro. The combination of ssh
+ tmux
seems to mess things up.
The messed up symbols is something I have no idea about. My bet is that tmux ruins your terminal's encoding (or font rendering) I seem to remember there being a Windows Terminal issue about tmux ruining certain things, but that's definitely not oh-my-posh as it can't influence that.
@lnu do you remember why we fall back to
git.exe
on shared WSL drives? Otherwise I'll look through the history.
Eh, the above seems to be interplay between ssh
setting LC_ALL
to C
. Starting tmux
as tmux -u
fixes the problem. I suppose fixing the locale for ssh sessions would fix that, too.
here's the diff when using git vs git.exe for windows mounted folders:
@lnu What is the difference? Refresh index: ...
bit?
I tried running both native and Windows git(.exe) status
on a shared dir on my machine, and the output is exactly the same.
Windows git is 2.34.0.windows.1
, WSL/Debian is on 2.33
@lnu we're always blocked by the speed issues on mounted drives it seems 😅
@lnu What is the difference?
Refresh index: ...
bit?I tried running both native and Windows
git(.exe) status
on a shared dir on my machine, and the output is exactly the same.Windows git is
2.34.0.windows.1
, WSL/Debian is on2.33
it always does this if I do a git status on windows mounted drive in wsl2(tested with several repos).
@lnu we're always blocked by the speed issues on mounted drives it seems 😅
One should never work on a mounted drive. If you want to work in wsl2, the git repo should be cloned is wsl2. I had too many issues in the past with that.
Ah, I'm on WSL1 - mostly due to shared disk performance :)
That explains the refresh index case
Sent from mobile
On 25 Nov 2021, at 12:24, Marko Bozikovic @.***> wrote:
Ah, I'm on WSL1 - mostly due to shared disk performance :)
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.
@lnu Ok, so if I understood correctly, this all works as intended, since you coded git
segment a bit defensively when running under WSL, considering issues with native git
command and repos on shared volumes, right?
yes, it was all about performance on wsl2.
@bozho @lnu what's the output of wsl -l -v
? I want to see if we can make it a bit smarter and only default to git.exe
on WSL2 and not 1.
I was checking already. But you have to detect it from wsl itself. You can do it by executing uname -r
. The wsl2 version will contain wsl2.
vs
Thank you both!
tested and works fine on my side: vs
Updated both WSL/Debian and PS module, can confirm.
This issue has been automatically locked since there has not been any recent activity (i.e. last half year) after it was closed. It helps our maintainers focus on the active issues. If you have found a problem that seems similar, please open a discussion first, complete the body with all the details necessary to reproduce, and mention this issue as reference.
Code of Conduct
What happened?
I run
oh-my-posh
both in my PowerShell 5.1 (installed as a module) and in my WSL Debian installation, in bash. They both share the theme below. I use Windows Terminal.The theme works as expected in PS 5.1 (
oh-my-posh
module v5.8.0). In a directory with agit
repository, running an elevated instance of Windows Terminal, I see something like this:There are strange thing happening in WSL, with
oh-my-posh
6.14.0 installed.When I open WSL bash shell directly and go the the same directory, I don't see the
git
segment:Notice that OS detection is detecting WSL/Debian. Free disk space segment is not shown, as expected.
When I run
tmux
, nothing changes.When I ssh into my WSL/Debian,
git
segment appears:However, if I then start
tmux
in the ssh session, powerline symbols are not shown correctly:To add to the strangeness, if I start
tmux
in my "direct" WSL/Debian shell first (and lose thegit
segment), and then starttmux
in my ssh session, the prompt intmux
ssh session will also not show thegit
segment.bash
TERM
variable is set toscreen
whentmux
runs. Manually changing it toxterm-256color
in atmux
session (local or remote) has no effect.Running
oh-my-posh --debug --shell uni --config="$POSH_THEME"
in the local WSL/Debian session, it looks likegit
segment is looking forgit.exe
, notgit
:Running the same command while ssh'd into my WSL/Debian, it finds
git
:If I start
tmux
in my SSH session aftertmux
has been started in the local session, OS detection changes fromDebian
toWSL - Debian
, and the debug command is again looking forgit.exe
Theme
What OS are you seeing the problem on?
Linux
Which shell are you using?
bash
Log output