Skip to main content

Module replay_shared_paths

Module replay_shared_paths 

Source
Expand description

Replay: shared paths of the landed history and the prepared commit, with their three entries (replay_shared_paths). What: The paths both the prepared commit and the landed history changed since the preparation base, with the three tree entries subsumption compares. Why: Subsumption decides per shared path; the listing is two git diff-tree runs whatever the history length, and paths stay Latin-1 decoded so every byte survives and encodes back exactly.

In TS you’d write (pseudocode):

await listSharedPaths({ gitPath, shadowPath, mergeBase, current, prepared });

Structs§

RawChange
What: One change of a raw diff record: the path and its entries before and after. Why: Both listings produce these; a path missing from one side has an absent entry.
RawFormatError
What: Raw diff output that does not have the expected shape. Why: A malformed record cannot be attributed, so the replay fails rather than guess.
SharedPath
What: One path both sides changed, with its three entries. Why: The subsumption rules read the base, landed, and prepared entries together.
TreeEntry
What: One tree entry: its mode and object ID. Why: Subsumption compares modes as well as objects, and a regular file’s mode decides the synthetic base.

Enums§

SharedPathError
What: A shared-path listing failure: a Git command failed, or its output had an unexpected shape. Why: Replay reports either as transaction-failed.

Functions§

is_regular_triple
What: Whether all three entries are regular files, so only their bytes can decide the path. Why: Symbolic links and submodules never take the text check.
is_text_candidate
What: Whether the text check can decide a path: landed and prepared are regular files, and the base is one too or absent. Why: An addition on both sides is read against an empty base, so it is a candidate.
list_shared_paths
What: Lists the paths both the landed history and the prepared commit changed since the preparation base, in the landed listing’s order, with the three entries. Why: The landed listing decides the order subsumption and the synthetic base follow.
parse_raw_changes
What: Parses git diff-tree -r -z --raw --no-renames --no-abbrev output: a : header of five fields followed by the path, both NUL-terminated. Why: Each path appears once because renames are off, so the parser keeps records in output order.
same_entry
What: Whether two entries name the same mode and object, or are both absent. Why: An identical prepared and landed entry is subsumed without any text check.