# git: Make permalinks aware of current diffs \(\#41915\) · gitcafe/zed

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

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

Visibility: public

Requested revision: cda78c12ab88fb6f77bc9b16f7ded61d7a004461

Requested commit: cda78c12ab88fb6f77bc9b16f7ded61d7a004461

Commit: cda78c12ab88fb6f77bc9b16f7ded61d7a004461

Tree: 78d45107151a48b30aeb6d2be5ce49e7b419b1e9

Author: Siame Rafiq

Committer: GitHub

## Message

```
git: Make permalinks aware of current diffs (#41915)

Addressing #22546, we want git permalinks to be aware of the current
changes within the buffer.

This change calculates how many lines have been added/deleted between
the start and end of the selection and uses those values to offset the
selection.

This is done within `Editor::get_permalink_to_line` so that it can be
passed to any git_store.

Example:

<img width="284" height="316" alt="image"
src="https://github.com/user-attachments/assets/268043a0-2fc8-41c1-b094-d650fd4e0ae0"
/>

Where this selections permalink would previously return L3-L9, it now
returns L2-L7.

Release Notes:

- git: make permalinks aware of current diffs

Closes #22546

---

This is my first PR into the zed repository so very happy for any
feedback on how I've implemented this. Thanks!
```

## Parents

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

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