JanDeDobbeleer / oh-my-posh

The most customisable and low-latency cross platform/shell prompt renderer
https://ohmyposh.dev
MIT License
16.79k stars 2.35k forks source link

git branch information not working, when in git submodule #1198

Closed guntern closed 2 years ago

guntern commented 2 years ago

Code of Conduct

What happened?

Is updated from oh-my-posh 5.something to 6.2.

Using the jandedobbeleer theme I previously had the current git branch shown. This worked like a charm for the parent project as well, when entering a submodule. Within the submodule the branch and stats for this submodule were shown.

Now with version 6.2 I only see this information for the parent project regardless of whether I am inside of a submodule directory or not. This is especially annoying, when in a detached head state for the submodule. Just noticed something surprising: When I do a commit in the submodule the prompt shows the actual status of the submodule. But as soon as I cd out of the submodule and back in, it merely keeps showing the status of the parent git project and has lost the status of the submodule.

I checked the theme file and also the documentation. I do not find a hint how to get this back to operation.

Version

6.2

Theme

jandedobbeleer

What OS are you seeing the problem on?

Windows

Which shell are you using?

powershell

Relevant log output

No response

JanDeDobbeleer commented 2 years ago

This could indeed be something we missed...

DotNetSparky commented 2 years ago

Not just with submodules -- I'm also seeing this when in a separate 'worktree' -- it's now showing the branch checked out in the "main" worktree rather than the one that my current directory is in.

lnu commented 2 years ago

probably the new "C" option I recommended ... I checked and it's totally related to that changes.
My bad, the variable when in a worktree contains this: D:/dev/rc/.git/worktrees/rc_release_sp11 and no the real folder of the worktree. That's probably why it was like this.
I propose to remove it for now and check for another solution working in all cases.

PS: I have a workaround working for worktrees but I still have to test it with submodules https://github.com/JanDeDobbeleer/oh-my-posh/pull/1203

Icorebleidd commented 2 years ago

Not sure if this is related. Im using oh my posh in WSL on Windows 10, the font im using is the recommended one. When i enter a Git folder none of the themes i tried is able to display the branch name. Im currnelty using microverse-power.

guntern commented 2 years ago

probably the new "C" option I recommended ... I checked and it's totally related to that changes. My bad, the variable when in a worktree contains this: D:/dev/rc/.git/worktrees/rc_release_sp11 and no the real folder of the worktree. That's probably why it was like this. I propose to remove it for now and check for another solution working in all cases.

PS: I have a workaround working for worktrees but I still have to test it with submodules #1203

Is there some thread about this -Coption? I do not get the point for using it.

JanDeDobbeleer commented 2 years ago

Is there some thread about this -Coption? I do not get the point for using it.

@guntern I'm going to remove it as it only was for debugging purposes. Give me 15 minutes.

lnu commented 2 years ago

probably the new "C" option I recommended ... I checked and it's totally related to that changes. My bad, the variable when in a worktree contains this: D:/dev/rc/.git/worktrees/rc_release_sp11 and no the real folder of the worktree. That's probably why it was like this. I propose to remove it for now and check for another solution working in all cases. PS: I have a workaround working for worktrees but I still have to test it with submodules #1203

Is there some thread about this -Coption? I do not get the point for using it.

the thing is all segments follows the --pwd folder passed in parameter except the git one. Let's say you want to execute omp on a specific path for debug/test purpose, you have to respect the path passed in parameter. Now it takes the path from where the executable is launched.

lnu commented 2 years ago

Is there some thread about this -Coption? I do not get the point for using it.

@guntern I'm going to remove it as it only was for debugging purposes. Give me 15 minutes.

it's the better solution for now

guntern commented 2 years ago

ah for debugging. That`s why I did not get the point. Thanks for the explanation. This is totally understandable.

JanDeDobbeleer commented 2 years ago

1210

guntern commented 2 years ago

Thanks for fixing that so fast.

github-actions[bot] commented 6 months ago

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.