diff options
-rw-r--r-- | git/diff.py | 5 | ||||
-rw-r--r-- | test/test_diff.py | 1 |
2 files changed, 4 insertions, 2 deletions
diff --git a/git/diff.py b/git/diff.py index c315a9a9..48b0e0d6 100644 --- a/git/diff.py +++ b/git/diff.py @@ -570,7 +570,10 @@ class Diff(object): def _handle_diff_line(lines_bytes: bytes, repo: "Repo", index: DiffIndex) -> None: lines = lines_bytes.decode(defenc) - for line in lines.split(":")[1:]: + # Discard everything before the first colon, and the colon itself. + _, _, lines = lines.partition(":") + + for line in lines.split("\x00:"): meta, _, path = line.partition("\x00") path = path.rstrip("\x00") a_blob_id: Optional[str] diff --git a/test/test_diff.py b/test/test_diff.py index 3e1c5ddc..dcf10018 100644 --- a/test/test_diff.py +++ b/test/test_diff.py @@ -236,7 +236,6 @@ class TestDiff(TestBase): res[0].b_path, ) - @unittest.skip("This currently fails and would need someone to improve diff parsing") def test_diff_file_with_colon(self): output = fixture("diff_file_with_colon") res = [] |