Documentation
¶
Overview ¶
Package textmerge is the line-based three-way merge shared by the sync engine (two devices' concurrent puts) and the hub (an outside write landing under a live co-editing room).
Hand-written, no dependency: the code that decides what a merged file contains should be readable in one sitting. Line-based on purpose. Word- or character-level merging resolves more cases and silently produces sentences neither author wrote; a line is the unit people actually edit, and anything overlapping is left to the caller's conflict path.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsText ¶
IsText reports whether b is something a line merge may touch: valid UTF-8 with no NUL. Merging bytes that are not lines produces a file that is neither side's, and for a binary format that means a corrupt one.
func Merge ¶
Merge merges two edits of the same base. ok is false when the two sides changed the same region, which is a real conflict and stays one.
Determinism matters more than cleverness here: two devices can each observe the same concurrency and merge independently, so merge(base, a, b) and merge(base, b, a) must agree or the fleet diverges. Only NON-overlapping hunks are ever taken, which makes the result the union either way.
Types ¶
This section is empty.