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

Incorrectly rendered git status details after version 3.12.1-beta #628

Closed edumserrano closed 3 years ago

edumserrano commented 3 years ago

Prerequisites

Description

When in a git directory some of the symbols are not showing correctly when displaying the git status details.

I've installed several versions of the oh-my-posh powershell module using Install-Module -Name oh-my-posh -RequiredVersion <specify version> -AllowPrerelease and found that from version 3.4.7-beta to version 3.12.1-beta this problem does not exist. However after version 3.12.1-beta I couldn't find another version where the problem was fixed.

Environment

Steps to Reproduce

  1. Install oh-my-posh via powershell using the command Install-Module -Name oh-my-posh -AllowPrerelease
  2. Import oh-my-posh via Import-Module oh-my-posh
  3. Set a theme, such as the agnoster, via Set-PoshPrompt -Theme agnoster

Expected behavior: [What you expected to happen]

It should show this: image

Notice that the git status details shows correctly with +2 ~2 -0

The above image was taken using version 3.12.1-beta of oh-my-posh.

Actual behavior: [What actually happened]

I'm getting this: image

Notice the ~2 ?2 at the end of the git status details

The above image was taken using version 3.134.0 of oh-my-posh.

edumserrano commented 3 years ago

Tried the poshgit segment and it displays the info correctly using version 3.134.0 of oh-my-posh. Maybe it's an issue with the git segment?

Example of poshgit which displays git status details correctly and git segment which displays it incorrectly:

image

JanDeDobbeleer commented 3 years ago

@edumserrano can you give me the output of git --no-optional-locks -c core.quotepath=false -c color.status=false status -unormal --short --branch?

edumserrano commented 3 years ago

image

JanDeDobbeleer commented 3 years ago

@edumserrano would you mind copy-pasting that as text?

JanDeDobbeleer commented 3 years ago

@edumserrano I'm sorry but we provide the correct state.?? implies the file is untracked, not "added". That's reserved for A.

When I do the following, it's first marked as untracked and after adding to the index it changes to added. This is, according to my understanding 100% correct. @dahlbyk any context on why posh-git does this differently?

image
dahlbyk commented 3 years ago

posh-git splits status between staged/unstaged, so red +2 means there are two untracked files to be added and green +2 (from A) means two new files have been staged.

edumserrano commented 3 years ago

Of course I don't mind that this is considered working as expected but I thought it might be something to consider as an improvement since posh-git displays the information in a more sensible way and because up until version 3.12.1-beta so did the git segment (arguably).

JanDeDobbeleer commented 3 years ago

@edumserrano given that we have the same rendering as posh-git, I suggest we align the behaviour.

edumserrano commented 3 years ago

That was quick! Thanks for picking this up @JanDeDobbeleer. I can confirm the new release shows correctly: image

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