-
-
Notifications
You must be signed in to change notification settings - Fork 935
Diff::a_path is wrong for unicode characters #1099
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
Comments
Thanks a lot, I could reproduce the issue and even managed to sneak in the Repo('.').commit().diff('HEAD~', z=True)[0].a_path This executes
whereas the version without
exactly as expected. However, the resulting commit object was empty for some reason, maybe due to a silent parsing failure - even though it doesn't look like it. |
Note that separator characters is diff --git a/git/diff.py b/git/diff.py
index 0fc30b9e..17ef15af 100644
--- a/git/diff.py
+++ b/git/diff.py
@@ -108,6 +108,7 @@ class Diffable(object):
args.append("-p")
else:
args.append("--raw")
+ args.append("-z")
# in any way, assure we don't see colored output,
# fixes https://github.com/gitpython-developers/GitPython/issues/172
@@ -483,7 +484,7 @@ class Diff(object):
if not line.startswith(":"):
return
- meta, _, path = line[1:].partition('\t')
+ meta, _, path = line[1:].partition('\x00')
old_mode, new_mode, a_blob_id, b_blob_id, _change_type = meta.split(None, 4)
# Change type can be R100
# R: status letter Can you please upstream the patch? |
Authored based on #1099 (comment) Fixes #1099
@marxin could you have a look at the linked PR�? That's as far as I could get it, and it looks like there is more to it than the change above. Feel free to submit a new PR with your fixes and I will close mine. Thank you. |
Thank you for the start. I added one more commit and it seems it works. Please see PR #1102. |
Authored based on #1099 (comment) Fixes #1099
Awesome, thanks so much! |
I thank you! See you. |
@Byron When can one expect a release that will contain the fix? |
v3.1.12 was just released. |
The problem is slightly mentioned in #865.
Let's consider the following example:
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:The text was updated successfully, but these errors were encountered: