Skip to main content

Module backup

Module backup 

Source
Expand description

Centralized, prunable backups of issue files (#1581).

Every write that replaces an issue’s on-disk content — the TUI’s editor / repair / conflict path and tix import’s overwrite of a newer remote issue — first copies the previous bytes here, into a hidden .tix-backups/ directory beside the issues directory (the same sibling convention crate::storage’s number-claim ledger uses). One directory collects every backup, so they are discoverable in one place instead of scattered through the {assignee}/{type}/{status} segments, and prune bounds how many are kept.

A backup is named <stem>.<unix_nanos>.md, where <stem> is the issue file’s basename without its .md extension: the timestamp both orders the copies and keeps repeated saves of one issue distinct. tix clean --keep N prunes the directory to the newest N per stem.

Functions§

dir
The hidden directory beside issues_dir that holds every backup.
list
Every backup under dir, newest first by the timestamp in its name.
prune
Keep the newest keep backups per issue stem, deleting the rest.
save
Copy <issues_dir>/<filename> into dir under a timestamped name, returning the backup path.