1
0
Fork 0
mirror of https://github.com/restic/restic.git synced 2024-12-22 07:43:03 +00:00

forget: indicate why the oldest snapshot in a group is kept

When the oldest snapshot in the
list is retained, the reason is now prefixed with "oldest" to clearly
indicate why it's being kept.
This commit is contained in:
Srigovind Nayak 2024-09-01 17:10:32 +05:30
parent 8a0edde407
commit 87f30bc787
No known key found for this signature in database
GPG key ID: 3C4A72A34ABD4C43

View file

@ -260,6 +260,9 @@ func ApplyPolicy(list Snapshots, p ExpirePolicy) (keep, remove Snapshots, reason
if buckets[i].Count > 0 {
buckets[i].Count--
}
if nr == len(list)-1 {
b.reason = fmt.Sprintf("oldest %v", b.reason)
}
keepSnapReasons = append(keepSnapReasons, b.reason)
}
}
@ -276,6 +279,9 @@ func ApplyPolicy(list Snapshots, p ExpirePolicy) (keep, remove Snapshots, reason
debug.Log("keep %v, time %v, ID %v, bucker %v, val %v %v\n", b.reason, cur.Time, cur.id.Str(), i, val, b.Last)
keepSnap = true
bucketsWithin[i].Last = val
if nr == len(list)-1 {
b.reason = fmt.Sprintf("oldest %v", b.reason)
}
keepSnapReasons = append(keepSnapReasons, fmt.Sprintf("%v %v", b.reason, b.Within))
}
}