Documentation
¶
Overview ¶
Package backup snapshots live copy-mode destinations into the profile before apply overwrites them. Backups are copy-mode only: symlink destinations are recreated as links, and edit entries are marker-scoped, so a copy overwrite is the one apply operation that loses destination content.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Generations ¶
Generations lists a module directory's backup generation names newest-first (generation names are timestamps, so lexical order is time order). A module without a backups/ directory lists empty.
func RestoreItem ¶
RestoreItem is Run's inverse for one target: the copy Run wrote to <genDir>/<target-without-leading-slash> lands back at the absolute live target. A symlink currently sitting at the target is removed, not followed — writing through it would clobber whatever it points at (e.g. the profile source after a mode switch). Missing parent directories are created; content and file mode come from the backup. A target with no backup in the generation is an error naming the target.
func Run ¶
Run copies every existing Target to <ModuleDir>/backups/<gen>/<Target>: absolute target paths mirror under the generation directory, so a restore is a plain copy back to the mirrored path. gen identifies the run (one apply = one generation shared by every module). Missing targets are skipped — nothing exists to lose. Returns the number of top-level units (files or directories) written. Any unreadable target is an error, not a skip: the caller asked for a backup before overwrite, so losing the file silently must never happen.