From 3cb7288d4f4a93d07c9989c90511f6887bcaeb25 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Tue, 5 Jan 2021 20:34:42 +0800 Subject: 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 --- git/diff.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'git/diff.py') 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 -- cgit v1.2.1