Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Caching the Git segment doesn't update after duration if you render the prompt again before it expires #6011

Closed
1 task done
heaths opened this issue Dec 14, 2024 · 3 comments
Assignees
Labels
🐛 bug Something isn't working

Comments

@heaths
Copy link
Contributor

heaths commented Dec 14, 2024

Code of Conduct

  • I agree to follow this project's Code of Conduct

What happened?

I enabled caching for the Git segment but, after switching branches, noticed that the previous branch was still showing long after the duration should've expired. I noticed this while, testing it, I was just pressing enter with no command, or running ls just to run some command. If I left the terminal sit till the duration expired and hit enter, the right branch was rendered.

It looks like the duration resets every time the segment is rendered:

segment.env.Session().Set(segment.cacheKey(), string(data), segment.Cache.Duration)

Or is this the intent? Docs don't say specifically, but it seems like the duration of the segment should not be reset each time the segment is rendered. For a terminal junky like me, it may mean my git branch may never be updated until I go to sleep for the night.

Theme

Custom theme: https://github.com/heaths/oh-my-posh/blob/49064af79cc3c0b188481a93d99ae475673f4bf0/theme.omp.yml#L96-L116

But I added:

cache:
  duration: 1m
  strategy: folder

What OS are you seeing the problem on?

Linux

Which shell are you using?

bash

Log output

Version: 24.12.0

Shell: bash (5.2.37(1)-release)

Prompt:

�]133;D;0��]133;A� bash  heaths  �]8;;file:�\~/.config/oh-my-posh�]8;;\ 
  foo ≢  ~1  �]133;B�

Segments:

ConsoleTitle(true)                         -   0 ms
Shell(true)                                -   0 ms
Python(false)                              -   1 ms
Executiontime(false)                       -   0 ms
Status(false)                              -   1 ms
Session(true)                              -   3 ms
Root(false)                                -   0 ms
Path(true)                                 -   0 ms
Git(true)                                  -  11 ms

Run duration: 25.589708ms

Cache path: /Users/heaths/.cache/oh-my-posh

Config path: /Users/heaths/.config/oh-my-posh/theme.omp.yml

Logs:

�[38;2;191;207;240m[DEBUG] �[38;2;156;231;201m02:07:19.296 �[0mcommand.go:execute:989�[38;2;156;231;201m →�[0m debug mode enabled
�[38;2;204;137;214m[TRACE] �[38;2;156;231;201m02:07:19.296 �[0mdebug.go() - �[38;2;156;231;201m7.208µs�[0m
�[38;2;204;137;214m[TRACE] �[38;2;156;231;201m02:07:19.298 �[0mload.go:Load() - �[38;2;156;231;201m1.755375ms�[0m
�[38;2;204;137;214m[TRACE] �[38;2;156;231;201m02:07:19.298 �[0mdebug.go() - �[38;2;156;231;201m1.767167ms�[0m
[DEBUG] 02:07:19.298 debug.go:52 → plain mode enabled
[DEBUG] 02:07:19.298 home.go:Home:16 → /Users/heaths
[TRACE] 02:07:19.298 terminal.go() - 27.083µs
[DEBUG] 02:07:19.298 terminal.go:59 → loading cache file: /Users/heaths/.cache/oh-my-posh/omp.cache
[DEBUG] 02:07:19.298 terminal.go:59 → loading cache key: is_wsl
[DEBUG] 02:07:19.298 terminal.go:59 → loading cache key: environment_platform
[TRACE] 02:07:19.298 terminal.go(/Users/heaths/.cache/oh-my-posh/omp.cache) - 90.709µs
[DEBUG] 02:07:19.298 home.go:Home:16 → /Users/heaths
[TRACE] 02:07:19.298 terminal.go() - 11.75µs
[DEBUG] 02:07:19.298 terminal.go:59 → loading cache file: /Users/heaths/.cache/oh-my-posh/omp.cache.ff73afe3-64c6-4546-b9b5-a4799909593c
[DEBUG] 02:07:19.298 terminal.go:59 → loading cache key: prompt_count_cache
[DEBUG] 02:07:19.298 terminal.go:59 → loading cache key: template_cache
[TRACE] 02:07:19.298 terminal.go(/Users/heaths/.cache/oh-my-posh/omp.cache.ff73afe3-64c6-4546-b9b5-a4799909593c) - 330.625µs
[TRACE] 02:07:19.298 terminal.go:Init() - 459ns
[TRACE] 02:07:19.298 terminal.go() - 41ns
[DEBUG] 02:07:19.299 terminal.go:Init:67 → /Users/heaths/.config/oh-my-posh
[TRACE] 02:07:19.299 terminal.go:Init() - 10.333µs
[TRACE] 02:07:19.299 debug.go() - 496.833µs
[TRACE] 02:07:19.299 init.go:Init() - 83ns
[TRACE] 02:07:19.299 cache.go:loadCache() - 42ns
[TRACE] 02:07:19.299 cache.go:loadCache() - 68.333µs
[DEBUG] 02:07:19.299 debug.go:61 → terminal program: iTerm.app
[DEBUG] 02:07:19.299 debug.go:61 → terminal shell: shell
[DEBUG] 02:07:19.299 config.go:MakeColors:58 → NO DATA
[TRACE] 02:07:19.299 config.go:MakeColors(OMP_CACHE_DISABLED) - 3.459µs
[ERROR] 02:07:19.306 colors_darwin.go:GetAccentColor:12 → exit status 1
[DEBUG] 02:07:19.306 colors_darwin.go:GetAccentColor:12 ↓
    2024-12-14 02:07:19.305 defaults[61412:389347] 
    The domain/default pair of (kCFPreferencesAnyApplication, AppleAccentColor) does not exist
    
[TRACE] 02:07:19.306 colors_darwin.go:GetAccentColor(defaults read -g AppleAccentColor) - 7.003667ms
[ERROR] 02:07:19.306 colors.go:SetAccentColor:178 → exit status 1
[TRACE] 02:07:19.306 colors.go:MakeColors() - 7.009125ms
[TRACE] 02:07:19.306 debug.go:PrintDebug() - 83ns
[DEBUG] 02:07:19.306 debug.go:PrintDebug:16 → 5.2.37(1)-release
[TRACE] 02:07:19.306 debug.go:PrintDebug(POSH_SHELL_VERSION) - 3.5µs
[DEBUG] 02:07:19.306 debug.go:72 → segment: Title
[TRACE] 02:07:19.306 engine.go:getTitleTemplateText({{ $pwd := .PWD -}} {{ .Shell }} in {{ with $repo := .Segments.Git -}}   {{ if (gt (sub (len $pwd) (len $repo.Dir)) 20) -}}     git:{{ $repo.RepoName }}/…/{{ base $pwd }}   {{- else -}}     git:{{ $repo.RepoName }}{{ trimPrefix $repo.Dir $pwd}}   {{- end }} {{- else -}}   {{ .Folder }} {{- end }}) - 366.125µs
[TRACE] 02:07:19.306 primary.go:needsPrimaryRightPrompt() - 42ns
[TRACE] 02:07:19.306 primary.go:writePrimaryPrompt() - 167ns
[TRACE] 02:07:19.306 primary.go:writePrimaryPrompt() - 41ns
[DEBUG] 02:07:19.306 terminal.go:CursorPosition:583 → NO DATA
[TRACE] 02:07:19.306 terminal.go:CursorPosition(POSH_CURSOR_LINE) - 2.167µs
[DEBUG] 02:07:19.306 terminal.go:CursorPosition:587 → NO DATA
[TRACE] 02:07:19.306 terminal.go:CursorPosition(POSH_CURSOR_COLUMN) - 1.459µs
[TRACE] 02:07:19.306 primary.go:writePrimaryPrompt() - 42ns
[TRACE] 02:07:19.306 primary.go:writePrimaryPrompt() - 0s
[TRACE] 02:07:19.306 segment.go:Execute() - 42ns
[DEBUG] 02:07:19.306 home.go:Home:16 → /Users/heaths
[TRACE] 02:07:19.306 terminal.go:DirMatchesOneOf() - 42ns
[DEBUG] 02:07:19.306 segment.go:Execute:109 → segment: Path
[DEBUG] 02:07:19.306 segment.go:Execute:111 → no toggles found
[TRACE] 02:07:19.306 segment.go:Execute() - 125ns
[TRACE] 02:07:19.306 segment.go:Execute() - 84ns
[DEBUG] 02:07:19.306 path.go:147 → display_cygpath: false
[TRACE] 02:07:19.306 path.go:setPaths() - 41ns
[TRACE] 02:07:19.306 path.go:setPaths() - 42ns
[DEBUG] 02:07:19.306 home.go:Home:16 → /Users/heaths
[TRACE] 02:07:19.306 path.go:setPaths() - 42ns
[TRACE] 02:07:19.306 terminal.go:DirMatchesOneOf() - 41ns
[DEBUG] 02:07:19.306 home.go:Home:16 → /Users/heaths
[DEBUG] 02:07:19.306 segment.go:Execute:109 → segment: Shell
[TRACE] 02:07:19.306 terminal.go:DirMatchesOneOf() - 42ns
[TRACE] 02:07:19.306 path.go:setPaths() - 41ns
[DEBUG] 02:07:19.306 segment.go:Execute:111 → no toggles found
[TRACE] 02:07:19.306 path.go:parsePath() - 42ns
[DEBUG] 02:07:19.306 segment.go:Execute:109 → segment: Executiontime
[DEBUG] 02:07:19.306 segment.go:Execute:111 → no toggles found
[DEBUG] 02:07:19.306 executiontime.go:Enabled:55 → always_enabled: false
[TRACE] 02:07:19.306 executiontime.go:Enabled() - 83ns
[DEBUG] 02:07:19.306 executiontime.go:Enabled:57 → threshold: 500.000000
[DEBUG] 02:07:19.306 path.go:setMappedLocations:557 → mapped_locations_enabled: true
[TRACE] 02:07:19.306 segment.go:Execute() - 42ns
[DEBUG] 02:07:19.306 path.go:setMappedLocations:558 → 
[TRACE] 02:07:19.306 segment.go:Execute() - 83ns
[DEBUG] 02:07:19.306 path.go:setMappedLocations:559 → 
[DEBUG] 02:07:19.306 home.go:Home:16 → /Users/heaths
[TRACE] 02:07:19.306 terminal.go:DirMatchesOneOf() - 42ns
[DEBUG] 02:07:19.306 home.go:Home:16 → /Users/heaths
[DEBUG] 02:07:19.306 segment.go:Execute:109 → segment: Session
[TRACE] 02:07:19.306 clean.go:Clean() - 42ns
[DEBUG] 02:07:19.306 segment.go:Execute:111 → no toggles found
[DEBUG] 02:07:19.306 shell.go:Enabled:26 → mapped_shell_names: map[powershell:PS pwsh:PS]
[TRACE] 02:07:19.306 shell.go:Enabled() - 41ns
[DEBUG] 02:07:19.306 session.go:activeSSHSession:31 → NO DATA
[TRACE] 02:07:19.306 shell.go:Enabled() - 41ns
[TRACE] 02:07:19.306 session.go:activeSSHSession(SSH_CONNECTION) - 2.292µs
[DEBUG] 02:07:19.306 session.go:activeSSHSession:31 → NO DATA
[TRACE] 02:07:19.306 session.go:activeSSHSession(SSH_CLIENT) - 1.25µs
[DEBUG] 02:07:19.306 home.go:Home:16 → /Users/heaths
[TRACE] 02:07:19.306 segment.go:Execute() - 0s
[DEBUG] 02:07:19.306 session.go:activeSSHSession:37 → darwin
[TRACE] 02:07:19.306 terminal.go:DirMatchesOneOf() - 83ns
[DEBUG] 02:07:19.306 segment.go:Execute:109 → segment: Python
[DEBUG] 02:07:19.306 home.go:Home:16 → /Users/heaths
[TRACE] 02:07:19.306 terminal.go:DirMatchesOneOf() - 0s
[DEBUG] 02:07:19.306 segment.go:Execute:109 → segment: Root
[DEBUG] 02:07:19.306 segment.go:Execute:111 → no toggles found
[DEBUG] 02:07:19.306 segment.go:Execute:111 → no toggles found
[DEBUG] 02:07:19.306 python.go:Enabled:56 → environment
[TRACE] 02:07:19.306 root.go:Enabled() - 417ns
[DEBUG] 02:07:19.306 language.go:Enabled:118 → extensions: [*.py *.ipynb pyproject.toml venv.bak]
[DEBUG] 02:07:19.306 language.go:Enabled:119 → folders: [.venv venv virtualenv venv-win pyenv-win]
[DEBUG] 02:07:19.306 language.go:Enabled:126 → home_enabled: false
[DEBUG] 02:07:19.306 home.go:Home:16 → /Users/heaths
[DEBUG] 02:07:19.306 python.go:loadContext:64 → fetch_virtual_env: true
[TRACE] 02:07:19.306 path.go:normalize() - 208ns
[TRACE] 02:07:19.306 segment.go:Execute() - 42ns
[TRACE] 02:07:19.306 path.go:normalize() - 41ns
[DEBUG] 02:07:19.306 path.go:setMappedLocations:560 → ~
[DEBUG] 02:07:19.306 home.go:Home:16 → /Users/heaths
[TRACE] 02:07:19.306 terminal.go:DirMatchesOneOf() - 41ns
[DEBUG] 02:07:19.306 segment.go:Execute:109 → segment: Status
[DEBUG] 02:07:19.306 segment.go:Execute:111 → no toggles found
[TRACE] 02:07:19.306 status.go:Enabled() - 0s
[DEBUG] 02:07:19.306 status.go:formatStatus:45 → {{ .Code }}
[DEBUG] 02:07:19.306 path.go:setMappedLocations:565 → mapped_locations: map[]
[TRACE] 02:07:19.306 clean.go:Clean() - 42ns
[TRACE] 02:07:19.306 path.go:normalize() - 0s
[TRACE] 02:07:19.306 path.go:normalize() - 42ns
[TRACE] 02:07:19.306 clean.go:Clean() - 0s
[ERROR] 02:07:19.306 python.go:pyvenvCfgPrompt:172 → exec: "python": executable file not found in $PATH
[TRACE] 02:07:19.306 python.go:pyvenvCfgPrompt(python) - 73.041µs
[DEBUG] 02:07:19.306 python.go:pyvenvCfgPrompt:174 → /usr/bin/python3
[TRACE] 02:07:19.306 python.go:pyvenvCfgPrompt(python3) - 184.834µs
[TRACE] 02:07:19.307 path.go:normalize() - 42ns
[TRACE] 02:07:19.307 path.go:normalize() - 0s
[TRACE] 02:07:19.307 path.go:parsePath() - 41ns
[TRACE] 02:07:19.307 path.go:parsePath() - 42ns
[TRACE] 02:07:19.307 path.go:parsePath() - 0s
[DEBUG] 02:07:19.307 path.go:makeFolderFormatMap:833 → NO DATA
[DEBUG] 02:07:19.307 path.go:setStyle:213 → full
[DEBUG] 02:07:19.307 path.go:colorizePath:734 → cycle: []
[DEBUG] 02:07:19.307 path.go:getFolderSeparator:267 → NO DATA
[DEBUG] 02:07:19.307 path.go:getFolderSeparator:269 → /
[DEBUG] 02:07:19.307 path.go:colorizePath:737 → cycle_folder_separator: false
[DEBUG] 02:07:19.307 path.go:colorizePath:738 → %s
[DEBUG] 02:07:19.307 path.go:colorizePath:740 → %s
[DEBUG] 02:07:19.307 path.go:colorizePath:741 → %s
[DEBUG] 02:07:19.307 path.go:colorizePath:742 → %s
[TRACE] 02:07:19.307 path.go:Enabled() - 125ns
[TRACE] 02:07:19.307 path.go:Enabled() - 41ns
[TRACE] 02:07:19.307 path.go:Enabled() - 84ns
[TRACE] 02:07:19.307 path.go:Enabled(/Users/heaths/.config/oh-my-posh) - 59.458µs
[TRACE] 02:07:19.307 segment.go:string( {{ .Name }} ) - 1.222041ms
[TRACE] 02:07:19.307 status.go:formatStatus({{ .Code }}) - 1.169375ms
[DEBUG] 02:07:19.307 status.go:Enabled:37 → always_enabled: false
[TRACE] 02:07:19.307 segment.go:resolve(diamond) - 125ns
[DEBUG] 02:07:19.308 python.go:pyvenvCfgPrompt:182 → false
[TRACE] 02:07:19.308 python.go:pyvenvCfgPrompt(pyvenv.cfg) - 1.508375ms
[DEBUG] 02:07:19.308 python.go:pyvenvCfgPrompt:186 → false
[TRACE] 02:07:19.308 python.go:pyvenvCfgPrompt(pyvenv.cfg) - 91.333µs
[DEBUG] 02:07:19.308 python.go:loadContext:77 → folder_name_fallback: true
[DEBUG] 02:07:19.308 python.go:loadContext:78 → default_venv_names: [.venv venv]
[DEBUG] 02:07:19.308 python.go:loadContext:85 → NO DATA
[TRACE] 02:07:19.308 python.go:loadContext(VIRTUAL_ENV) - 1.834µs
[DEBUG] 02:07:19.308 python.go:loadContext:85 → NO DATA
[TRACE] 02:07:19.308 python.go:loadContext(CONDA_ENV_PATH) - 1.25µs
[DEBUG] 02:07:19.308 python.go:loadContext:85 → NO DATA
[TRACE] 02:07:19.308 python.go:loadContext(CONDA_DEFAULT_ENV) - 1.458µs
[TRACE] 02:07:19.308 segment.go:resolve(powerline) - 125ns
[TRACE] 02:07:19.308 segment.go:resolve(powerline) - 42ns
[TRACE] 02:07:19.308 segment.go:resolve(powerline) - 0s
[DEBUG] 02:07:19.310 session.go:activeSSHSession:41 → heaths                        Dec 14 02:07
[TRACE] 02:07:19.310 session.go:activeSSHSession(who am i) - 3.750291ms
[TRACE] 02:07:19.310 segment.go:string( {{ if .SSHSession }} {{ end }}{{ .UserName }} ) - 21.958µs
[TRACE] 02:07:19.310 segment.go:resolve(powerline) - 84ns
[TRACE] 02:07:19.310 segment.go:resolve(powerline) - 84ns
[TRACE] 02:07:19.310 segment.go:string( {{ path .Path .Location }} {{ repeat .StackCount "" }}) - 32.916µs
[TRACE] 02:07:19.310 segment.go:resolve(powerline) - 42ns
[TRACE] 02:07:19.310 engine.go:applyPowerShellBleedPatch() - 83ns
[TRACE] 02:07:19.310 engine.go:applyPowerShellBleedPatch() - 42ns
[TRACE] 02:07:19.310 segment.go:Execute() - 42ns
[DEBUG] 02:07:19.310 home.go:Home:16 → /Users/heaths
[TRACE] 02:07:19.310 terminal.go:DirMatchesOneOf() - 0s
[DEBUG] 02:07:19.310 segment.go:Execute:109 → segment: Git
[DEBUG] 02:07:19.310 segment.go:Execute:111 → no toggles found
[DEBUG] 02:07:19.310 terminal.go:HasParentFilePath:446 → /Users/heaths/.config/oh-my-posh
[TRACE] 02:07:19.310 terminal.go:HasParentFilePath(/Users/heaths/.config/oh-my-posh) - 21.083µs
[TRACE] 02:07:19.310 git.go:CacheKey(.git) - 27.25µs
[DEBUG] 02:07:19.310 segment.go:Execute:115 → no cache found for segment:  Git
[DEBUG] 02:07:19.310 terminal_unix.go:IsWsl2:49 → false
[TRACE] 02:07:19.310 terminal_unix.go:IsWsl2() - 3.625µs
[TRACE] 02:07:19.310 terminal_unix.go:InWSLSharedDrive() - 5.459µs
[TRACE] 02:07:19.310 scm.go:hasCommand() - 42ns
[DEBUG] 02:07:19.310 terminal.go:HasCommand:323 → /usr/bin/git
[TRACE] 02:07:19.310 terminal.go:HasCommand(git) - 42.5µs
[TRACE] 02:07:19.310 scm.go:hasCommand(git) - 44.125µs
[DEBUG] 02:07:19.310 git.go:shouldDisplay:328 → fetch_bare_info: false
[DEBUG] 02:07:19.310 terminal.go:HasParentFilePath:446 → /Users/heaths/.config/oh-my-posh
[TRACE] 02:07:19.310 terminal.go:HasParentFilePath(/Users/heaths/.config/oh-my-posh) - 7.834µs
[TRACE] 02:07:19.310 git.go:shouldDisplay(.git) - 11.375µs
[DEBUG] 02:07:19.310 home.go:Home:16 → /Users/heaths
[TRACE] 02:07:19.310 git.go:setDir() - 0s
[TRACE] 02:07:19.310 scm.go:convertToWindowsPath() - 42ns
[DEBUG] 02:07:19.310 git.go:Enabled:174 → fetch_user: false
[DEBUG] 02:07:19.310 git.go:Enabled:189 → cli
[DEBUG] 02:07:19.310 git.go:Enabled:194 → fetch_status: true
[DEBUG] 02:07:19.310 git.go:shouldIgnoreStatus:466 → ignore_status: []
[DEBUG] 02:07:19.310 home.go:Home:16 → /Users/heaths
[TRACE] 02:07:19.310 terminal.go:DirMatchesOneOf() - 0s
[DEBUG] 02:07:19.310 git.go:setGitStatus:612 → status_formats: map[]
[DEBUG] 02:07:19.310 git.go:getSwitchMode:911 → untracked_modes: map[]
[DEBUG] 02:07:19.310 git.go:getSwitchMode:911 → ignore_submodules: map[]
[DEBUG] 02:07:19.321 git.go:getGitCommandOutput:663 ↓
    # branch.oid 49064af79cc3c0b188481a93d99ae475673f4bf0
    # branch.head foo
    1 .M N... 100644 100644 100644 2e15f4ae4f1283143c11ae8fb4873714a2e3c6c0 2e15f4ae4f1283143c11ae8fb4873714a2e3c6c0 theme.omp.yml
[TRACE] 02:07:19.321 git.go:getGitCommandOutput(git -C /Users/heaths/.config/oh-my-posh --no-optional-locks -c core.quotepath=false -c color.status=false status -unormal --branch --porcelain=2) - 10.841166ms
[DEBUG] 02:07:19.321 git.go:setGitHEADContext:671 →  
[DEBUG] 02:07:19.321 scm.go:formatBranch:106 → mapped_branches: map[]
[DEBUG] 02:07:19.321 scm.go:formatBranch:122 → full_branch_path: true
[DEBUG] 02:07:19.321 scm.go:formatBranch:128 → branch_max_length: 0
[DEBUG] 02:07:19.321 git.go:setGitHEADContext:699 → false
[TRACE] 02:07:19.321 git.go:setGitHEADContext(/Users/heaths/.config/oh-my-posh/.git/rebase-merge) - 13.167µs
[DEBUG] 02:07:19.321 git.go:setGitHEADContext:711 → false
[TRACE] 02:07:19.321 git.go:setGitHEADContext(/Users/heaths/.config/oh-my-posh/.git/rebase-apply) - 2.75µs
[DEBUG] 02:07:19.321 git.go:setGitHEADContext:722 → 
[DEBUG] 02:07:19.321 git.go:hasGitFile:801 → false
[TRACE] 02:07:19.321 git.go:hasGitFile(MERGE_MSG) - 95.709µs
[DEBUG] 02:07:19.321 git.go:hasGitFile:801 → false
[TRACE] 02:07:19.321 git.go:hasGitFile(CHERRY_PICK_HEAD) - 3.541µs
[DEBUG] 02:07:19.321 git.go:hasGitFile:801 → false
[TRACE] 02:07:19.321 git.go:hasGitFile(REVERT_HEAD) - 3.25µs
[DEBUG] 02:07:19.321 git.go:hasGitFile:801 → false
[TRACE] 02:07:19.321 git.go:hasGitFile(sequencer/todo) - 3.125µs
[DEBUG] 02:07:19.321 git.go:482 → ≢
[DEBUG] 02:07:19.321 git.go:Enabled:207 → fetch_upstream_icon: false
[TRACE] 02:07:19.321 segment.go:string( {{ if .UpstreamURL }}{{ url .UpstreamIcon .UpstreamURL }}{{ end }}{{ .HEAD }}{{if .BranchStatus }} {{ .BranchStatus }}{{ end }}{{ if .Working.Changed }}  {{ .Working.String }}{{ end }}{{ if .Staging.Changed }}  {{ .Staging.String }}{{ end }} ) - 251.125µs
[DEBUG] 02:07:19.322 terminal.go:HasParentFilePath:446 → /Users/heaths/.config/oh-my-posh
[TRACE] 02:07:19.322 terminal.go:HasParentFilePath(/Users/heaths/.config/oh-my-posh) - 16.333µs
[TRACE] 02:07:19.322 git.go:CacheKey(.git) - 21.084µs
[TRACE] 02:07:19.322 list.go:FirstMatch({{ if or (.Working.Changed) (.Staging.Changed) }}p:yellow{{ end }}) - 18µs
[TRACE] 02:07:19.322 list.go:FirstMatch({{ if or (.Working.Changed) (.Staging.Changed) }}p:black{{ end }}) - 14.666µs
[TRACE] 02:07:19.322 segment.go:resolve(diamond) - 83ns
[TRACE] 02:07:19.322 list.go:FirstMatch({{ if or (.Working.Changed) (.Staging.Changed) }}p:yellow{{ end }}) - 13.041µs
[TRACE] 02:07:19.322 list.go:FirstMatch({{ if or (.Working.Changed) (.Staging.Changed) }}p:black{{ end }}) - 11.166µs
[TRACE] 02:07:19.322 engine.go:applyPowerShellBleedPatch() - 84ns
[TRACE] 02:07:19.322 engine.go:applyPowerShellBleedPatch() - 42ns
[TRACE] 02:07:19.322 primary.go:writePrimaryPrompt() - 42ns
[TRACE] 02:07:19.322 primary.go:Primary() - 0s
[DEBUG] 02:07:19.322 home.go:Home:16 → /Users/heaths
[TRACE] 02:07:19.322 debug.go:PrintDebug() - 13.375µs
[TRACE] 02:07:19.322 debug.go:PrintDebug() - 0s
@heaths heaths added the 🐛 bug Something isn't working label Dec 14, 2024
@JanDeDobbeleer
Copy link
Owner

@heaths that's a good point. Allow me to validate.

@heaths
Copy link
Contributor Author

heaths commented Dec 14, 2024

I've been looking through the code and have some idea of a fix - basically have restoreCache in segment.go update the duration remaining and have setCache store that instead, but if you'd rather handle it - or keep it the way it is - that's fine.

FWIW, I found this in the course of investigating to open feature request #6012 and gather ideas about how it might work.

@JanDeDobbeleer
Copy link
Owner

@heaths I believe the setCache logic is flawed as it overrides the cache with a new entry, even when it's restored. It should never set the cache again on restoration otherwise you get that exact issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants