Skip to main content

refresh_tracked

Function refresh_tracked 

Source
pub fn refresh_tracked(missing: MissingPolicy) -> Result<Vec<Outcome>>
Expand description

Refreshes every tracked entry against the currently-running binary’s embedded text. Driven by the recorded entries rather than a root and an agent list, so a single call spans every project the user has installed into. Uses the same drift rules as install, via state_of: Stale rewrites the file and updates the recorded hash, Modified is left byte-identical and reported as SkippedModified, and Current is reported as Unchanged without touching anything. Missing is rewritten only under MissingPolicy::RestorePreserve (what the pre-command auto-refresh passes) leaves a deliberately deleted file deleted, reporting nothing and leaving the entry’s version untouched so it is not mistaken for current.

A single entry’s write failing (read-only filesystem, permission denied, …) is reported as Action::Failed rather than aborting the loop with ? — every other entry’s refresh still lands, and save_state still persists them, so one unwritable path cannot swallow the whole batch nor spam the same warning on every future invocation forever. The failed entry keeps its old version and hash, so it is retried next time rather than being mistaken for current. refresh_tracked itself still returns Err when save_state fails, since at that point the whole operation’s work would otherwise be silently lost.