Skip to main content

reverse

Function reverse 

Source
pub fn reverse(rendered: &str, applied: &[AppliedReplacement]) -> String
Expand description

Undo a render: rewrite this instance’s values back to the committed ones.

This is what lets a tracker-owned file be rendered at all. The lane is shared by every instance, so newgit capture reverses the substitution before recording — a key you add to .env.local reaches the lane and this instance’s port does not. Only literal substitution can be run backwards; a whole-file template could not.

Simultaneous for the same reason apply is, and lenient where apply is strict: this runs against a file someone may have edited, so a value that no longer appears the declared number of times is not an error here. Whether those edits survive is crate::manager’s question, not this function’s.