Skip to content

Diff::a_path is wrong for unicode characters #1099

Closed
@marxin

Description

@marxin

The problem is slightly mentioned in #865.

Let's consider the following example:

git init foo
cd ./foo
echo a > a
git add a
git commit -a -m 'Add a'
echo "foo" > špatně.txt
git add špatně.txt
git commit -a -m Add
In [4]: Repo('.').commit().diff('HEAD~')[0].a_path
Out[4]: '"\\305\\241patn\\304\\233.txt"'

Unless one uses git config --global core.quotepath false, the file name is quoted and I don't see a simple solution how to decode it to unicode? One can use -z option that can resolve the problem:

git diff HEAD~ --raw -z | cat
:000000 100644 0000000 257cc56 Ašpatně.txt

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions