# worktree: Fix linked worktree git dir event handling \(\#57782\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 954ee58c15be92205cff66bc1dbed7aa497f294d

Requested commit: 954ee58c15be92205cff66bc1dbed7aa497f294d

Commit: 954ee58c15be92205cff66bc1dbed7aa497f294d

Tree: b5d0f003ba8ba346849ad369a81feb91872c72e6

Author: Lukas Wirth

Committer: GitHub

## Message

```
worktree: Fix linked worktree git dir event handling (#57782)

When a linked worktree receives fs events for its .git directory, the
event path resolves to the per-worktree git dir (e.g.
main_repo/.git/worktrees/<name>), not the .git directory itself or the
common dir. The existing match only checked common_dir_abs_path and
repository_dir_abs_path, causing the repository entry to be missed and
then removed as stale.

Add dot_git_abs_path to the match, and fix the staleness metadata check
to use dot_git_abs_path (the actual .git entry) rather than
common_dir_abs_path (which may be outside the worktree root).

Extracted from https://github.com/zed-industries/zed/pull/53453

Release Notes:

- N/A or Added/Fixed/Improved ...

---------

Co-authored-by: Kieran Freitag <kfreitag@kieran.ca>
Co-authored-by: zed-zippy[bot] <234243425+zed-zippy[bot]@users.noreply.github.com>
```

## Parents

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

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