# Only archive worktrees that Zed created \(\#53991\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/e2780f6fbd05aeff5983f4a07987b2ff5eb8ea3b)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: e2780f6fbd05aeff5983f4a07987b2ff5eb8ea3b

Requested commit: e2780f6fbd05aeff5983f4a07987b2ff5eb8ea3b

Commit: e2780f6fbd05aeff5983f4a07987b2ff5eb8ea3b

Tree: 5ac5a584a28ef2adf283242460f27c9046a58ac8

Author: Richard Feldman

Committer: GitHub

## Message

```
Only archive worktrees that Zed created (#53991)

When archiving a thread, we now check whether the linked worktree lives
inside the Zed-managed worktrees directory (configured via
`git.worktree_directory`). If it doesn't — meaning the user created it
themselves outside of Zed — we skip both the directory deletion and the
`git worktree remove`, leaving it untouched.

Previously, archiving a thread would delete *any* linked worktree
associated with the thread's folder paths, even ones the user had
created manually via `git worktree add`.

Release Notes:

- Fixed archiving an agent thread deleting linked git worktrees the user
created outside of Zed's managed worktrees directory.
```

## Parents

- [bf25cb1835ae03c26c778646e01bc634ae690a59](https://git.cafe/gitcafe/zed/commit/bf25cb1835ae03c26c778646e01bc634ae690a59?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/e2780f6fbd05aeff5983f4a07987b2ff5eb8ea3b?format=markdown)
