# Gracefully handle when linked worktree \.git path is outside worktree root \(\#53443\) · gitcafe/zed

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

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

Visibility: public

Requested revision: fb949ae831730b8562495d227d4ce972d17356d4

Requested commit: fb949ae831730b8562495d227d4ce972d17356d4

Commit: fb949ae831730b8562495d227d4ce972d17356d4

Tree: 347849026fedd964aa52c4b61eea26a21bcf9b4a

Author: Richard Feldman

Committer: GitHub

## Message

```
Gracefully handle when linked worktree .git path is outside worktree root (#53443)

In `update_git_repositories`, a `.git` path outside the worktree root
can occur legitimately when `.git` is a gitfile (as in linked worktrees
and submodules) pointing to a directory in the parent repo. Previously
this triggered a `debug_panic!`, crashing debug builds.

Now we skip the path with a `debug_assert!` that it is indeed a file
(not a directory), so a genuine `.git` directory outside the worktree
root would still be caught in debug builds.

(No release notes because this is extremely hard to encounter until
https://github.com/zed-industries/zed/pull/53215 lands)

Release Notes:

- N/A
```

## Parents

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

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