restic diff, stats, tag - more command which vannot handle partial snapshots

inserted check for partial snapshots
This commit is contained in:
Winfried Plappert 2025-03-05 21:44:34 +00:00
parent 1873780d41
commit be6a144503
3 changed files with 14 additions and 2 deletions

View File

@ -74,6 +74,10 @@ func loadSnapshot(ctx context.Context, be restic.Lister, repo restic.LoaderUnpac
if err != nil { if err != nil {
return nil, "", errors.Fatal(err.Error()) return nil, "", errors.Fatal(err.Error())
} }
err = checkPartialSnapshot(sn, "fatal", "diff")
if err != nil {
return sn, "", err
}
return sn, subfolder, err return sn, subfolder, err
} }

View File

@ -130,6 +130,10 @@ func runStats(ctx context.Context, opts StatsOptions, gopts GlobalOptions, args
} }
for sn := range FindFilteredSnapshots(ctx, snapshotLister, repo, &opts.SnapshotFilter, args) { for sn := range FindFilteredSnapshots(ctx, snapshotLister, repo, &opts.SnapshotFilter, args) {
err = checkPartialSnapshot(sn, "fatal", "stats")
if err != nil {
return err
}
err = statsWalkSnapshot(ctx, sn, repo, opts, stats) err = statsWalkSnapshot(ctx, sn, repo, opts, stats)
if err != nil { if err != nil {
return fmt.Errorf("error walking snapshot: %v", err) return fmt.Errorf("error walking snapshot: %v", err)

View File

@ -157,6 +157,10 @@ func runTag(ctx context.Context, opts TagOptions, gopts GlobalOptions, term *ter
} }
for sn := range FindFilteredSnapshots(ctx, repo, repo, &opts.SnapshotFilter, args) { for sn := range FindFilteredSnapshots(ctx, repo, repo, &opts.SnapshotFilter, args) {
err := checkPartialSnapshot(sn, "fatal", "tag")
if err != nil {
return err
}
changed, err := changeTags(ctx, repo, sn, opts.SetTags.Flatten(), opts.AddTags.Flatten(), opts.RemoveTags.Flatten(), printFunc) changed, err := changeTags(ctx, repo, sn, opts.SetTags.Flatten(), opts.AddTags.Flatten(), opts.RemoveTags.Flatten(), printFunc)
if err != nil { if err != nil {
Warnf("unable to modify the tags for snapshot ID %q, ignoring: %v\n", sn.ID(), err) Warnf("unable to modify the tags for snapshot ID %q, ignoring: %v\n", sn.ID(), err)