Skip to content

Conversation

@ddoemonn
Copy link
Contributor

Closes #30549

Release Notes:

  • Fixed: Git renames now properly show as renamed files in the git panel instead of appearing as deleted + untracked files
Screenshot 2025-11-10 at 17 39 44 Screenshot 2025-11-10 at 17 39 55

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Nov 10, 2025
@cole-miller
Copy link
Member

Thanks! This is a good start, but I think we should find a way to show both the old and the new paths in the panel. That probably requires a change to how we track statuses in the data layer, so we can store an additional path for things that were renamed. One strategy that I think might make sense would be to add an additional map between old paths and new paths to RepositorySnapshot, separate from statuses_by_path. Then we could look up the old path for a given new path in the UI layer for the git panel when we render an entry that has a Renamed status.

@ddoemonn
Copy link
Contributor Author

Screenshot 2025-11-10 at 19 50 59

@cole-miller what do you think about this?

@cole-miller
Copy link
Member

@ddoemonn That looks reasonable to me, though I do want to have our design team weigh in before we merge this (and in the meantime we can get the data layer ready to go).

@ddoemonn
Copy link
Contributor Author

@cole-miller What do you think about this approach except design for now?

@cole-miller
Copy link
Member

cole-miller commented Nov 12, 2025

Thanks! The backend side of this looks pretty good to me now. It would be good to test (if you haven't already) in what cases git emits the renamed status code for the index/working copy/both, and check that we show the right thing in all cases. Also that staging/unstaging/restoring/committing/uncommitting with renamed paths all have reasonable behavior.

As for the design, tagging @mattermill for his thoughts, but one big question for me is how this interacts with #41857.

@ddoemonn
Copy link
Contributor Author

@cole-miller is there anything you want me to update about this PR?

@mattermill mattermill merged commit b0a7def into zed-industries:main Nov 17, 2025
23 checks passed
@mattermill
Copy link
Contributor

@ddoemonn This looks reasonable to me! However, as @cole-miller noted, we will likely have to revisit once we move on to #41857.

@ddoemonn ddoemonn deleted the fix/git-rename-detection branch November 17, 2025 21:07
cole-miller added a commit that referenced this pull request Nov 19, 2025
cole-miller added a commit that referenced this pull request Nov 19, 2025
This reverts commit b0a7def.

It looks like this doesn't interact correctly with the project diff or
with staging, let's revert and reland with bugs fixed.

Release Notes:

- N/A
@cole-miller
Copy link
Member

@ddoemonn Sorry for merging this prematurely, it seems like there are still some bugs:

  • Renamed files no longer appear in the project diff. We'll need to show them in some form (right now we show a deleted file at the old path and an added file at the new path; ideally we should improve that as part of this change, so you only get one project diff entry for the renamed file).
  • Staging and unstaging of renamed files doesn't work--it causes the entry to split back into an added/removed pair.

If you open a new PR we can advise on how to go about fixing these!

@ddoemonn
Copy link
Contributor Author

Hey @cole-miller! Thanks for clarifying these issues. I actually experienced these bugs after the PR was already closed, so I didn’t realize they were happening beforehand. I’m a little bit confused about these parts too, to be honest.

I can definitely open a new PR to fix them, but I’m a bit busy at work today. How urgent is this? I want to make sure I prioritize it appropriately.

@ddoemonn
Copy link
Contributor Author

@cole-miller new PR is here #43077

@JosephTLyons JosephTLyons moved this to 🚢 Shipped by Community in Git board Nov 19, 2025
mikayla-maki pushed a commit that referenced this pull request Nov 20, 2025
This reverts commit b0a7def.

It looks like this doesn't interact correctly with the project diff or
with staging, let's revert and reland with bugs fixed.

Release Notes:

- N/A
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement community champion

Projects

Status: 🚢 Shipped by Community

Development

Successfully merging this pull request may close these issues.

Git: git mv shows as deleted file + untracked new file

3 participants