UNPKG

@struktoai/mirage-core

Version:

A Unified Virtual Filesystem For AI Agents

37 lines • 2.02 kB
/** * The hunks of a combined diff, one column per parent. * * Each parent is compared with the result on its own. A result line the * parent lacks shows `+` in its column, a line it had that the merge dropped * shows `-`, and lines several parents dropped at one row print once with * each of those parents marked. * * A hunk shows `context` lines around each changed row and takes in the next * changed row once their context lines meet or touch. Under `--cc` the * changed rows are first bunched more tightly (the next row falls within the * trailing context, or right after), and a bunch whose every line is new to, * or dropped by, the same parents, but not all of them, is taken as cleanly * merged and left out. Its dropped lines still count in the parents' ranges * where a shown hunk covers their row, as git counts them. * * @param parents - each parent's lines, newlines kept. * @param result - the merge result's lines, newlines kept. * @param dense - `--cc` rather than `-c`. * @param context - the requested number of context lines. */ export declare function combinedLines(parents: string[][], result: string[], dense: boolean, context?: number): string[]; /** * Index pairs of equal lines along a longest common subsequence, taken from * the ends inward: equal last lines pair, and where skipping a line on * either side keeps the longest length, the right side's line is skipped. * So `a b` and `b a` pair their `b`s, and `a a` and `a` pair the second `a`, * as git does. * * The walk needs the comparison row of every left line it passes, so rather * than keeping them all it keeps `budget` bits of rows and works the rest * out again from rows it kept: two passes over the lines while * `left.length * right.length ** 2` is under about `budget ** 2 / 4`, one * more per halving beyond that, with one extra row kept per halving. */ export declare function pairing(left: string[], right: string[], budget?: number): [number, number][]; //# sourceMappingURL=combined.d.ts.map