Commit Graph
8895 Commits
Author SHA1 Message Date
Stefan HallerandClaude Opus 5.5 e7f7ad56f4 fixup! Add a dev doc with a test plan for update checks
Describe the version that dev builds show.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 16:12:05 +01:00
Stefan HallerandClaude Opus 5.5 17ccd06589 fixup! Add a dev doc with a test plan for update checks
Explain how to test a real `go install` build of a branch, by serving
the branch as a made-up release version through a local module proxy.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 16:11:57 +01:00
Stefan HallerandClaude Opus 5.5 921e33def5 fixup! Add a dev doc with a test plan for update checks
Update the doc for the changes to the update checks: Homebrew installs
get the command like other package managers, update.method "never"
only turns off reminders, the release notes are a link in the menu,
and dev builds explain in a popup why `u` can't check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 16:11:57 +01:00
Stefan HallerandClaude Opus 5.5 a72692d4b3 Add a dev doc with a test plan for update checks
Most of the update code can only be tested by hand, against real
releases, real terminals and real package managers. Whether it works
for users only shows in the release after the one that contains a
change. Describe how the feature works, and how to test it before a
release.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 16:11:57 +01:00
Stefan HallerandClaude Opus 5.5 5e274abe8a Explain in the README how to install a release that updates itself
The update menu and the message after exiting link to these
instructions, for users whose package manager has an older version, or
whose lazygit is in a folder that they can't write to. Released
versions keep linking to them, so give the section an explicit anchor
that doesn't change if someone edits the heading.

The instructions for Debian and Ubuntu installed lazygit into
/usr/local/bin with sudo. lazygit can't update itself there, so
install it into ~/.local/bin instead. Also use the lowercase OS name in
the archive's name; it only worked because GitHub matches asset names
case-insensitively.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 16:11:57 +01:00
Stefan HallerandClaude Opus 5.5 0d87650ee4 fixup! Install updates without asking if update.method is "background"
Describe update.method "never" the way it works now: lazygit still
checks for updates and shows the note, but doesn't remind the user.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 16:11:57 +01:00
Stefan HallerandClaude Opus 5.5 2d58a327ec Install updates without asking if update.method is "background"
The option "background" exists, but since the background check never
ran, it never did anything.

If lazygit can update itself, i.e. it was installed from one of our
release archives into a folder that we can write to, install a new
version as soon as a check finds it. The new version takes effect the
next time the user starts lazygit; until then, the note in the
bottom-right corner says so. If installing fails, we try again in an
hour, and the user gets the usual reminders in the meantime.

For all other installs, "background" works like "prompt".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 16:11:57 +01:00
Stefan HallerandClaude Opus 5.5 61ebf761af fixup! Print a reminder of an available update when lazygit exits
Give the exit message a first line of its own. The menu's first line
now has a link to the release notes, but the exit message goes to the
terminal, and it has a line with the URL of the release notes anyway.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 16:11:57 +01:00
Stefan HallerandClaude Opus 5.5 d9b8fe5587 Print a reminder of an available update when lazygit exits
Users who use lazygit for short sessions, and never leave it idle for a
minute, don't get to see the update menu until a week after the update
came out.

Print a short message to the terminal after lazygit exits, the way gh
and npm do. The user is back in the shell at that point, where they can
run the command that we show. Do this at most once a day, and not on a
day when the user responded to the update menu.

The message doesn't count as a response to the menu. If other lazygit
instances show the menu, it stays open there, and an idle lazygit can
still show it later that day.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 16:11:57 +01:00
Stefan HallerandClaude Opus 5.5 2396d6e738 amend! Remind the user of an update when lazygit is idle
Remind the user of an update when lazygit is idle

The note in the bottom-right corner is easy to miss. Users need a
notification to actually update, but one that pops up at startup gets in
the way of the work that they started lazygit for.

Show the update menu when the user hasn't pressed a key or used the
mouse for a minute, and no other popup is open. After the user responds
to the menu, don't show it again for a day. Users who never leave
lazygit idle wouldn't see the menu at all, so also show it at startup if
the update has been available for a week and the user never responded to
the menu for it.

The menu now has "Remind me tomorrow" and "Skip this version"; closing
the menu does the same as the former. Skipping a version keeps lazygit
quiet until a newer one comes out, but the note stays.

If several lazygit instances are idle at the same time, e.g. in
different terminal tabs, all of them show the menu. Otherwise a lazygit
that the user forgot in some tab would get the reminder every day, and
the others never. When the user responds to the menu in one of them, the
others close theirs.

If update.method is never, don't show the menu; only the note appears
then. The menu tells the user about this setting.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 16:11:57 +01:00
Stefan HallerandClaude Opus 5.5 1f2bc0a4b5 Remind the user of an update when lazygit is idle
The note in the bottom-right corner is easy to miss. Users need a
notification to actually update, but one that pops up at startup gets in
the way of the work that they started lazygit for.

Show the update menu when the user hasn't pressed a key or used the
mouse for a minute, and no other popup is open. After the user responds
to the menu, don't show it again for a day. Users who never leave
lazygit idle wouldn't see the menu at all, so also show it at startup if
the update has been available for a week and the user never responded to
the menu for it.

The menu now has "Remind me tomorrow" and "Skip this version"; closing
the menu does the same as the former. Skipping a version keeps lazygit
quiet until a newer one comes out, but the note stays.

If several lazygit instances are idle at the same time, e.g. in
different terminal tabs, all of them show the menu. Otherwise a lazygit
that the user forgot in some tab would get the reminder every day, and
the others never. When the user responds to the menu in one of them, the
others close theirs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 16:11:57 +01:00
Stefan HallerandClaude Opus 5.5 f9437d937b amend! Check for updates once a day and show a note when there is one
Check for updates once a day and show a note when there is one

Before this commit, lazygit checked for updates only when the user
pressed `u` in the status panel. We want users to learn about a new
release within a day.

Check at startup if the last successful check is at least update.days
ago, and change the default from 14 days to 1. Also check every hour
whether a check is due, so that users who keep lazygit running for days
get the check too. Do all of this on a worker, with a timeout.

When a check finds a newer version, show "Update available" before the
version in the bottom-right corner. Clicking it opens the update menu.
After an update is installed, the note says "Restart to use <version>".

The result of a check goes into state.yml, so a lazygit that starts
later on the same day shows the note without asking GitHub again. For
the same reason, other running instances see the result the next time
they look at the file.

Dev builds don't get any of this. Users who set update.method to never
do get it. The note is unobtrusive, and it is useful to know that there
is a newer version even if you don't want to be reminded of it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 16:11:57 +01:00
Stefan HallerandClaude Opus 5.5 92b811be4d Check for updates once a day and show a note when there is one
lazygit currently checks for updates only when the user presses `u` in
the status panel. We want users to learn about a new release within a
day.

Check at startup if the last successful check is at least update.days
ago, and change the default from 14 days to 1. Also check every hour
whether a check is due, so that users who keep lazygit running for
days get the check too. Do all of this on a worker, with a timeout.

When a check finds a newer version, show "Update available" before the
version in the bottom-right corner. Clicking it opens the update menu.
After an update is installed, the note says "Restart to use <version>".

The result of a check goes into state.yml, so a lazygit that starts
later on the same day shows the note without asking GitHub again. For
the same reason, other running instances see the result the next time
they look at the file.

Builds that can't check for updates, and users who set update.method
to never, don't get any of this.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 16:11:57 +01:00
Stefan HallerandClaude Opus 5.5 27923a680a fixup! Rewrite the update check that u in the status panel starts
Tell Homebrew users too that package managers can take a while to get
a new version. We compare with our latest release on GitHub, and
homebrew-core usually gets it a few hours later.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 16:11:57 +01:00
Stefan HallerandClaude Opus 5.5 ce47ad1ae5 fixup! Rewrite the update check that u in the status panel starts
Don't tell the user how to turn off update checks here. Nothing in
this commit checks for updates on its own, and the hint is about
reminders, which a later commit adds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 16:11:57 +01:00
Stefan HallerandClaude Opus 5.5 b7c0fc7b69 fixup! Rewrite the update check that u in the status panel starts
Show the release notes as a link in the menu's first line instead of
as a menu item. Choosing a menu item closes the menu. If lazygit opened
the menu on its own, users might not know how to get it back after
reading the release notes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 16:11:57 +01:00
Stefan HallerandClaude Opus 5.5 3e87e673a0 fixup! Rewrite the update check that u in the status panel starts
Show why a dev build can't check for updates in a popup instead of a
toast. The user asked for the check, and a toast is easy to miss.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 16:11:57 +01:00
Stefan HallerandClaude Opus 5.5 89f269af58 Rewrite the update check that u in the status panel starts
Checking for an update with `u` has several problems:

- It offers to download and install the new version for any build
  that has a version, including builds from Homebrew or a Linux
  distribution. Overwriting those makes the package manager report the
  wrong version.
- It only logs its errors, so the user never learns why nothing
  happens. This includes "You already have the latest version". For a
  build from a git checkout, the version is a commit hash; comparing it
  with the release version fails, and the user sees nothing at all.
- Installing always fails on Windows.

Rewrite it on top of the functions from the previous commits. Show the
result of the check in all cases. If there's an update, show a menu
that depends on how lazygit was installed. We only offer "Install now"
for our release archives, and only if we can write to the folder of
the executable. For package managers that we know, we show the command
that updates lazygit. Otherwise we tell the user where to get the new
version. Disable `u` for dev builds and say why.

Installing replaces the executable with a rename, so quitting during
an update can no longer leave a broken binary behind. Instead of
asking for confirmation, wait for the rename to finish before exiting.

Remove the check at startup for now. It never ran, because it checked
for the build source "buildBinary" while .goreleaser.yml sets
"binaryRelease". A later commit adds a new one.

Use os.Executable instead of the osext package; os.Executable didn't
exist yet when this code was written.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 16:11:57 +01:00
Stefan HallerandClaude Opus 5.5 1ac7b184fa Add functions that install a release in place of the running lazygit
The current update code has several problems that we haven't seen
yet, only because it never runs at startup:

- It asks for the archive with a capitalized OS name ("Darwin"), but
  since goreleaser v2 the names are lowercase. This only works because
  GitHub matches asset names case-insensitively.
- It runs `tar` in the current folder, i.e. in the user's repo, and
  renames the extracted file to the executable from there. If the
  repo is on a different file system than the executable, the rename
  fails and leaves a stray file in the repo; if the repo has its own
  file named "lazygit", tar overwrites it.
- On Windows, it asks tar for "lazygit" instead of "lazygit.exe", and
  even with that fixed it couldn't replace the executable while it is
  running.

The new functions extract the binary in Go and write it to a
temporary file next to the executable, so that the final rename is
atomic. On Windows, they first rename the running executable, which
Windows allows, and delete it the next time lazygit runs.

Creating the temporary file also tells us whether we have write access
to the folder of the executable, e.g. /usr/local/bin. We can check this
before offering an update.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 16:11:57 +01:00
Stefan HallerandClaude Opus 5.5 463aba33ba Add a function that asks GitHub for the latest lazygit version
Unlike the current update code, it returns the version as a
VersionNumber, so that we can compare versions properly instead of
only checking whether they are equal. It also takes a context, so that
the caller can give it a timeout; the current code waits forever if
the network hangs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 16:11:57 +01:00
Stefan HallerandClaude Opus 5.5 2877762745 Add a String method to VersionNumber
The update check needs to show version numbers in a consistent format,
the same way as the docs links on the status page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 16:11:57 +01:00
Stefan HallerandClaude Opus 5.5 929aa55c54 fixup! Add a way to tell how lazygit was installed
Test that a build from a git checkout counts as a dev build, now that
its version names the release that it is based on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 16:11:57 +01:00
Stefan HallerandClaude Opus 5.5 2ab7060644 Add a way to tell how lazygit was installed
The update check needs to know how lazygit was installed. We can only
update it in place if it was installed from one of our release
archives. If a package manager installed it, overwriting it would make
the package manager report the wrong version; in that case we can only
tell the user about the update, and maybe show the command that
updates it.

The build source alone isn't enough to decide this. Scoop, winget,
Chocolatey, mise and others install our release archives unchanged, so
their binaries have the build source "binaryRelease" too. We recognize
those by the folder that the executable is in.

The test for the build source in .goreleaser.yml guards against a
mismatch like the one in the current update code, which checks for
"buildBinary" instead of "binaryRelease".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 16:11:45 +01:00
Stefan HallerandClaude Opus 5.5 cc7f8f483b Show which release a build from a git checkout is based on
For a build from a git checkout, lazygit reported the abbreviated commit hash as its version, e.g. in the bottom-right corner. This didn't say which release the build was based on, or whether it had uncommitted changes.

Go records a module version for such builds too. It is a pseudo-version
that contains the release that the commit is based on, or the tag of the
commit, followed by "+dirty" if there were uncommitted changes. Show the
release and the commit, e.g. "v0.66.3+d0d00783", the same way as for
builds made with `go install` from a branch, and append "-dirty" if
there were uncommitted changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 16:11:45 +01:00
Stefan HallerandClaude Opus 5.5 98fe043e7a amend! Report the module version for builds made with go install
Report the module version for builds made with go install

If lazygit was installed with `go install
github.com/jesseduffield/lazygit@latest`, it reported its version as
"unversioned". As a result, the status panel linked to the docs for
master instead of the docs for the installed version, and the popup with
breaking changes never appeared after an update. Builds made with `go
install` from a branch, e.g. `@master`, reported "unversioned" too, so
users couldn't tell which code they were running.

Go records the module version in the binary in these cases, but no VCS
information; we only looked at the latter. If the module version is a
release version, use it, and set the build source to "goInstall" so that
the update check can tell how lazygit was installed. If it is a
pseudo-version, show the release that the build is based on and its
commit, e.g. "v0.66.3+d0d00783".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 16:11:06 +01:00
Stefan HallerandClaude Opus 5.5 cae17f6cd0 Report the module version for builds made with go install
If lazygit was installed with `go install
github.com/jesseduffield/lazygit@latest`, it reports its version as
"unversioned". As a result, the status panel links to the docs for
master instead of the docs for the installed version, and the popup
with breaking changes never appears after an update.

Go records the module version in the binary in this case, but no VCS
information; we only looked at the latter. Use the module version if
it is a release version, and set the build source to "goInstall" so
that the update check can tell how lazygit was installed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 15:49:44 +01:00
Stefan HallerandClaude Opus 5.5 4a99ec2c1f Pass Go's build info into mergeBuildInfo
This makes it possible to test mergeBuildInfo with build info that
we construct in the test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 15:49:44 +01:00
Stefan HallerandClaude Opus 5.5 e9c15ec95e Ignore hyperlinks' escape sequences when wrapping text for a view
WrapViewLinesToWidth only recognized CSI escape sequences, which lazygit
uses for colors. It counted the OSC 8 escape sequences of hyperlinks,
including their URLs, towards the width of a line. Recognize OSC
sequences too; they end with BEL or with ESC \.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 15:49:44 +01:00
Stefan HallerandClaude Opus 5.5 dfa77684ff Add a test showing that wrapping text for a view breaks hyperlinks
WrapViewLinesToWidth counts the escape sequences of OSC 8 hyperlinks,
including their URLs, towards the width of a line. It wraps lines with
links too early, and it can even split such an escape sequence across
two lines. Nothing puts links into wrapped popup text yet, but the
update menu will.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 15:48:30 +01:00
Stefan Haller 54cc6af1d7 Don't lose shell command history and recent repos when running several lazygit instances (#6172)
If you keep lazygit open in several terminal tabs at the same time, the
instances no longer overwrite each other's saved state. Until now,
running a shell command with `:` in one tab could drop commands that you
ran in another tab, and switching repos in one tab could drop entries
from the recent repositories list. Now each instance sees the changes of
the others right away. For example, a command that you run in one tab
shows up in the shell command history of another tab.

Also:

- lazygit no longer refuses to start if its state file (`state.yml`) is
broken, for example with the error "yaml: control characters are not
allowed". It starts with the default state instead and replaces the
file. (#3023)
- If the computer crashes or loses power right after lazygit saved its
state, the state file can no longer end up filled with zero bytes.
- If lazygit can't save its state file, it no longer exits at startup.
(#4489)
2026-11-15 08:25:17 +01:00
Stefan HallerandClaude Opus 5.5 33e128eece Write state.yml atomically
os.WriteFile empties state.yml and then writes the new contents. If
lazygit crashes or the disk is full in between, the file is left empty
or partly written. An older lazygit version that runs at the same time
doesn't take the lock, so it can also read the file in this state.

Write the new contents to a temp file in the same folder and rename it
over state.yml. Sync the temp file before the rename. Otherwise the
rename can reach the disk before the data. If the machine then crashes
or loses power, state.yml is left filled with zero bytes; several users
on Windows had this (#3023).

Renaming replaces a symlink, gives the file new permissions, and
ignores a read-only state.yml. Keep the behavior of the in-place write
for these cases: replace the file that a symlink points to, give the
new file the permissions of the old one, and leave a read-only file
alone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 08:10:59 +01:00
Stefan HallerandClaude Opus 5.5 ce77cfaf92 Lock state.yml while reading or updating it
Two lazygit instances can update state.yml at the same moment. Both
read the same contents, and the second write discards the change of the
first. Also, os.WriteFile empties the file before it writes the new
contents. An instance that reads the file at that moment gets an empty
file, which reads as the default state, or a partial one, which doesn't
parse. This can already happen when several instances start at once,
for example when a tmux session is restored, because each of them
updates state.yml at startup.

Take an exclusive lock on a separate lock file while updating, and a
shared one while reading. Each lock call opens the lock file anew, so
the lock also keeps goroutines of the same instance apart; the test
relies on this.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 08:10:59 +01:00
Stefan HallerandClaude Opus 5.5 72ab657cc7 Don't rewrite state.yml if an update doesn't change it
lazygit writes state.yml on every startup to record the current version,
although it's usually the same as the stored one. Switching to the repo
that is already the most recent one rewrites it too. Every write is a
chance for a crash to leave a broken file behind, and the follow-up
work on update checks adds updates that often decide not to change
anything.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 08:10:59 +01:00
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
Stefan HallerandClaude Opus 5.5 c6db95c68d Add tests showing that lazygit instances lose each other's state changes
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 08:10:59 +01:00
Stefan HallerandClaude Opus 5.5 76064a302b Replace GetAppState and SaveAppState with ReadAppState and UpdateAppState
Each lazygit instance reads state.yml once at startup. Callers change
that copy and then save all of it. So an instance doesn't see what
other instances changed after it started, and when it saves, it
overwrites their changes.

To fix this, the following commits make ReadAppState read the file and
UpdateAppState apply the change to what it finds in the file. For this
to work, callers must express a change as an operation on the current
state: add a command to the front of the history, remove a history
entry by its value, move the current repo to the front of the recent
repos. The call sites already compute the new value from the current
one; move that code into the update function.

This commit still works on the in-memory copy, so it doesn't change
behavior.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 08:10:58 +01:00
Stefan HallerandClaude Opus 5.5 9ff9479baf Exclude the current repo from the recent repos menu by its path
The menu leaves out the first entry of the recent repos list because
that's the repo we're in. This is true as long as each lazygit instance
keeps its own copy of state.yml. The following commits make instances
read the list from the file. The first entry is then the repo that any
instance opened most recently, and that may be a different one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 08:10:58 +01:00
Stefan HallerandClaude Opus 5.5 ad50d2fb2a Log errors from saving state.yml instead of returning them
If saving state.yml fails while lazygit adds the current repo to the
recent repos list, lazygit stops loading the repo. At startup it exits.
A user on Windows got "The requested operation cannot be performed on
a file with a user-mapped section open" when lazygit opened state.yml
for writing, so lazygit exited on every launch (#4489). Confirming the
intro popup also shows a failed save as an error.

Nothing in state.yml is important enough for this. Log the error
instead, like the other places that save state.yml already do.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 08:10:58 +01:00
Stefan HallerandClaude Opus 5.5 90039cf7e2 Remove the unused AppState field from Common
Nothing reads it. It's a pointer to the AppConfig's in-memory copy of
state.yml, which the following commits replace with fresh reads of the
file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 08:10:58 +01:00
Stefan HallerandClaude Opus 5.5 5a6d5de3b8 Start with the default app state if state.yml can't be parsed
Several users on Windows reported that lazygit wouldn't start any more
and failed with "yaml: control characters are not allowed" (#3023).
Their state.yml was filled with zero bytes, most likely because the
machine crashed or lost power shortly after lazygit had written the
file. They had to find the file and delete it to make lazygit start
again.

Start with the defaults in this case. The file holds things like the
shell command history and the recent repos list; losing them is better
than not starting. The next save replaces the file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 08:10:58 +01:00
Stefan HallerandClaude Opus 5.5 2d270f0e54 Add a test showing that lazygit doesn't start if state.yml is broken
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 08:10:58 +01:00
Stefan HallerandClaude Opus 5.5 61ef3c770f Move the AppState code into its own file
The following commits add locking and atomic writes for state.yml;
keep that code apart from the user config loading and migration code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 08:10:58 +01:00
Jesse DuffieldandClaude Opus 5.5 6d36a0645d Remove Warp and Tuple sponsor banners from README
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 11:19:46 +11:00
Stefan Haller c63f9b024c Show the hash and subject of a detached HEAD in the branches panel (#6220)
For a detached HEAD, the row in the branches panel was missing
information. Its hash column was empty if `gui.showBranchCommitHash` was
on or the panel was in half or full screen mode. In half or full screen
mode, the row also had no commit subject. Both are shown now.

Pressing `n` on that row opened a prompt titled "New branch name (branch
is off of '<40-character hash>')". The prompt now shows the short hash
and subject instead, the same as when you press `n` on the commit in the
commits panel.
2026-11-14 15:49:47 +01:00
Stefan HallerandClaude Opus 5.5 d2321ca27b Show the short hash and subject of a detached HEAD in the new branch prompt
If you press `n` on the row of a detached HEAD in the branches panel,
the title of the prompt contains the full 40-character commit hash.
Since 5dec080719, the Name of a detached HEAD is the full hash.

Describe the commit in the same way as when you press `n` on it in the
commits panel.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 15:34:44 +01:00
Stefan HallerandClaude Opus 5.5 f7c07e4fc2 Add a test showing that the new branch prompt shows the full hash of a detached HEAD
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 15:34:44 +01:00
Stefan HallerandClaude Opus 5.5 6348e8a6af Extract CommitDescription from Commit.Description
A later commit describes a detached HEAD in the same way. Make it work
for hashes shorter than 7 characters. The Name of a detached HEAD is
"HEAD" if `git branch --points-at=HEAD` doesn't report it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 15:34:44 +01:00
Stefan HallerandClaude Opus 5.5 9dcef62ff2 Show the hash and subject of a detached HEAD in the branches panel
In the branches panel, the row of a detached HEAD has an empty hash
column if gui.showBranchCommitHash is on. In half or full screen mode,
it also has no subject. The branch loader creates this row without the
hash and subject of the commit.

Ask git for the subject too. Show the Name of the row in the hash
column; for a detached HEAD, the Name is the full hash. Leave the
row's CommitHash empty. Otherwise, code that looks for branches at a
commit would take the detached HEAD for a branch. For example, the
checkout menu of the HEAD commit would offer to check it out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 15:34:44 +01:00
Stefan HallerandClaude Opus 5.5 8fd0684c56 Add a test showing that the branches panel has no hash or subject for a detached HEAD
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 15:34:44 +01:00
Stefan HallerandClaude Opus 5.5 748fe85bef Fix the comment about the Name of a detached HEAD
Since 5dec080719, the Name of a detached HEAD is the full commit hash,
not the part of the DisplayName after "detached at".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 15:34:44 +01:00