Do not prune after a backup that found a configured path empty (closes #388)
check / check (push) Canceled after 0s

snapshot create --prune of a snapshot whose path was an empty
directory, as the mount point of a volume that is not mounted is,
recorded an empty snapshot and then purged the older snapshots that
held the data, with their blobs.

The scan now counts the entries it finds in each configured path.
Under --prune, a run in which a path of a snapshot it made held
nothing skips the prune, keeps every older snapshot, warns naming the
path and snapshot, and exits non-zero, as
#382 does for unreadable
files. Only the current run is looked at. Without --prune nothing
changes. The README's --prune text and the flag's help say so.

Model: opus-5-5
This commit is contained in:
2026-10-14 21:39:25 +00:00
parent 6a57750a7b
commit 24152ce6d6
6 changed files with 260 additions and 36 deletions
+5 -3
View File
@@ -115,8 +115,9 @@ on Linux), then /etc/vaultik/config.yml.`,
return
}
if errors.Is(err, vaultik.ErrFilesUnreadable) {
log.Error("Backup completed with unreadable files", "error", err)
if errors.Is(err, vaultik.ErrFilesUnreadable) ||
errors.Is(err, vaultik.ErrSourcePathEmpty) {
log.Error("Backup completed with an error", "error", err)
ReportErrorf("Backup completed, but %v", err)
return
@@ -133,7 +134,8 @@ on Linux), then /etc/vaultik/config.yml.`,
cmd.Flags().BoolVar(&opts.Prune, "prune", false,
"After backup, drop older snapshots of the same name and remove "+
"orphaned blobs older than prune_grace_period (not after a "+
"backup that skipped unreadable files)")
"backup that skipped unreadable files or found a configured "+
"path empty)")
cmd.Flags().StringVar(&opts.KeepNewerThan, "keep-newer-than", "",
"With --prune: keep snapshots newer than this duration "+
"(e.g. 30d, 4w, 6mo, 1y; m is minutes, mo is months) "+