Skip to main content

Module merge_isolation_changes

Module merge_isolation_changes 

Source
Expand description

The raw differences of an isolated merge and the worktree state of each changed path. What: The raw tree differences between the two commits of an isolated merge, and the state of a worktree path against them. Why: Recovery of a merge killed while Git was updating the worktree must tell, for each path the merge changes, whether the worktree still holds the old content, already holds the new content, or holds something else that belongs to someone else and must not be overwritten.

In TS you’d write (pseudocode):

const changes = parseRawChanges(await git(['diff-tree', '-r', '-z', '--raw', '--no-renames', '--no-abbrev', old, next]));

Structs§

Change
One path the merge changes, with the mode and blob it has on each side.

Enums§

WorktreeState
What the worktree holds at a path, as the object Git would record for it.

Functions§

parse_raw_changes
What: Read the NUL-separated raw output of git diff-tree -r -z --raw --no-renames --no-abbrev. Why: Each change is a header (:<old mode> <new mode> <old oid> <new oid> <status>) followed by its path. Output that does not follow that shape is a failure, never a partial reading.
worktree_path
The filesystem path of a repository path given as raw bytes.
worktree_state
What: The state of one worktree path: missing, content with the object Git would record for it, or another kind of entry. Why: A file is hashed through Git with its path, so the clean filters and line-ending rules that apply to it apply here; a symbolic link is hashed from its target text, which is what Git records and never the file it points at.