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 segment StashCount always 0 #3297

Closed dcnieho closed 1 year ago

dcnieho commented 1 year ago

Code of Conduct

What happened?

I am in a repository that has one stash item. I am trying to conditionally draw the number of stashes with {{ if gt .StashCount 0 }}<lightYellow> (\uf692 {{ .StashCount }})</>{{ end }}, but it does not show up. Indeed, I see that stashcount is 0 when i remove the conditional from that template so that it is always printed.

Strangely, atop the debug output below, it does show the segment as being rendered with 1 stash item, but in the actual prompt it is zero.

Theme

Note that i am not using the latest oh my posh as i installed the windows store version so its kept automatically up to date (in theory apparently 😛).

Relevant part:

{
  "type": "git",
  "background": "yellow",
  "foreground": "black",
  "style": "powerline",
  "powerline_symbol": "\ue0b0",
  "properties": {
    "branch_icon": "\ue725 ",
    "branch_ahead_icon": "<green>\u2191</>",
    "branch_behind_icon": "<red>\u2193</>",
    "fetch_status": true,
    "fetch_stash_count": true,
    "fetch_upstream_icon": true,
    "fetch_worktree_count": true
  },
  "template": " {{ .UpstreamIcon }}{{ .RepoName }} @ {{ .HEAD }}{{if .BranchStatus }} {{ .BranchStatus }}{{ end }}{{ if .Staging.Changed }}<green> \uf046 {{ .Staging.String }}</>{{ end }}{{ if and (.Staging.Changed) (.Working.Changed) }} |{{ end }}{{ if .Working.Changed }}<red> \uf044 {{ .Working.String }}</>{{ end }}{{ if gt .StashCount 0 }}<lightYellow> (\uf692 {{ .StashCount }})</>{{ end }} "
}

What OS are you seeing the problem on?

Windows

Which shell are you using?

powershell

Log output

Version: 12.26.1

Segments:

ConsoleTitle(true)   -   0 ms - pwsh @ imgui_bundle
os(true)             -   0 ms -  
session(true)        -   1 ms -  huml-dkn
cmake(true)          -   6 ms -  cmake
git(true)            - 407 ms -   imgui_bundle @  dev ≡ ( 1)
python(true)         -  14 ms -   sys 3.10.9
exit(true)           -   0 ms -  
executiontime(true)  -   0 ms -   0ms 
text(true)           -   0 ms - ╭─
time(true)           -   0 ms -  10:18:41 |  3 Jan, Tuesday |
path(true)           -   0 ms -   C:\Users\huml-dkn\Desktop\imgui_bundle
text(true)           -   0 ms - ╰─
root(false)          -   0 ms -
exit(true)           -   0 ms - ff

Run duration: 457.2763ms

Cache path: C:\Users\huml-dkn\AppData\Local\oh-my-posh

Config path: C:\Users\huml-dkn\Documents\PowerShell\thewickedd.omp.json

Logs:

2023/01/03 10:18:41 Getenv
C:\Users\huml-dkn\AppData\Local
2023/01/03 10:18:41 Getenv: 0s, args: LOCALAPPDATA
2023/01/03 10:18:41 CachePath: 0s
2023/01/03 10:18:41 Getenv
C:\Users\huml-dkn\Documents\PowerShell\thewickedd.omp.json
2023/01/03 10:18:41 Getenv: 0s, args: POSH_THEME
2023/01/03 10:18:41 Shell
process name: pwsh.exe
2023/01/03 10:18:41 Shell: 15.8112ms
2023/01/03 10:18:41 resolveConfigPath: 15.8112ms
2023/01/03 10:18:41 Init: 17.36ms
2023/01/03 10:18:41 Flags: 0s
2023/01/03 10:18:41 config.loadConfig: 5.7921ms
2023/01/03 10:18:41 Flags: 0s
2023/01/03 10:18:41 Getenv

2023/01/03 10:18:41 Getenv: 0s, args: OMP_CACHE_DISABLED
2023/01/03 10:18:41 WindowsRegistryKeyValue: 0s, args: HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM\ColorizationColor
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 WindowsRegistryKeyValue
ColorizationColor(DWORD): 0xC4DA3B01
2023/01/03 10:18:41 Root: 0s
2023/01/03 10:18:41 Shell: 0s
2023/01/03 10:18:41 ErrorCode: 0s
2023/01/03 10:18:41 IsWsl: 0s
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 Pwd
C:\Users\huml-dkn\Desktop\imgui_bundle
2023/01/03 10:18:41 Pwd: 0s
2023/01/03 10:18:41 Home
C:\Users\huml-dkn
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 User
huml-dkn
2023/01/03 10:18:41 User: 0s
2023/01/03 10:18:41 Host
HUML-DKN
2023/01/03 10:18:41 Host: 0s
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 TemplateCache: 0s
2023/01/03 10:18:41 Flags: 0s
2023/01/03 10:18:41 Pwd
C:\Users\huml-dkn\Desktop\imgui_bundle
2023/01/03 10:18:41 Pwd: 0s
2023/01/03 10:18:41 Home
C:\Users\huml-dkn
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 TemplateCache: 0s
2023/01/03 10:18:41 TemplateCache: 0s
2023/01/03 10:18:41 Shell: 0s
2023/01/03 10:18:41 Pwd
C:\Users\huml-dkn\Desktop\imgui_bundle
2023/01/03 10:18:41 Pwd: 0s
2023/01/03 10:18:41 Home
C:\Users\huml-dkn
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 Getenv

2023/01/03 10:18:41 Getenv: 0s, args: SSH_CONNECTION
2023/01/03 10:18:41 Getenv

2023/01/03 10:18:41 Getenv: 0s, args: SSH_CLIENT
2023/01/03 10:18:41 TemplateCache: 0s
2023/01/03 10:18:41 TemplateCache: 0s
2023/01/03 10:18:41 Shell: 0s
2023/01/03 10:18:41 TemplateCache: 0s
2023/01/03 10:18:41 Pwd
C:\Users\huml-dkn\Desktop\imgui_bundle
2023/01/03 10:18:41 Pwd: 0s
2023/01/03 10:18:41 Home
C:\Users\huml-dkn
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 Pwd
C:\Users\huml-dkn\Desktop\imgui_bundle
2023/01/03 10:18:41 Pwd: 0s
2023/01/03 10:18:41 Home
C:\Users\huml-dkn
2023/01/03 10:18:41 Pwd
C:\Users\huml-dkn\Desktop\imgui_bundle
2023/01/03 10:18:41 Pwd: 0s
2023/01/03 10:18:41 HasFiles: 0s, args: *.cmake
2023/01/03 10:18:41 Pwd
C:\Users\huml-dkn\Desktop\imgui_bundle
2023/01/03 10:18:41 Pwd: 0s
2023/01/03 10:18:41 HasFiles: 0s, args: CMakeLists.txt
2023/01/03 10:18:41 Getenv
C:\Users\huml-dkn\AppData\Local
2023/01/03 10:18:41 Getenv: 0s, args: LOCALAPPDATA
2023/01/03 10:18:41 HasFilesInDir
false
2023/01/03 10:18:41 HasFilesInDir: 71.7µs, args: cmake.exe
2023/01/03 10:18:41 CommandPath
no Windows Store App
2023/01/03 10:18:41 CommandPath: 6.8264ms, args: cmake
2023/01/03 10:18:41 HasCommand: 6.8264ms, args: cmake
2023/01/03 10:18:41 TemplateCache: 0s
2023/01/03 10:18:41 TemplateCache: 0s
2023/01/03 10:18:41 Shell: 0s
2023/01/03 10:18:41 Pwd
C:\Users\huml-dkn\Desktop\imgui_bundle
2023/01/03 10:18:41 Pwd: 0s
2023/01/03 10:18:41 Home
C:\Users\huml-dkn
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 CommandPath
C:\Program Files\Git\cmd\git.exe
2023/01/03 10:18:41 CommandPath: 3.92ms, args: git.exe
2023/01/03 10:18:41 HasCommand: 3.92ms, args: git.exe
2023/01/03 10:18:41 Pwd
C:\Users\huml-dkn\Desktop\imgui_bundle
2023/01/03 10:18:41 Pwd: 0s
2023/01/03 10:18:41 HasParentFilePath: 0s, args: .git
2023/01/03 10:18:41 Home
C:\Users\huml-dkn
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 HasFolder
false
2023/01/03 10:18:41 HasFolder: 0s, args: C:\Users\huml-dkn\Desktop\imgui_bundle\.git/worktrees
2023/01/03 10:18:41 Getenv

2023/01/03 10:18:41 Getenv: 0s, args: POSH_GIT_STATUS
2023/01/03 10:18:41 RunCommand
# branch.oid 9a021c67909d5a376c9b95ffbdc22ce84630a13a
# branch.head dev
# branch.upstream origin/dev
# branch.ab +0 -0
2023/01/03 10:18:41 RunCommand: 402.8869ms, args: git.exe -C C:/Users/huml-dkn/Desktop/imgui_bundle --no-optional-locks -c core.quotepath=false -c color.status=false status -unormal --branch --porcelain=2
2023/01/03 10:18:41 HasFolder
false
2023/01/03 10:18:41 HasFolder: 0s, args: C:\Users\huml-dkn\Desktop\imgui_bundle\.git/rebase-merge
2023/01/03 10:18:41 HasFolder
false
2023/01/03 10:18:41 HasFolder: 0s, args: C:\Users\huml-dkn\Desktop\imgui_bundle\.git/rebase-apply
2023/01/03 10:18:41 HasFilesInDir
false
2023/01/03 10:18:41 HasFilesInDir: 0s, args: MERGE_MSG
2023/01/03 10:18:41 HasFilesInDir
false
2023/01/03 10:18:41 HasFilesInDir: 0s, args: CHERRY_PICK_HEAD
2023/01/03 10:18:41 HasFilesInDir
false
2023/01/03 10:18:41 HasFilesInDir: 0s, args: REVERT_HEAD
2023/01/03 10:18:41 HasFilesInDir
false
2023/01/03 10:18:41 HasFilesInDir: 0s, args: sequencer/todo
2023/01/03 10:18:41 FileContent
0000000000000000000000000000000000000000 051da156a137b64a1d68209c72ca8a30be32e42e Diederick Niehorster <dcnieho@gmail.com> 1672701589 +0100     WIP on dev: 9a021c6 Help beginners install opencv-python

2023/01/03 10:18:41 FileContent: 537.9µs, args: C:\Users\huml-dkn\Desktop\imgui_bundle\.git/logs/refs/stash
2023/01/03 10:18:41 TemplateCache: 0s
2023/01/03 10:18:41 TemplateCache: 0s
2023/01/03 10:18:41 Shell: 0s
2023/01/03 10:18:41 Pwd
C:\Users\huml-dkn\Desktop\imgui_bundle
2023/01/03 10:18:41 Pwd: 0s
2023/01/03 10:18:41 Home
C:\Users\huml-dkn
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 Pwd
C:\Users\huml-dkn\Desktop\imgui_bundle
2023/01/03 10:18:41 Pwd: 0s
2023/01/03 10:18:41 Home
C:\Users\huml-dkn
2023/01/03 10:18:41 Getenv

2023/01/03 10:18:41 Getenv: 0s, args: VIRTUAL_ENV
2023/01/03 10:18:41 Getenv

2023/01/03 10:18:41 Getenv: 0s, args: CONDA_ENV_PATH
2023/01/03 10:18:41 Getenv

2023/01/03 10:18:41 Getenv: 0s, args: CONDA_DEFAULT_ENV
2023/01/03 10:18:41 Pwd
C:\Users\huml-dkn\Desktop\imgui_bundle
2023/01/03 10:18:41 Pwd: 0s
2023/01/03 10:18:41 HasFiles: 50.6µs, args: *.py
2023/01/03 10:18:41 CommandPath
C:\Program Files\Python310\python.exe
2023/01/03 10:18:41 CommandPath: 1.0745ms, args: python
2023/01/03 10:18:41 Getenv

2023/01/03 10:18:41 Getenv: 0s, args: PYENV_ROOT
2023/01/03 10:18:41 CommandPath
C:\Program Files\Python310\python.exe
2023/01/03 10:18:41 CommandPath: 0s, args: python
2023/01/03 10:18:41 HasCommand: 0s, args: python
2023/01/03 10:18:41 RunCommand
Python 3.10.9
2023/01/03 10:18:41 RunCommand: 12.6925ms, args: python --version
2023/01/03 10:18:41 TemplateCache: 0s
2023/01/03 10:18:41 TemplateCache: 0s
2023/01/03 10:18:41 TemplateCache: 0s
2023/01/03 10:18:41 Shell: 0s
2023/01/03 10:18:41 Flags: 0s
2023/01/03 10:18:41 Pwd
C:\Users\huml-dkn\Desktop\imgui_bundle
2023/01/03 10:18:41 Pwd: 0s
2023/01/03 10:18:41 Home
C:\Users\huml-dkn
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 ErrorCode: 0s
2023/01/03 10:18:41 TemplateCache: 0s
2023/01/03 10:18:41 TemplateCache: 0s
2023/01/03 10:18:41 Shell: 0s
2023/01/03 10:18:41 TemplateCache: 0s
2023/01/03 10:18:41 Pwd
C:\Users\huml-dkn\Desktop\imgui_bundle
2023/01/03 10:18:41 Pwd: 0s
2023/01/03 10:18:41 Home
C:\Users\huml-dkn
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 ExecutionTime: 0s
2023/01/03 10:18:41 TemplateCache: 0s
2023/01/03 10:18:41 TemplateCache: 0s
2023/01/03 10:18:41 Shell: 0s
2023/01/03 10:18:41 Flags: 0s
2023/01/03 10:18:41 Pwd
C:\Users\huml-dkn\Desktop\imgui_bundle
2023/01/03 10:18:41 Pwd: 0s
2023/01/03 10:18:41 Home
C:\Users\huml-dkn
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 TemplateCache: 0s
2023/01/03 10:18:41 Shell: 0s
2023/01/03 10:18:41 Pwd
C:\Users\huml-dkn\Desktop\imgui_bundle
2023/01/03 10:18:41 Pwd: 0s
2023/01/03 10:18:41 Home
C:\Users\huml-dkn
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 TemplateCache: 0s
2023/01/03 10:18:41 TemplateCache: 0s
2023/01/03 10:18:41 Shell: 0s
2023/01/03 10:18:41 Pwd
C:\Users\huml-dkn\Desktop\imgui_bundle
2023/01/03 10:18:41 Pwd: 0s
2023/01/03 10:18:41 Home
C:\Users\huml-dkn
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 Pwd
C:\Users\huml-dkn\Desktop\imgui_bundle
2023/01/03 10:18:41 Pwd: 0s
2023/01/03 10:18:41 Shell: 0s
2023/01/03 10:18:41 Flags: 0s
2023/01/03 10:18:41 PathSeparator: 0s
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 PathSeparator: 0s
2023/01/03 10:18:41 PathSeparator: 0s
2023/01/03 10:18:41 PathSeparator: 0s
2023/01/03 10:18:41 PathSeparator: 0s
2023/01/03 10:18:41 PathSeparator: 0s
2023/01/03 10:18:41 Pwd
C:\Users\huml-dkn\Desktop\imgui_bundle
2023/01/03 10:18:41 Pwd: 0s
2023/01/03 10:18:41 IsWsl: 0s
2023/01/03 10:18:41 StackCount: 0s
2023/01/03 10:18:41 isWriteable
not current user or in group
2023/01/03 10:18:41 isWriteable
current user is member of S-1-5-32-544
2023/01/03 10:18:41 isWriteable
WRITE_DAC
WRITE_OWNER
SYNCHRONIZE
DELETE
READ_CONTROL
2023/01/03 10:18:41 isWriteable
user has write access
2023/01/03 10:18:41 DirIsWritable: 518.9µs
2023/01/03 10:18:41 TemplateCache: 0s
2023/01/03 10:18:41 TemplateCache: 0s
2023/01/03 10:18:41 Shell: 0s
2023/01/03 10:18:41 Flags: 0s
2023/01/03 10:18:41 Pwd
C:\Users\huml-dkn\Desktop\imgui_bundle
2023/01/03 10:18:41 Pwd: 0s
2023/01/03 10:18:41 Home
C:\Users\huml-dkn
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 TemplateCache: 0s
2023/01/03 10:18:41 Shell: 0s
2023/01/03 10:18:41 Pwd
C:\Users\huml-dkn\Desktop\imgui_bundle
2023/01/03 10:18:41 Pwd: 0s
2023/01/03 10:18:41 Home
C:\Users\huml-dkn
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 Root: 0s
2023/01/03 10:18:41 Pwd
C:\Users\huml-dkn\Desktop\imgui_bundle
2023/01/03 10:18:41 Pwd: 0s
2023/01/03 10:18:41 Home
C:\Users\huml-dkn
2023/01/03 10:18:41 GOOS: 0s
2023/01/03 10:18:41 ErrorCode: 0s
2023/01/03 10:18:41 TemplateCache: 0s
2023/01/03 10:18:41 Shell: 0s
2023/01/03 10:18:41 TemplateCache: 0s
2023/01/03 10:18:41 Getenv
C:\Users\huml-dkn\AppData\Local
2023/01/03 10:18:41 Getenv: 0s, args: LOCALAPPDATA
2023/01/03 10:18:41 CachePath: 0s
2023/01/03 10:18:41 Flags: 0s
JanDeDobbeleer commented 1 year ago

@dcnieho you're right, you do have a stash entry:

2023/01/03 10:18:41 FileContent
0000000000000000000000000000000000000000 051da156a137b64a1d68209c72ca8a30be32e42e Diederick Niehorster <dcnieho@gmail.com> 1672701589 +0100     WIP on dev: 9a021c6 Help beginners install opencv-python

2023/01/03 10:18:41 FileContent: 537.9µs, args: C:\Users\huml-dkn\Desktop\imgui_bundle\.git/logs/refs/stash
dcnieho commented 1 year ago

So why is the count zero when the git segment is drawn for my prompt, am i doing something wrong? I find the disconnect between the output of the segment in debug (which does show 1) and the actual prompt strange (and would like to see my stash count :p)

JanDeDobbeleer commented 1 year ago

@dcnieho you're right, I need to debug this. Stay tuned 😉

dcnieho commented 1 year ago

I just realized i left out some very important information, i am using posh-git, and my profile includes $env:POSH_GIT_ENABLED = $true. If i comment out that line in my profile, things work, i see my stash count on my prompt. All the things posted above are with posh-git integration enabled.

I would like to have posh-git for autocompletion of the git command line so it needs to be loaded with the above line (right?). Or can i load posh-git separately since i only want it for the autocomplete (there seems to be no point to using posh-git instead of your integration and they perform similarly, correct?)?

JanDeDobbeleer commented 1 year ago

@dcnieho ah, good because I couldn't reproduce the issue. When using posh-git, please only use that one as otherwise your prompt will be super slow due to duplicate git calls. I don't think we added StashCount info from posh-git before, I only added that last week (not your version). You can update to the latest by using the correct installer for your architecture from the releases page, it's 100% compatible with the Store version so you don't need to do anything after that.

dcnieho commented 1 year ago

Sorry about that! I'm on version 12.34.5 ah confirmed by the log output, but still seeing the same issue. In debug output i see the stashcount but the prompt doesn't include it. When using the posh-git integration, which of these properties should i keep?

"fetch_status": true,
"fetch_stash_count": true,
"fetch_upstream_icon": true,
"fetch_worktree_count": true

It seems i want to keep at least fetch_upstream_icon, otherwise i lose that one.

dcnieho commented 1 year ago

FWIW, removing fetch_stash_count doesn't change the issue, i still see the stash count in the debug output but not on the actual prompt

JanDeDobbeleer commented 1 year ago

@dcnieho can you show me your debug output, I need that posh-git output for this so I can quickly add that test case. Also fetch_stash_count is no longer needed (and removed from the docs, but I do see the sample still has it so will remove).

dcnieho commented 1 year ago

of course! Here a screen shot of the first bit, and the whole log:

image

Version: 12.34.5

Segments:

ConsoleTitle(true)   -   1 ms - pwsh @ imgui_bundle
os(true)             -   0 ms -  
session(true)        -   0 ms -  huml-dkn
cmake(true)          -   5 ms -  cmake
git(true)            -   4 ms -  imgui_bundle @  dev ( 1)
python(true)         -   9 ms -   sys 3.10.9
exit(true)           -   1 ms -  
executiontime(true)  -   0 ms -   0ms 
text(true)           -   0 ms - ╭─
time(true)           -   0 ms -  12:21:25 |  3 Jan, Tuesday |
path(true)           -   1 ms -   C:\Users\huml-dkn\Desktop\imgui_bundle
text(true)           -   0 ms - ╰─
root(false)          -   0 ms -
exit(true)           -   0 ms - ff

Run duration: 37.904ms

Cache path: C:\Users\huml-dkn\AppData\Local\oh-my-posh

Config path: C:\Users\huml-dkn\Documents\PowerShell\thewickedd.omp.json

Logs:

2023/01/03 12:21:25 Getenv
C:\Users\huml-dkn\AppData\Local
2023/01/03 12:21:25 Getenv: 0s, args: LOCALAPPDATA
2023/01/03 12:21:25 CachePath: 0s
2023/01/03 12:21:25 Getenv
C:\Users\huml-dkn\Documents\PowerShell\thewickedd.omp.json
2023/01/03 12:21:25 Getenv: 0s, args: POSH_THEME
2023/01/03 12:21:25 Shell
process name: pwsh.exe
2023/01/03 12:21:25 Shell: 9.4315ms
2023/01/03 12:21:25 resolveConfigPath: 9.4315ms
2023/01/03 12:21:25 Init: 11.7209ms
2023/01/03 12:21:25 Flags: 0s
2023/01/03 12:21:25 config.loadConfig: 616µs
2023/01/03 12:21:25 Flags: 0s
2023/01/03 12:21:25 Getenv

2023/01/03 12:21:25 Getenv: 0s, args: OMP_CACHE_DISABLED
2023/01/03 12:21:25 WindowsRegistryKeyValue: 0s, args: HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM\ColorizationColor
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 WindowsRegistryKeyValue
ColorizationColor(DWORD): 0xC4DA3B01
2023/01/03 12:21:25 Root: 0s
2023/01/03 12:21:25 Shell: 0s
2023/01/03 12:21:25 ErrorCode: 0s
2023/01/03 12:21:25 IsWsl: 0s
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 Pwd
C:\Users\huml-dkn\Desktop\imgui_bundle
2023/01/03 12:21:25 Pwd: 0s
2023/01/03 12:21:25 Home
C:\Users\huml-dkn
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 User
huml-dkn
2023/01/03 12:21:25 User: 0s
2023/01/03 12:21:25 Host
HUML-DKN
2023/01/03 12:21:25 Host: 0s
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 TemplateCache: 0s
2023/01/03 12:21:25 Flags: 0s
2023/01/03 12:21:25 Pwd
C:\Users\huml-dkn\Desktop\imgui_bundle
2023/01/03 12:21:25 Pwd: 0s
2023/01/03 12:21:25 Home
C:\Users\huml-dkn
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 TemplateCache: 0s
2023/01/03 12:21:25 TemplateCache: 0s
2023/01/03 12:21:25 Shell: 0s
2023/01/03 12:21:25 Pwd
C:\Users\huml-dkn\Desktop\imgui_bundle
2023/01/03 12:21:25 Pwd: 0s
2023/01/03 12:21:25 Home
C:\Users\huml-dkn
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 Getenv

2023/01/03 12:21:25 Getenv: 0s, args: SSH_CONNECTION
2023/01/03 12:21:25 Getenv

2023/01/03 12:21:25 Getenv: 0s, args: SSH_CLIENT
2023/01/03 12:21:25 TemplateCache: 0s
2023/01/03 12:21:25 TemplateCache: 0s
2023/01/03 12:21:25 Shell: 0s
2023/01/03 12:21:25 TemplateCache: 0s
2023/01/03 12:21:25 Pwd
C:\Users\huml-dkn\Desktop\imgui_bundle
2023/01/03 12:21:25 Pwd: 0s
2023/01/03 12:21:25 Home
C:\Users\huml-dkn
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 Pwd
C:\Users\huml-dkn\Desktop\imgui_bundle
2023/01/03 12:21:25 Pwd: 0s
2023/01/03 12:21:25 Home
C:\Users\huml-dkn
2023/01/03 12:21:25 Pwd
C:\Users\huml-dkn\Desktop\imgui_bundle
2023/01/03 12:21:25 Pwd: 0s
2023/01/03 12:21:25 HasFiles: 0s, args: *.cmake
2023/01/03 12:21:25 Pwd
C:\Users\huml-dkn\Desktop\imgui_bundle
2023/01/03 12:21:25 Pwd: 0s
2023/01/03 12:21:25 HasFiles: 0s, args: CMakeLists.txt
2023/01/03 12:21:25 CommandPath
exec: "cmake": executable file not found in %PATH%
2023/01/03 12:21:25 CommandPath: 5.9044ms, args: cmake
2023/01/03 12:21:25 HasCommand: 5.9044ms, args: cmake
2023/01/03 12:21:25 TemplateCache: 0s
2023/01/03 12:21:25 TemplateCache: 0s
2023/01/03 12:21:25 Shell: 0s
2023/01/03 12:21:25 Pwd
C:\Users\huml-dkn\Desktop\imgui_bundle
2023/01/03 12:21:25 Pwd: 0s
2023/01/03 12:21:25 Home
C:\Users\huml-dkn
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 CommandPath
C:\Program Files\Git\cmd\git.exe
2023/01/03 12:21:25 CommandPath: 3.8654ms, args: git.exe
2023/01/03 12:21:25 HasCommand: 3.8654ms, args: git.exe
2023/01/03 12:21:25 Pwd
C:\Users\huml-dkn\Desktop\imgui_bundle
2023/01/03 12:21:25 Pwd: 0s
2023/01/03 12:21:25 HasParentFilePath: 0s, args: .git
2023/01/03 12:21:25 Home
C:\Users\huml-dkn
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 Getenv

2023/01/03 12:21:25 Getenv: 0s, args: POSH_GIT_STATUS
2023/01/03 12:21:25 FileContent
ref: refs/heads/dev

2023/01/03 12:21:25 FileContent: 0s, args: C:\Users\huml-dkn\Desktop\imgui_bundle\.git/HEAD
2023/01/03 12:21:25 TemplateCache: 0s
2023/01/03 12:21:25 TemplateCache: 0s
2023/01/03 12:21:25 FileContent
0000000000000000000000000000000000000000 051da156a137b64a1d68209c72ca8a30be32e42e Diederick Niehorster <dcnieho@gmail.com> 1672701589 +0100   WIP on dev: 9a021c6 Help beginners install opencv-python

2023/01/03 12:21:25 FileContent: 0s, args: C:\Users\huml-dkn\Desktop\imgui_bundle\.git/logs/refs/stash
2023/01/03 12:21:25 Shell: 0s
2023/01/03 12:21:25 Pwd
C:\Users\huml-dkn\Desktop\imgui_bundle
2023/01/03 12:21:25 Pwd: 0s
2023/01/03 12:21:25 Home
C:\Users\huml-dkn
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 Pwd
C:\Users\huml-dkn\Desktop\imgui_bundle
2023/01/03 12:21:25 Pwd: 0s
2023/01/03 12:21:25 Home
C:\Users\huml-dkn
2023/01/03 12:21:25 Getenv

2023/01/03 12:21:25 Getenv: 0s, args: VIRTUAL_ENV
2023/01/03 12:21:25 Getenv

2023/01/03 12:21:25 Getenv: 0s, args: CONDA_ENV_PATH
2023/01/03 12:21:25 Getenv

2023/01/03 12:21:25 Getenv: 0s, args: CONDA_DEFAULT_ENV
2023/01/03 12:21:25 Pwd
C:\Users\huml-dkn\Desktop\imgui_bundle
2023/01/03 12:21:25 Pwd: 0s
2023/01/03 12:21:25 HasFiles: 502.9µs, args: *.py
2023/01/03 12:21:25 CommandPath
C:\Program Files\Python310\python.exe
2023/01/03 12:21:25 CommandPath: 551.5µs, args: python
2023/01/03 12:21:25 Getenv

2023/01/03 12:21:25 Getenv: 0s, args: PYENV_ROOT
2023/01/03 12:21:25 CommandPath
C:\Program Files\Python310\python.exe
2023/01/03 12:21:25 CommandPath: 0s, args: python
2023/01/03 12:21:25 HasCommand: 0s, args: python
2023/01/03 12:21:25 RunCommand
Python 3.10.9
2023/01/03 12:21:25 RunCommand: 7.849ms, args: python --version
2023/01/03 12:21:25 TemplateCache: 0s
2023/01/03 12:21:25 TemplateCache: 0s
2023/01/03 12:21:25 TemplateCache: 0s
2023/01/03 12:21:25 Shell: 0s
2023/01/03 12:21:25 Flags: 0s
2023/01/03 12:21:25 Pwd
C:\Users\huml-dkn\Desktop\imgui_bundle
2023/01/03 12:21:25 Pwd: 0s
2023/01/03 12:21:25 Home
C:\Users\huml-dkn
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 ErrorCode: 0s
2023/01/03 12:21:25 TemplateCache: 0s
2023/01/03 12:21:25 TemplateCache: 0s
2023/01/03 12:21:25 Shell: 0s
2023/01/03 12:21:25 TemplateCache: 0s
2023/01/03 12:21:25 Pwd
C:\Users\huml-dkn\Desktop\imgui_bundle
2023/01/03 12:21:25 Pwd: 0s
2023/01/03 12:21:25 Home
C:\Users\huml-dkn
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 ExecutionTime: 0s
2023/01/03 12:21:25 TemplateCache: 0s
2023/01/03 12:21:25 TemplateCache: 0s
2023/01/03 12:21:25 Shell: 0s
2023/01/03 12:21:25 Flags: 0s
2023/01/03 12:21:25 Pwd
C:\Users\huml-dkn\Desktop\imgui_bundle
2023/01/03 12:21:25 Pwd: 0s
2023/01/03 12:21:25 Home
C:\Users\huml-dkn
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 TemplateCache: 0s
2023/01/03 12:21:25 Shell: 0s
2023/01/03 12:21:25 Pwd
C:\Users\huml-dkn\Desktop\imgui_bundle
2023/01/03 12:21:25 Pwd: 0s
2023/01/03 12:21:25 Home
C:\Users\huml-dkn
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 TemplateCache: 0s
2023/01/03 12:21:25 TemplateCache: 0s
2023/01/03 12:21:25 Shell: 0s
2023/01/03 12:21:25 Pwd
C:\Users\huml-dkn\Desktop\imgui_bundle
2023/01/03 12:21:25 Pwd: 0s
2023/01/03 12:21:25 Home
C:\Users\huml-dkn
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 Pwd
C:\Users\huml-dkn\Desktop\imgui_bundle
2023/01/03 12:21:25 Pwd: 0s
2023/01/03 12:21:25 Shell: 0s
2023/01/03 12:21:25 Flags: 0s
2023/01/03 12:21:25 PathSeparator: 0s
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 PathSeparator: 0s
2023/01/03 12:21:25 PathSeparator: 0s
2023/01/03 12:21:25 PathSeparator: 0s
2023/01/03 12:21:25 PathSeparator: 0s
2023/01/03 12:21:25 PathSeparator: 0s
2023/01/03 12:21:25 Pwd
C:\Users\huml-dkn\Desktop\imgui_bundle
2023/01/03 12:21:25 Pwd: 0s
2023/01/03 12:21:25 IsWsl: 0s
2023/01/03 12:21:25 StackCount: 0s
2023/01/03 12:21:25 isWriteable
not current user or in group
2023/01/03 12:21:25 isWriteable
current user is member of S-1-5-32-544
2023/01/03 12:21:25 isWriteable
WRITE_DAC
WRITE_OWNER
SYNCHRONIZE
DELETE
READ_CONTROL
2023/01/03 12:21:25 isWriteable
user has write access
2023/01/03 12:21:25 DirIsWritable: 1.0488ms
2023/01/03 12:21:25 TemplateCache: 0s
2023/01/03 12:21:25 TemplateCache: 0s
2023/01/03 12:21:25 Shell: 0s
2023/01/03 12:21:25 Flags: 0s
2023/01/03 12:21:25 Pwd
C:\Users\huml-dkn\Desktop\imgui_bundle
2023/01/03 12:21:25 Pwd: 0s
2023/01/03 12:21:25 Home
C:\Users\huml-dkn
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 TemplateCache: 0s
2023/01/03 12:21:25 Shell: 0s
2023/01/03 12:21:25 Pwd
C:\Users\huml-dkn\Desktop\imgui_bundle
2023/01/03 12:21:25 Pwd: 0s
2023/01/03 12:21:25 Home
C:\Users\huml-dkn
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 Root: 0s
2023/01/03 12:21:25 Pwd
C:\Users\huml-dkn\Desktop\imgui_bundle
2023/01/03 12:21:25 Pwd: 0s
2023/01/03 12:21:25 Home
C:\Users\huml-dkn
2023/01/03 12:21:25 GOOS: 0s
2023/01/03 12:21:25 ErrorCode: 0s
2023/01/03 12:21:25 TemplateCache: 0s
2023/01/03 12:21:25 Shell: 0s
2023/01/03 12:21:25 TemplateCache: 0s
2023/01/03 12:21:25 Getenv
C:\Users\huml-dkn\AppData\Local
2023/01/03 12:21:25 Getenv: 0s, args: LOCALAPPDATA
2023/01/03 12:21:25 CachePath: 0s
2023/01/03 12:21:25 Flags: 0s
JanDeDobbeleer commented 1 year ago

@dcnieho this isn't loading posh-git as the POSH_GIT_STATUS env var is empty.

2023/01/03 12:21:25 Getenv

2023/01/03 12:21:25 Getenv: 0s, args: POSH_GIT_STATUS

I can't explain this btw, there's no difference in debug and prompt logic for oh-my-posh.... The only way this can happen is that you initialise a different version of oh-my-posh in your $PROFILE.

dcnieho commented 1 year ago

@JanDeDobbeleer Very strange. I have only one oh-my-posh executable on my pc, installed with winget. This is what all that is relevant in my $PROFILE:

$configPath = Join-Path -Path (Split-Path $PROFILE -Parent) -ChildPath "thewickedd.omp.json"
oh-my-posh init pwsh --config $configPath | Invoke-Expression
$env:POSH_GIT_ENABLED = $true
$env:VIRTUAL_ENV_DISABLE_PROMPT = 1 # stop python venv activate from changing prompt

should i be doing Import-Module -Global posh-git somewhere? If so, before or after loading oh-my-posh? $env:POSH_GIT_ENABLED = $true makes it so that posh-git gets loaded, right?

JanDeDobbeleer commented 1 year ago

@dcnieho yes, you need to import that indeed. Preferably before oh-my-posh.

dcnieho commented 1 year ago

Ok, that still didn't fix it. There are possibly multiple problems here.

  1. Indeed $env:POSH_GIT_STATUS is empty
  2. Digging through git-posh, i found that whether StashCount is updated is controlled by $GitPromptSettings.EnableStashStatus. That for some reason is false for me.
  3. Debug doesn't match actual prompt.

So, see this on a fresh pwsh: image

I do not know why problem 1 occurs. But i have also noticed that my transient prompt doesn't work until i manually reload the oh-my-posh config again by issuing oh-my-posh init pwsh --config $configPath | Invoke-Expression again. Manually reloading however doesn't lead to $env:POSH_GIT_STATUS being filled. How the prompt works at all without $env:POSH_GIT_STATUS being filled, i do not know :p

why the debug doesn't match the prompt i do not know. But i do notice in the debug output:

2023/01/03 12:21:25 Getenv: 0s, args: POSH_GIT_STATUS
2023/01/03 12:21:25 FileContent
ref: refs/heads/dev

2023/01/03 12:21:25 FileContent: 0s, args: C:\Users\huml-dkn\Desktop\imgui_bundle\.git/HEAD
2023/01/03 12:21:25 TemplateCache: 0s
2023/01/03 12:21:25 TemplateCache: 0s
2023/01/03 12:21:25 FileContent
0000000000000000000000000000000000000000 051da156a137b64a1d68209c72ca8a30be32e42e Diederick Niehorster <dcnieho@gmail.com> 1672701589 +0100   WIP on dev: 9a021c6 Help beginners install opencv-python

2023/01/03 12:21:25 FileContent: 0s, args: C:\Users\huml-dkn\Desktop\imgui_bundle\.git/logs/refs/stash
2023/01/03 12:21:25 Shell: 0s

Why is it opening C:\Users\huml-dkn\Desktop\imgui_bundle\.git/logs/refs/stash if the info should come from git-posh, some fallback? That only gets run in debug?

JanDeDobbeleer commented 1 year ago

But i have also noticed that my transient prompt doesn't work until i manually reload the oh-my-posh config again by issuing oh-my-posh init pwsh --config $configPath | Invoke-Expression again.

The transient prompt should be changeable without a reload.

How the prompt works at all without $env:POSH_GIT_STATUS being filled, i do not know :p

@dcnieho your prompt works with posh-git as you enable that setting and you get a working prompt. And I know why debug doesn't work for posh-git, it isn't loaded when using the debug command. It's removed as soon as we render the prompt (see here).

dcnieho commented 1 year ago

So in any case, setting $GitPromptSettings.EnableStashStatus = $true in my profile makes things work. I think that should either be documented, or done by oh my posh when wanted (perhaps again allow setting fetch_stash_count?).

dcnieho commented 1 year ago

But i have also noticed that my transient prompt doesn't work until i manually reload the oh-my-posh config again by issuing oh-my-posh init pwsh --config $configPath | Invoke-Expression again.

The transient prompt should be changeable without a reload.

Indeed it is, I've noticed that now while playing with it. The issue i have is it doesn't work on first load. I'll post a separate issue for that.

How the prompt works at all without $env:POSH_GIT_STATUS being filled, i do not know :p

@dcnieho your prompt works with posh-git as you enable that setting and you get a working prompt. And I know why debug doesn't work for posh-git, it isn't loaded when using the debug command. It's removed as soon as we render the prompt (see here).

Ah ok, that explains that :) Indeed, it is working!

JanDeDobbeleer commented 1 year ago

Indeed it is, I've noticed that now while playing with it. The issue i have is it doesn't work on first load. I'll post a separate issue for that.

@dcnieho replied, once again config ;-)

dcnieho commented 1 year ago

So in any case, setting $GitPromptSettings.EnableStashStatus = $true in my profile makes things work. I think that should either be documented, or done by oh my posh when wanted (perhaps again allow setting fetch_stash_count?).

Do you think documentation is best, or do we need to re-introduce the fetch_stash_count property which, if using posh-git, will set the flag for you?

JanDeDobbeleer commented 1 year ago

@dcnieho that's not possible as it requires parsing the config from PowerShell which we don't do. I expect that people read the posh-git manual 😅

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.