Skip to main content

Module worktree_copy_compare

Module worktree_copy_compare 

Source
Expand description

Exact comparison of manifest entries against the filesystem, and the source stability check after staging. What: Exact comparison of one manifest entry against the filesystem: its kind, its retained mode, its symbolic-link target text or its regular-file bytes. Also the final check that the source still matches the stage after staging. Why: A destination must receive exactly what was staged from the source, and a source that changed during the transfer must block the destination.

In TS you’d write (pseudocode):

await assertFinalSourceEquivalence({ sourceRoot, stageRoot, selectedRoots, excludedSourceRoots, stagedEntries });

Functions§

assert_final_source_equivalence
What: Checks that the source still matches the initial manifest after staging, and that the stage holds exactly that manifest. Why: Any difference means the source changed during the copy, so the destination must not receive the stage.
entry_matches
What: Whether one actual entry matches an expected entry exactly. Why: Kind, mode and content must all match, and an absent entry never matches.
lstat_or_absent
What: The metadata of one no-follow entry, or its absence. Why: A missing destination entry is a normal answer for the comparison, not a failure.