diff options
author | Sebastian Thiel <sebastian.thiel@icloud.com> | 2021-01-05 20:34:42 +0800 |
---|---|---|
committer | Sebastian Thiel <sebastian.thiel@icloud.com> | 2021-01-06 01:13:51 +0800 |
commit | 3cb7288d4f4a93d07c9989c90511f6887bcaeb25 (patch) | |
tree | 7e9fe5950a52d554e6276cb7dac379c7c8bb01f4 /git/diff.py | |
parent | 696e4edd6c6d20d13e53a93759e63c675532af05 (diff) | |
download | gitpython-3cb7288d4f4a93d07c9989c90511f6887bcaeb25.tar.gz |
Add '-z' on top of '--raw' to avoid path name mangling
Authored based on
https://github.com/gitpython-developers/GitPython/issues/1099#issuecomment-754606044
Fixes #1099
Diffstat (limited to 'git/diff.py')
-rw-r--r-- | git/diff.py | 3 |
1 files changed, 2 insertions, 1 deletions
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 |