# Fix symlinked root rename event handling \(\#58624\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 693356221ec3be957fb95154e438add6a57a88cc

Requested commit: 693356221ec3be957fb95154e438add6a57a88cc

Commit: 693356221ec3be957fb95154e438add6a57a88cc

Tree: 0fde351e9d8e153c36f5f8a2d280fde3ee31689c

Author: Tianze Zhao

Committer: GitHub

## Message

```
Fix symlinked root rename event handling (#58624)

Fixes #58619.

When a worktree is opened through a symlinked root, filesystem events
can arrive rooted at either the opened symlink path or the canonical
target path. The worktree event processing path already handled
canonical target paths, but dropped events reported under the opened
symlink root because it only derived relative paths from the canonical
root.

This PR adds a regression test that opens `/link -> /target`, renames
`/link/subdir-a` to `/link/subdir-aa`, and verifies
`subdir-aa/config.ini` remains visible in the worktree. The production
fix accepts event paths under the opened worktree root as a fallback
when deriving relative paths.

Testing:

- Verified the new regression test fails with only the test commit
applied.
- `cargo test -p worktree --test integration
test_renaming_subdir_under_symlinked_root_keeps_children`
- `cargo test -p worktree --test integration
test_symlinks_pointing_outside`
```

## Parents

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

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