Files
lazygit/pkg
Stefan HallerandClaude Opus 5.5 073b76c30c Read state.yml whenever lazygit reads or updates the app state
A common workflow is to keep lazygit open in several terminal tabs, one
per repo. Each instance reads state.yml once at startup and then works
on its own copy. So an instance doesn't see what other instances
changed after it started, and when it saves, it overwrites their
changes. For example, running a shell command with `:` in one tab drops
the commands that another tab added to the history. Switching repos in
one tab drops the repos that another tab added to the recent repos.

Make ReadAppState read the file every time, and make UpdateAppState
apply its change to what it finds in the file. With a full shell
command history the file has about 70 KB, and reading and parsing it
takes less than a millisecond, so we don't need a cache.

Two instances can still update the file at the same moment, and a read
can see a half-written file. The following commits lock the file and
write it atomically.

Since the file is now read at any time and not only at startup, a file
that can't be parsed reads as the defaults, and the next update
replaces it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 08:10:59 +01:00
..
2025-11-15 10:46:23 +01:00