Files
Dom Porada 779e9fc437 Fix worktree index corruption when excluding symlinks (#64818)
## Summary

Excluding a symlink that points inside an open project can corrupt the
worktree index. Discovered while working on #64817.

This PR preserves the target’s existing entry ID instead of reusing the
excluded symlink’s ID, while retaining existing rename behavior.

## Testing

Focused worktree integration tests for exclusions, renames, and symlink
updates pass on macOS with `ITERATIONS=20`.

To test manually:

1. Create a test project containing `config/target`, `file.rs`, and a
relative symlink `link` → `config/target`:

   ```sh
mkdir symlink-exclusion-test && mkdir symlink-exclusion-test/config &&
touch symlink-exclusion-test/config/target
symlink-exclusion-test/file.rs && ln -s config/target
symlink-exclusion-test/link
   ```

2. Open that folder in Zed.
3. After the initial scan, set `file_scan_exclusions` to `["**/link"]`
in your user settings and save.

Before the fix, this is enough to trigger an invariant panic in builds
with test support.

## Self-review

- [x] I’ve reviewed my diff for quality, security, reliability, and
performance.
- [x] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [x] Tests cover the new or changed behavior.

---

Release Notes:

- Fixed worktree index corruption when excluding symlinks that point
inside a project.

---------

Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
2026-11-09 11:35:45 +00:00
..