See diff between renamed/moved files
When a file is renamed or moved to a new directory, the Git panel in Zed shows a file deleted and a file added. In VSCode when the same flow happens, once you stage the changes, it is able to determine that the file was just renamed or moved, and show you the actual diff for that file (either no changes or some changes if the file was also edited). I can provide screenshots to the VSCode functionality if needed, but I think most people will be familiar with what I am talking about. Please let me know if more info is needed, thanks!
Originally posted by @secondl1ght in https://github.com/zed-industries/zed/discussions/27044
Hey could I take a crack at this?
I think this can easily be fixed by dropping --no-renames from the porcelain status invocation so the git crate now surfaces StatusCode::Renamed entries to the Git panel. Reference here https://github.com/xipeng-jin/zed/blob/27cb01f4af113abfcafe2812a796afd658a28c9e/crates/git/src/repository.rs#L2048.
But the only thing should note here is this fix will keep their existing design boundaries intact which means the git panel will still render the new renamed file as a new added file with the "+" green icon under "Tracked" header. But the difference is we only show one row rather than two (deleted/added) which is expected. But I think we can have an alternative design for renaming scenarios. Thank you
Hi! I am almost there. I already detect renamed/moved file, now need to choose custom icon showing it was moved, or leave "+" for now? Please assign me to it.
Is this layout ok or I need to change something?
Does the diff only show changes in the file? So if it was renamed/moved there is no diff, but if edits were also made then those changes show up?
@secondl1ght Great question! I forgot to check this case initially, now work on it.
@secondl1ght Fixed it.
@ddoemonn and @flashus : I'm not sure if your two pr are similar in subject matter, I'm talking about #43077 and #43246.
@Angelk90 yeah, it seems very similar, but I guess we need guidance from the team here about the expectations and direction.
IMO since one of @ddoemonn's related PRs (#42352) has already been reviewed by Zed team member @cole-miller and included in a release, it makes sense to update his new PR #43077 to include the same functionality he did for git mv, for renaming/moving files using the Zed project panel. This would close out this issue and be a big improvement, most users are likely using the Zed UI for this action instead of the terminal. This would also bring us closer to feature parity with VSCode.
Seems like duplicate issue.
@cole-miller should we close this?
@esthertrapadoux we shouldn't close this unless this functionality gets included in #43077. The normal flow is for a PR to close an issue, but currently there is no PR that addresses this issue.