JanDeDobbeleer / oh-my-posh

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

Git status not displayed #753

Closed skycommand closed 3 years ago

skycommand commented 3 years ago

Prerequisites

Description

Hello.

I've just installed oh-my-posh 3.158.3 and I feel most of its themes don't display the Git status properly. (I tried searching this repo's issues, and the only one that came up was #731, which is not relevant enough. So, I'm opening this new issue.)

I initialize my environment with these commands:

Import-Module -Name "posh-git"
Import-Module -Name "oh-my-posh" -MinimumVersion 3.0
Set-Location F:\Projects\AdminScripts

My prompt looks like this: `F:\Projects\AdminScripts [master ≡ +1 ~0 -0 !]>` It says I have one pending change.

So far so good. I continue by setting the slimfat theme.

Set-PoshPrompt -Theme Slimfat

My prompt looks like this: `Username@Domain > F:\Projects\AdminScripts > master ≡ +1` It says I have one pending change.

Again, so far so good. Here is where the problem starts: I set the Agnoster theme.

Set-PoshPrompt -Theme Agnoster

Actual behavior: My prompt looks like this: Agnoster, with Posh-Git It says my local repo is in sync with my remote repo, which is not correct.

Expected behavior: My prompt must indicate that I have pending changes. Here is how the Agnoster theme from oh-my-posh 2 showed it: Agnoster from version 2, with Posh-Git

Environment

JanDeDobbeleer commented 3 years ago

@skycommand it does not say the remote is in sync, status is disabled for that config (it is for slimfat). If you want it, create a custom theme and override that part in the git segment: "display_status": true. The reason is that status can take a significant amount of time in certain repositories severely impacting performance.

skycommand commented 3 years ago

@JanDeDobbeleer Okay, I did not expect that at all.

I need to candidly ask you a question: Is there any of the oh-my-posh 2 features that oh-my-posh 3 provides out-of-the-box?

JanDeDobbeleer commented 3 years ago

@skycommand do you mean with the standard themes? Because those are made for convenience, not tailored for the actual hardcore user. It's pretty straightforward to create a custom theme you can share/use anywhere and tweak 100% to your liking/use cases. That part is a lot easier compared to V2, which was limited to people understanding Powershell and even then, didn't offer a lot of plug and play.

tom-mckinney commented 3 years ago

@JanDeDobbeleer, many of the default templates use the git segment, but only a handful have enabled the status via the "display_status": true option. Could we either enable this for the default templates or remove the git segment from any template that does not enable the status? After updating oh-my-posh I started seeing only the git SHA in my prompt themes. I believed this to be a bug since this wasn't listed as a breaking change in the release notes.

JanDeDobbeleer commented 3 years ago

@tom-mckinney I get your point but we've seen many people having issues with large repos and thus git being slow due to status. What's important to understand, and a key difference when coming from V2, is that the current themes serve more as examples rather than full blown configs to serve every use-case. It's pretty straightforward to create your own enabling every possible feature you'd like and tailoring the experience (which is guaranteed to be compatible). I could've made that change introduce the 4.x version, but we would in all honesty be having the same conversation.

The SHA is another issue to be honest, that would imply git branch --show-current doesn't return a value. Can you validate and make sure you're on the latest version of git?

tom-mckinney commented 3 years ago

@JanDeDobbeleer, you're absolutely right! I updated git to 2.31.1 and now it's working. Please disregard my previous request—now that it's showing the branch rather than the SHA, the git segment is useful again 😄

Could we update the docs for the git segment to include this requirement?

muhammad-usman-anwar commented 3 years ago

@JanDeDobbeleer having the same issue, status remains same(as below), Capture Sorry had to reupload photo, as I exposed my system info before

Used to work fine initially(as I installed first 3.149.x), had a custom variation of paradox theme. After the first update it stopped working, first I thought it was not compatible with my custom theme so I switched to provided paradox one. Didn't resolved the issue. So I kept on updating versions hoping that would resolve the issue. Now, I did some extensive testing and nothing seems to be working, it may be due to updating the package/module/app or something else

JanDeDobbeleer commented 3 years ago

@muhammad-usman-anwar just like the sample, set "display_status": true in your git segment.

muhammad-usman-anwar commented 3 years ago

@JanDeDobbeleer thnx

DWAK-ATTK commented 3 years ago

I'm sorry for being so dumb, but I too am having the same problem. The theme was working before updating posh - and now it isn't. Could you please post the complete instructions for updating the Agnoster theme to include the git status like it was before it was removed?

I've installed posh via the powershell Install-Module method.

My complete $PROFILE is:

Import-Module oh-my-posh
Set-PoshPrompt -Theme agnosterplus

Import-Module Terminal-Icons

Thanks!

muhammad-usman-anwar commented 3 years ago

@DWAK-ATTK checkout the documentation https://ohmyposh.dev/docs/git

JanDeDobbeleer commented 3 years ago

@DWAK-ATTK you can follow the guide to export your current theme and adjust it so it displays the status.

aral commented 1 year ago

@JanDeDobbeleer Just a quick heads up that both your link and @muhammad-usman-anwar’s are currently 404.

JanDeDobbeleer commented 1 year ago

@aral you can find that guide here now. Also updated above.

aral commented 1 year ago

Thanks @JanDeDobbeleer. Figured it out yesterday based in another of your replies but just wanted to give a heads up about the docs site being down. Take care + hope you’re having a good week so far.

github-actions[bot] commented 9 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.