Skip to content

project: Fix spurious git diff for symlinked files (#58655) (cherry-pick to preview) - #58679

Merged
zed-zippy[bot] merged 1 commit into
v1.6.xfrom
cherry-pick-v1.6.x-0ee1a808
Jun 5, 2026
Merged

project: Fix spurious git diff for symlinked files (#58655) (cherry-pick to preview)#58679
zed-zippy[bot] merged 1 commit into
v1.6.xfrom
cherry-pick-v1.6.x-0ee1a808

Conversation

@zed-zippy

@zed-zippy zed-zippy Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Cherry-pick of #58655 to preview


Opening a symlinked file showed the whole file as changed in the git
gutter/diff. Git stores only the symlink's target path as that entry's
blob, while the buffer holds the resolved target's contents, so diffing
the two is meaningless.

We now skip loading a git diff base whenever a buffer's worktree entry
is a symlink i.e. its canonical_path is set.

Release Notes:

  • Fixed symlinked files showing the entire file as changed in the git
    diff/gutter.

Opening a symlinked file showed the whole file as changed in the git
gutter/diff. Git stores only the symlink's target path as that entry's
blob, while the buffer holds the resolved target's contents, so diffing
the two is meaningless.

We now skip loading a git diff base whenever a buffer's worktree entry
is a symlink i.e. its `canonical_path` is set.

Release Notes:

- Fixed symlinked files showing the entire file as changed in the git
diff/gutter.
@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Jun 5, 2026
@zed-community-bot zed-community-bot Bot added the bot Pull requests authored by a bot label Jun 5, 2026
@zed-zippy
zed-zippy Bot merged commit b554537 into v1.6.x Jun 5, 2026
41 checks passed
@zed-zippy
zed-zippy Bot deleted the cherry-pick-v1.6.x-0ee1a808 branch June 5, 2026 16:57
@Anthony-Eid

Copy link
Copy Markdown
Contributor

@zed-zippy approve

liusuren123 pushed a commit to liusuren123/zed that referenced this pull request Jun 24, 2026
) (cherry-pick to preview) (zed-industries#58679)

Cherry-pick of zed-industries#58655 to preview

----
Opening a symlinked file showed the whole file as changed in the git
gutter/diff. Git stores only the symlink's target path as that entry's
blob, while the buffer holds the resolved target's contents, so diffing
the two is meaningless.

We now skip loading a git diff base whenever a buffer's worktree entry
is a symlink i.e. its `canonical_path` is set.

Release Notes:

- Fixed symlinked files showing the entire file as changed in the git
diff/gutter.

Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
jolutz pushed a commit to jolutz/zed that referenced this pull request Aug 8, 2026
) (cherry-pick to preview) (zed-industries#58679)

Cherry-pick of zed-industries#58655 to preview

----
Opening a symlinked file showed the whole file as changed in the git
gutter/diff. Git stores only the symlink's target path as that entry's
blob, while the buffer holds the resolved target's contents, so diffing
the two is meaningless.

We now skip loading a git diff base whenever a buffer's worktree entry
is a symlink i.e. its `canonical_path` is set.

Release Notes:

- Fixed symlinked files showing the entire file as changed in the git
diff/gutter.

Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot Pull requests authored by a bot cla-signed The user has signed the Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants