# project_panel: Fix worktree root rename \(\#24487\) · gitcafe/zed

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

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

Visibility: public

Requested revision: f1693e6129adcd31ccef31c49e24eede090ca14f

Requested commit: f1693e6129adcd31ccef31c49e24eede090ca14f

Commit: f1693e6129adcd31ccef31c49e24eede090ca14f

Tree: 22346130d00f894db041370808cdb2195edf9162

Author: smit

Committer: GitHub

## Message

```
project_panel: Fix worktree root rename (#24487)

Closes #7923

This PR fixes root worktree renaming by:  

1. Handling the case where `new_path` is the new root name instead of a
relative path from the root.
2. [#20313](https://github.com/zed-industries/zed/pull/20313) added
functionality to watch for root worktree renames made externally, e.g.,
via Finder. This PR avoids relying on that watcher because, when
renaming explicitly from Zed, we can eagerly perform the necessary work
(of course after fs rename) instead of waiting for the watcher to detect
the rename. This prevents UI glitches during renaming root.

Todo:

- [x] Fix wrong abs paths when root is renamed
- [x] Fix explicit scan entry func to handle renamed root dir
- [x] Tests
- [x] Test on Linux
- [x] Tested with single and multipe worktrees
- [x] Tested when single file is root file

Release Notes:

- Fixed an issue where worktree root name couldn't be renamed in project
panel.
```

## Parents

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

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