Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions gitrevise/merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ def normalize_conflict(
line = next(lines, None)
if line is None:
raise ConflictParseFailed("unexpected eof")
if line.startswith(b"<<<<<<<"):
if line.startswith(b"<<<<<<< "):
# parse recursive conflicts, including their processed output in the current hunk
conflict = normalize_conflict(lines, None)
if cur_hunk is not None:
Expand All @@ -393,7 +393,7 @@ def normalize_conflict(
raise ConflictParseFailed("unexpected ======= conflict marker")
other_hunk = cur_hunk
cur_hunk = b""
elif line.startswith(b">>>>>>>"):
elif line.startswith(b">>>>>>> "):
# end of conflict. update hasher, and return a normalized conflict
if cur_hunk is None or other_hunk is None:
raise ConflictParseFailed("unexpected >>>>>>> conflict marker")
Expand Down Expand Up @@ -426,7 +426,7 @@ def normalize_conflicted_file(body: bytes) -> Tuple[bytes, str]:
line = next(lines, None)
if line is None:
return (normalized, hasher.hexdigest())
if line.startswith(b"<<<<<<<"):
if line.startswith(b"<<<<<<< "):
normalized += normalize_conflict(lines, hasher)
else:
normalized += line
22 changes: 11 additions & 11 deletions tests/test_rerere.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def test_normalize_conflicted_file() -> None:
c
==========
d
>>>>>>>>>> longer conflict marker, to be trimmed
>>>>>>>>>> longer conflict marker, to be ignored
"""
)
)
Expand All @@ -250,14 +250,14 @@ def test_normalize_conflicted_file() -> None:

unrelated line

<<<<<<<
<<<<<<<<<< HEAD
c
=======
==========
d
>>>>>>>
>>>>>>>>>> longer conflict marker, to be ignored
"""
),
"3d7cdc2948951408412cc64f3816558407f77e18",
"0630df854874fc5ffb92a197732cce0d8928e898",
)
)

Expand Down Expand Up @@ -316,18 +316,18 @@ def test_normalize_conflicted_file() -> None:
normalize_conflicted_file(
dedent(
"""\
<<<<<<<
<<<<<<< ours (outer)
outer left
<<<<<<<<<<<
<<<<<<< ours (inner)
inner left
|||||||||||
|||||||
inner diff3 original section
===========
=======
inner right
>>>>>>>>>>>
>>>>>>> theirs (inner)
=======
outer right
>>>>>>>
>>>>>>> theirs (outer)
"""
)
)[0]
Expand Down