summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Thiel <sebastian.thiel@icloud.com>2021-01-05 20:34:42 +0800
committerSebastian Thiel <sebastian.thiel@icloud.com>2021-01-05 20:35:58 +0800
commit90a6e1c8f793571730f1c77f2dce745813938b66 (patch)
tree7e9fe5950a52d554e6276cb7dac379c7c8bb01f4
parent696e4edd6c6d20d13e53a93759e63c675532af05 (diff)
downloadgitpython-90a6e1c8f793571730f1c77f2dce745813938b66.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
-rw-r--r--git/diff.py3
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