mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-11-18 03:49:50 -06:00
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>