From 88b6dea26a1b944c142198f842024825905e48dc Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Thu, 2 Apr 2026 23:33:52 -0400 Subject: [PATCH] Fix branch_name and restored doc comments to match actual code --- crates/agent_ui/src/thread_metadata_store.rs | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/crates/agent_ui/src/thread_metadata_store.rs b/crates/agent_ui/src/thread_metadata_store.rs index c8232eefc8743d19aaa5eee00a623dc70a73f0b0..6a56f136b2bf0a419a570af4415ecb8c432e3470 100644 --- a/crates/agent_ui/src/thread_metadata_store.rs +++ b/crates/agent_ui/src/thread_metadata_store.rs @@ -167,11 +167,9 @@ pub struct ArchivedGitWorktree { /// Branch that was checked out in the worktree at archive time. `None` if /// the worktree was in detached HEAD state, which isn't supported in Zed, but /// could happen if the user made a detached one outside of Zed. - /// If that branch is missing, we auto-generate an new branch name. If the branch already - /// exists, we see if it points to our commit_hash~2 (~2 because commit_hash points to - /// WIP commits we created to preserve uncommitted and staged files, respectively), - /// and the branch does already point to that commit, then we use the branch as-is. If it - /// already exists but it's pointing to a different commit, we auto-gen a new branch. + /// On restore, we try to switch to this branch. If that fails (e.g. it's + /// checked out elsewhere), we try to create it. If both fail, the restored + /// worktree stays in detached HEAD and a warning is logged. pub branch_name: Option, /// SHA of the WIP commit that we made in order to save the files that were uncommitted /// and unstaged at the time of archiving. This commit can be empty. Its parent commit @@ -180,11 +178,9 @@ pub struct ArchivedGitWorktree { /// past both of these commits, we're back in the state we had before archiving, including /// what was staged, what was unstaged, and what was committed. pub commit_hash: String, - /// Whether this worktree has been restored by a prior unarchive. This is used when - /// unarchiving multiple threads, and tells us whether to treat worktree_path's presence - /// in the filesystem as a collision to be worked around (the directory was "taken" by - /// something else while we were archived), or as a source of truth we can reuse for an - /// unarchived thread instead of needing to create another directory. + /// Whether this worktree has been restored by a prior unarchive. + /// Currently unused — the record is deleted immediately after a + /// successful restore rather than being marked as restored. pub restored: bool, }