Preserve remote repository curation across a disconnect#463
Merged
Conversation
A disconnected remote is kept in the roster as an empty placeholder (no worktrees). reconcileSidebarState read that empty roster as "these worktrees are gone" and pruned the repo's curation against it on any non-initial reload: a pinned remote worktree (git or folder) was dropped and demoted to unpinned on reconnect, and the stored branch-collapse prefixes were wiped. Skip both prunes for an unresolved remote placeholder so its curation survives until the host resolves or the user removes it. The "can't reach" error row also rendered only the section-level title/color, so a remote folder (whose custom name/color live on its synthetic folder-worktree item) lost them while disconnected, even though the live folder row shows them. Fall back to the folder-worktree item so the error row matches the live row.
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.
Summary
A remote repository (over SSH) is kept in the sidebar as an empty placeholder while its host is unreachable, so the entry isn't pruned. On any non-initial reload while disconnected,
reconcileSidebarStateread that empty roster as "these worktrees are gone" and pruned the repository's curation against it:collapsedBranchPrefixes) were wiped.Separately, the "can't reach" error row rendered only the section-level title/color. A remote folder's custom name/color live on its synthetic folder-worktree item (the folder row is a worktree row), so they were lost while disconnected even though the live folder row shows them.
Changes
host != nil && worktrees.isEmpty), so its curation survives until the host resolves or the user removes it. Applies to remote git repos and folders alike.Tests
RemoteDisconnectCurationTests:All 1941 tests pass; build and lint clean.