Whitespace-ignore flags for line comparison, mirroring git’s
XDF_WHITESPACE_FLAGS (-w, -b, --ignore-space-at-eol,
--ignore-cr-at-eol). Only one of the whitespace flavours is honoured per
git’s precedence (-w ⊃ -b ⊃ --ignore-space-at-eol ⊃
--ignore-cr-at-eol); when several are set, the strongest wins, matching
the cascade in xdl_recmatch.
A single line inside a hunk. The stored bytes never include the trailing
line terminator; whether the line is terminated by \n is tracked
separately on the Hunk (see Hunk::old_no_newline /
Hunk::new_no_newline) so the no-final-newline case can be reproduced
byte-for-byte.
git’s default minimum similarity (as a percentage) for a pair of files to be
reported as a rename or copy. Matches git’s built-in -M/-C threshold
of 50% (DEFAULT_RENAME_SCORE is MAX_SCORE / 2).
Compute the content similarity of two blobs as an integer percentage in
0..=100, using git’s span-hash counting metric (see the module comment
above for the exact definition).
Sum, over every hash present in both maps, the smaller of the two byte
counts. This is git’s src_copied: the number of bytes that appear on both
sides (counting multiplicity via the per-hash byte totals).
git diffcore_count_changes(): span-hash byte accounting between two
blobs. Returns (src_copied, literal_added) — the bytes of src that
survive into dst, and the bytes of dst not accounted for by src.
--dirstat’s default “changes” damage is
(src.len() - src_copied) + literal_added.
HEAD-vs-index name-status with full rename/copy options, including inexact
(similarity) detection when enabled. All blob content (both sides) comes from
the object database.
HEAD-vs-worktree name-status with full rename/copy options, including inexact
(similarity) detection when enabled. Worktree blob content is read directly
from the working tree; HEAD-side blobs come from the object database.
Index-vs-worktree name-status with full rename/copy options, including inexact
(similarity) detection when enabled. Worktree blob content is read directly
from the working tree; index-side blobs come from the object database.
Name-status diff of an arbitrary tree against the index, the engine behind
git diff-index --cached <tree-ish>. Exact rename/copy detection follows
options; all blob content comes from the object database.
Tree-vs-index name-status with full rename/copy options, including inexact
(similarity) detection when enabled. Both sides read blob content from the
object database. Counterpart of
diff_name_status_head_index_with_rename_options for an arbitrary tree.
Name-status diff of an arbitrary tree against the working tree, the engine
behind plain git diff-index <tree-ish> (no --cached). New-side oids for
paths whose worktree contents differ from the index are cleared (rendered as
zeros), matching git, which only reports the worktree blob oid when it is
known-clean against the index.
Tree-vs-worktree name-status with full rename/copy options, including inexact
(similarity) detection when enabled. Worktree blob content is read directly
from the working tree (via an oid-keyed cache); tree-side blobs come from the
object database. As with diff_name_status_tree_worktree_with_options,
new-side oids for paths that differ from the index are cleared.
Resolve the git directory of an embedded repository whose working tree is
at sub_root. A .git directory is returned as-is; a .git file is
followed through its gitdir: <path> pointer (a relative pointer resolves
against sub_root). Returns None when there is no .git entry or the
pointer does not name an existing directory.
Resolve the commit checked out in the embedded repository at sub_root
(the value a gitlink entry for that path records): its git directory’s
HEAD, followed through symbolic refs. None when sub_root is not a
repository or its HEAD does not resolve to a commit (e.g. an unborn
branch) — upstream’s resolve_gitlink_ref() < 0 case.
merge_trees operating on already-flattened entry maps. The merge
porcelains often hold the flattened maps already (e.g. cherry-pick builds
theirs from a picked commit’s tree), so this avoids re-reading them.
Compute a line-level edit script transforming old into new, comparing
lines under the whitespace-ignore flags ignore while the returned ops
still index the original lines position-for-position.