summaryrefslogtreecommitdiff
path: root/git/diff.py
diff options
context:
space:
mode:
authorSebastian Thiel <sebastian.thiel@icloud.com>2022-09-14 08:25:04 +0800
committerGitHub <noreply@github.com>2022-09-14 08:25:04 +0800
commitb27c41aac3cbc95ad15823058228b8d2461b8e7c (patch)
treef3bbda152d06262a2caeed49ce6797f4d05acc7f /git/diff.py
parentbec61576ae75803bc4e60d8de7a629c194313d1c (diff)
parentdb392aeeea6e34c3aaa3a9961941a43053255ff0 (diff)
downloadgitpython-b27c41aac3cbc95ad15823058228b8d2461b8e7c.tar.gz
Merge pull request #1491 from langfield/main
Fix bug where colons in paths raise a `ValueError` on `diff()` calls.
Diffstat (limited to 'git/diff.py')
-rw-r--r--git/diff.py5
1 files changed, 4 insertions, 1 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]