# project: Fix issue where Cmd\+Click on an import opens the wrong file \(\#26120\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 387ee46c466f6e2c736e35fb823fea1e5e4c7ea5

Requested commit: 387ee46c466f6e2c736e35fb823fea1e5e4c7ea5

Commit: 387ee46c466f6e2c736e35fb823fea1e5e4c7ea5

Tree: e318d3107d91e589a12a7b94f859b987d584158b

Author: smit

Committer: GitHub

## Message

```
project: Fix issue where Cmd+Click on an import opens the wrong file (#26120)

Closes #21974

`resolve_path_in_worktrees` function looks for provided path in each
worktree until valid file is found.

In this PR we priortize current buffer worktree before other worktrees,
because of edge case where, file with same name might exists in other
worktrees.

Updated tests to handle this case.

Release Notes:

- Fixed an issue where the wrong file from a different worktree would
open when using `Cmd + Click` on a file import.
```

## Parents

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

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