Skip to main content

prepare_replacements

Function prepare_replacements 

Source
pub fn prepare_replacements(
    root: &Path,
    changes: &[InstallChange],
) -> Result<Vec<Replacement>, String>
Expand description

What: Prepare every replacement: check the file still holds the bytes the fix read, copy it beside itself, and write the corrected bytes beside it. Why: Nothing in the worktree changes until every file is prepared, so a file that changed under the fix stops it before any file is replaced.

In TS you’d write (pseudocode):

async function prepareReplacements(root, changes): Promise<PreparedReplacement[]>;