Rugged::Diff::Delta #new_file / #old_file method got a wrong encoded [:path] string
Open
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 2.3k
- Forks
- 293
- PR merge metrics
- No merged PRs in 30d
Description
when I call new_file[:path] / old_file[:path] of Rugged::Diff::Delta, I got result as follow:
[{:path=>"test/.keep", :type=>"added"},
{:path=>"test/\xE4\xB8\xAD\xE6\x96\x87\xE5\x90\x8D\xE6\xB5\x8B\xE8\xAF\x95\xE4\xB8\x80.txt", :type=>"added"},
{:path=>"test/\xE4\xB8\xAD\xE6\x96\x87\xE5\x90\x8D\xE6\xB5\x8B\xE8\xAF\x95\xE4\xB8\x89.txt", :type=>"added"},
{:path=>"test/\xE4\xB8\xAD\xE6\x96\x87\xE5\x90\x8D\xE6\xB5\x8B\xE8\xAF\x95\xE4\xBA\x8C.txt", :type=>"added"},
{:path=>"\xE4\xB8\xAD\xE6\x96\x87. \xE5\x91\xBD\xE5\x90\x8D1.txt", :type=>"added"}]}
when I copy the path value to my console pry/irb, I got the right string
It seems to be an incorrectly decoded problem
[66] pry(main)> "test/\xE4\xB8\xAD\xE6\x96\x87\xE5\x90\x8D\xE6\xB5\x8B\xE8\xAF\x95\xE4\xB8\x80.txt"
=> "test/中文名测试一.txt"
[67] pry(main)> "test/\xE4\xB8\xAD\xE6\x96\x87\xE5\x90\x8D\xE6\xB5\x8B\xE8\xAF\x95\xE4\xB8\x89.txt"
=> "test/中文名测试三.txt"
[68] pry(main)> "test/\xE4\xB8\xAD\xE6\x96\x87\xE5\x90\x8D\xE6\xB5\x8B\xE8\xAF\x95\xE4\xBA\x8C.txt"
=> "test/中文名测试二.txt"
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue through Rugged::Diff::Delta#new_file and #old_file using the non-ASCII paths shown. Trace how path strings are encoded in the Rugged Ruby bindings and libgit2 boundary; done means these entry points return the expected Unicode paths and a regression test covers them.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, git, ruby
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100