sxyazi / yazi

💥 Blazing fast terminal file manager written in Rust, based on async I/O.
https://yazi-rs.github.io
MIT License
15.07k stars 341 forks source link

fix: suppress warnings for different name representations of the same file in the case-insensitive file system when renaming #1185

Closed Xerxes-2 closed 3 months ago

Xerxes-2 commented 3 months ago

Original issue here: https://github.com/sxyazi/yazi/issues/1171

Fixes https://github.com/sxyazi/yazi/issues/1171

This PR introduced a function are_paths_equal in fns.rs to determine if two paths points to the same node. It fixes the rename and bulk_rename functions not working properly when only change the case of letters. Previously these functions only check if the new path already exists, but not considering the old and new path could be the same node in case-insensitive systems like macOS and Windows.

lxl66566 commented 3 months ago

There's an unexpected behavior: when i rename a file to it's hardlink, it will overwrite (same as being deleted) without asking. Before this PR, yazi would ask whether to Overwrite an existing file.

reproduce:

touch 1
ln 1 2
./yazi
(rename 2 to 1)
Xerxes-2 commented 3 months ago

There's an unexpected behavior: when i rename a file to it's hardlink, it will overwrite (same as being deleted) without asking. Before this PR, yazi would ask whether to Overwrite an existing file.

reproduce:

touch 1
ln 1 2
./yazi
(rename 2 to 1)

I think new commit have resolved this issue, but in a slight dumb approach.

sxyazi commented 3 months ago

Thanks for the PR, I'll take care of the follow-up work on this.