Artifact 2925f468610c73101accc367c01b63e8eae9d52d457ad4423d9a4b553c4f87e7:
- File
internal/merge/text.go
— part of check-in
[eb1791acd5]
at
2026-10-19 01:52:19
on branch feat/submanifest-reader
— fix(merge): IsText converts as fossil's text_diff does
Read data through the ported BOM/UTF-16 conversion and line splitter, so the Update gate and the merge agree on what is text.
Tracked in #447 (user: [email protected], size: 641) [annotate] [blame] [check-ins using] [more...]
package merge // lineLimit is the longest line, in bytes without its newline, that // fossil's line diff accepts (LENGTH_MASK in src/diff.c). const lineLimit = lengthMask // IsText reports whether fossil's line merge accepts data: after the // conversion text_diff applies (a UTF-8 BOM dropped, UTF-16 converted to // UTF-8), it holds no NUL byte and no line longer than lineLimit // (count_lines and break_into_lines in src/diff.c). Fossil refuses to // line-merge when any of the three versions fails, and handles the file as // binary instead. func IsText(data []byte) bool { _, _, ok := breakIntoLines(toUTF8NoBOM(data)) return ok }