Conversation
It returns true if the path is missing. It started out as IsWorktreePathMissing, and was renamed without inverting its result when it moved into the loader in de57cfd. Invert the result instead of renaming it back, so that the call site reads `IsPathMissing: !self.pathExists(path)`. If we can't check the path, it still counts as existing, as it always did. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The next commit compares worktree paths with their slashes trimmed. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
If a linked worktree's directory is deleted and another worktree is moved to the same path, `git worktree list` reports both worktrees with that path. lazygit then crashes at startup with a stack overflow, and the terminal is left in a broken state. To tell the paths in a group apart, getUniqueNamesFromPathsAux keeps looking at one more parent directory, but identical paths never come apart, so it recurses forever. A stack overflow is a fatal error rather than a panic. No deferred function runs, so the terminal is not restored either. Name identical paths like a single path instead of recursing. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
If the repo that lazygit has open is deleted while lazygit is running, the next full refresh panics. The same happens for a linked worktree that is deleted. In both cases `git for-each-ref` fails because its working directory is gone, and BranchLoader panics when that happens. Return the error instead. The branches refresh logs it, like it does with the other errors it gets from loading the branches. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The next commit makes performRefresh return early right after the capture, and it must not leave the input blocked when it does. This doesn't let any keypress slip through before the block begins. Only refreshes on the UI thread block input, and there the capture runs synchronously. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
If the repo or linked worktree that lazygit has open is deleted while lazygit is running, every git command fails. lazygit no longer panics since the previous commit, but it shows empty lists, and there's nothing useful left to do in it. Check at the start of every refresh whether the worktree and its git dir still exist. If one of them is gone, quit and print its path in the terminal. The background files refresh does this check too, so lazygit quits within ten seconds even if nobody is using it. To quit from a refresh, return an error that wraps gocui.ErrQuit; this keeps it out of the error popup. Switching to another worktree or to a recent repo would be an alternative, but it would be more surprising than quitting. Also, there isn't always a main worktree to switch to. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If the current worktree (or repo) that lazygit has open gets deleted externally, lazygit used to crash with a panic. Exit gracefully in that case, showing an error that the directory git deleted.
Also fix a crash for the more exotic case where a linked worktree's directory is deleted and another worktree is created in the same location. Users shouldn't do this, but it's still nicer to handle this more gracefully.
Fixes #5266.