git/xdiff
Michael Montalbo 60eb74a526 xdiff: support external hunks via xpparam_t
Add two new xpparam_t fields (external_hunks, external_hunks_nr)
that let callers supply pre-computed hunks.  When set, xdl_diff()
populates the changed[] arrays from these hunks instead of running
the diff algorithm, then continues through compaction and emission
as usual.

Validate supplied hunks before use: reject out-of-bounds line
numbers, overlapping or out-of-order hunks, negative counts, and
violations of the synchronization invariant (unchanged line counts
must match between files).  On validation failure, fall back to
the builtin diff algorithm; this re-runs xdl_prepare_env() since
the first call may have dirtied the changed[] arrays.

Skip trim_common_tail() in xdi_diff() when external hunks are
present, since external hunks reference line numbers in the
original content.

Signed-off-by: Michael Montalbo <mmontalbo@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-06-15 07:31:08 -07:00
..
xdiff.h xdiff: support external hunks via xpparam_t 2026-06-15 07:31:08 -07:00
xdiffi.c xdiff: support external hunks via xpparam_t 2026-06-15 07:31:08 -07:00
xdiffi.h xdiff: delete struct diffdata_t 2025-09-30 14:12:46 -07:00
xemit.c xdiff: guard against negative context lengths 2026-05-13 10:13:26 +09:00
xemit.h
xhistogram.c xdiff: split xrecord_t.ha into line_hash and minimal_perfect_hash 2025-11-18 14:53:10 -08:00
xinclude.h
xmacros.h
xmerge.c stash: add --label-ours, --label-theirs, --label-base for apply 2026-04-29 21:46:02 +09:00
xpatience.c diff --anchored: avoid checking unmatched lines 2026-02-12 09:28:49 -08:00
xprepare.c xdiff: support external hunks via xpparam_t 2026-06-15 07:31:08 -07:00
xprepare.h xdiff: support external hunks via xpparam_t 2026-06-15 07:31:08 -07:00
xtypes.h xdiff: remove "line_hash" field from xrecord_t 2026-01-26 08:38:29 -08:00
xutils.c xdiff: use unambiguous types in xdl_bogo_sqrt() 2026-04-30 09:16:50 +09:00
xutils.h xdiff: use unambiguous types in xdl_bogo_sqrt() 2026-04-30 09:16:50 +09:00