Artifact 6a3c469f89dc119a923d50a8fc12b666c707bf4a31dd2381c9f6603382acfd5c:
- File
internal/merge/doc.go
— part of check-in
[dcec15d91f]
at
2026-10-19 01:50:20
on branch feat/submanifest-reader
— fix(merge): write fossil's merge3 output byte for byte
Port fossil 2.28's merge3.c and the diff it runs on (break_into_lines, break_into_tokens, longestCommonSequence, diff_step, diff_optimize, the UTF-8/UTF-16 BOM handling) so Merge and Update align, merge and mark conflicts exactly as fossil does: line-numbered markers, the token-level suggested resolution, CRLF markers, and binary input left unmerged. HasConflictMarkers follows contains_merge_marker in skipping CR runs.
A fossil-binary comparison test checks 1237 generated and hand-written cases against "fossil 3-way-merge" and UTF-16 cases against "fossil merge"; fossil commit refuses a file holding our markers.
Tracked in #447 (user: [email protected], size: 646) [annotate] [blame] [check-ins using] [more...]
// Package merge provides three-way merge with pluggable strategies. // // Register strategies at init time via [Register], then look them up by // name with [StrategyByName]. The built-in strategies are: // // - ThreeWayText: fossil's line-level merge (merge3.c), byte for byte, // with its conflict markers // - Binary: treats any difference as a conflict // - LastWriterWins: always picks the remote side // - ConflictFork: creates a fork instead of merging // // [FindCommonAncestor] walks the plink DAG to locate the merge base // for two divergent checkins. [DetectForks] identifies open forks in // a repository. package merge