fix: properly parse UTF-8(multibyte) file paths in git output #839
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of Bug
The current implementation cannot correctly retrieve the status of file paths containing multibyte characters such as UTF-8. Here's how to reproduce the issue:
The path contains a quoted string. The current
git/lib.rb
has theunescape_quoted_path
method, and some processes use this method. But it's not used consistently across all file status retrieval operations.Fix
I added tests for file paths containing multibyte characters to
test_status.rb
and modified various parts ofgit/lib.rb
to use theunescape_quoted_path
method so that these tests pass.Since this change exceeds the maximum class line count defined in
.rubocop_todo.yml
, I've increased the limit. I believe the complicatedlib.rb
will naturally improve through the ongoing architectural redesign.