Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
conflicts: escape conflict markers by making them longer
Browse files Browse the repository at this point in the history
If a file contains lines which look like conflict markers, then we need
to make the real conflict markers longer so that the materialized
conflicts can be parsed unambiguously. For instance, if we have a file
explaining the differences between Jujutsu's conflict markers and Git's
conflict markers, it could produce a conflict with long markers like
this:

```
<<<<<<<<<<< Conflict 1 of 1
%%%%%%%%%%% Changes from base to side jj-vcs#1
-Git's conflict markers look like this:
+Unlike Jujutsu, Git's conflict markers look like this:

 <<<<<<<
 left
 =======
 right
 >>>>>>>
+++++++++++ Contents of side jj-vcs#2
Jujutsu uses different conflict markers than Git, which just shows the
sides of a conflict without a diff.
>>>>>>>>>>> Conflict 1 of 1 ends
```

When parsing the conflict, we require that the conflict markers in the
file are at least as long as the materialized conflict markers, and we
only parse the longest conflict markers in the file.
scott2000 committed Nov 25, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent fa6dcd6 commit c0eadaf
Showing 3 changed files with 234 additions and 97 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -71,6 +71,10 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
"diff3" conflict style, meaning it is more likely to work with external tools,
but it doesn't support conflicts with more than 2 sides.

* Conflict markers are now allowed to be longer than 7 characters, allowing
conflicts to be materialized and parsed correctly in files which already
contain lines which look like conflict markers.

### Fixed bugs

* `jj config unset <TABLE-NAME>` no longer removes a table (such as `[ui]`.)
Loading

0 comments on commit c0eadaf

Please sign in to comment.