Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Edit ¶
type Edit struct { // Kind is the kind of edit. It is either an insert or a delete. Kind EditKind // FromPosition is the line to edit in the original sequence. FromPosition int // ToPosition is the line in the new sequence. It is only valid for // inserts. ToPosition int }
Edit is an delete or insert operation.
func Diff ¶
Diff does a diff. It returns a [[]Edit] which when applied to the original sequence will result in the new sequence.
The algorithm is based on the paper "An O(ND) Difference Algorithm and Its Variations" by Eugene W. Myers. The paper is available at https://citeseerx.ist.psu.edu/doc/10.1.1.4.6927.
It implements the linear space refinement of the algorithm described in section 4b. This is the same algorithm used by git.
Click to show internal directories.
Click to hide internal directories.