# git_ui: Fix open diff for untracked files when sorting by path enabled \(\#39862\) · gitcafe/zed

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

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

Visibility: public

Requested revision: c58931ac04a2e0fa66653ca367fff449ab5b696d

Requested commit: c58931ac04a2e0fa66653ca367fff449ab5b696d

Commit: c58931ac04a2e0fa66653ca367fff449ab5b696d

Tree: 123bccdebc3bf4cd3025d36fda246e536c5a684d

Author: Dino

Committer: GitHub

## Message

```
git_ui: Fix open diff for untracked files when sorting by path enabled (#39862)

Fixes the `Open Diff` action for untracked files when the `sort_by_path`
setting is enabled. The `ProjectDiff` wasn't correctly moving the
multibuffer's cursor to the untracked file because, when that setting is
enabled, it's sort prefix is changed to the tracked files sort prefix, and that
wasn't accounted for in `move_to_entry`.

Before these changes, the `sort_prefix` field for `PathKey` was called `namespace`, it was renamed to be clearer what its purpose is.

Closes #39529 

Release Notes:

- Fixed 'Open Diff' action for untracked files when `sort_by_path` is
enabled

---------

Co-authored-by: David Kleingeld <davidsk@zed.dev>
```

## Parents

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

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