Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 19 commits into from
Jun 23, 2024

Conversation

Xerxes-2
Copy link
Contributor

@Xerxes-2 Xerxes-2 commented Jun 22, 2024

Original issue here: #1171

Fixes #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.

@Xerxes-2 Xerxes-2 changed the title Fix: rename sensitivity Fix: rename case sensitivity Jun 23, 2024
yazi-shared/src/fs/fns.rs Outdated Show resolved Hide resolved
@lxl66566
Copy link

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
Copy link
Contributor Author

Xerxes-2 commented Jun 23, 2024

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
Copy link
Owner

sxyazi commented Jun 23, 2024

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

@sxyazi sxyazi changed the title Fix: rename case sensitivity fix: suppress warnings for different name representations of the same file in the case-insensitive file system when renaming Jun 23, 2024
Copy link
Owner

@sxyazi sxyazi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@sxyazi sxyazi merged commit f1cf136 into sxyazi:main Jun 23, 2024
6 checks passed
@Xerxes-2 Xerxes-2 deleted the fix-rename-case-insensitive branch June 24, 2024 02:21
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

No sensitivity to the case when renaming files in editor
3 participants