diff options
-rw-r--r-- | git/diff.py | 5 | ||||
-rw-r--r-- | git/test/test_diff.py | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/git/diff.py b/git/diff.py index a7e7411d..76426940 100644 --- a/git/diff.py +++ b/git/diff.py @@ -27,7 +27,10 @@ def decode_path(path, has_ab_prefix=True): return None if path.startswith(b'"') and path.endswith(b'"'): - path = path[1:-1].decode('string_escape') + path = (path[1:-1].replace(b'\\n', b'\n') + .replace(b'\\t', b'\t') + .replace(b'\\"', b'"') + .replace(b'\\\\', b'\\')) if has_ab_prefix: assert path.startswith(b'a/') or path.startswith(b'b/') diff --git a/git/test/test_diff.py b/git/test/test_diff.py index 7bca0c2a..858b3994 100644 --- a/git/test/test_diff.py +++ b/git/test/test_diff.py @@ -158,7 +158,7 @@ class TestDiff(TestBase): self.assertEqual(res[5].b_path, u'path/with\nnewline') self.assertEqual(res[6].b_path, u'path/with spaces') self.assertEqual(res[7].b_path, u'path/with-question-mark?') - self.assertEqual(res[8].b_path, ur'path/¯\_(ツ)_|¯') + self.assertEqual(res[8].b_path, u'path/¯\\_(ツ)_|¯') # The "Moves" # NOTE: The path prefixes a/ and b/ here are legit! We're actually |