pub fn settle_displaced(
stage: &Path,
destination: &Path,
expected: ObjectId,
pointer: &[u8],
) -> Vec<String>Expand description
What: Settle the directory real Git made, now at the stage name: move what was added to it meanwhile into the new worktree, remove Git’s pointer when it is the one that was written, remove the directory when it is empty, and return what stays. Why: The destination may have gained files between the look and the exchange, and a recursive removal would delete them. Only the pointer and an empty directory are removed; every other entry is moved without replacing, or stays with a note.
In TS you’d write (pseudocode):
const notes = await settleDisplaced({ stage, destination, expected, pointer });