From 1873780d41a0b3f13a3f095b762218c8cfebd02c Mon Sep 17 00:00:00 2001 From: Winfried Plappert Date: Tue, 4 Mar 2025 16:58:03 +0000 Subject: [PATCH] the commands which will definitely not operate on partial snapshots --- cmd/restic/cmd_copy.go | 4 ++++ cmd/restic/cmd_dump.go | 4 ++++ cmd/restic/cmd_restore.go | 4 ++++ cmd/restic/cmd_rewrite.go | 5 +++++ 4 files changed, 17 insertions(+) diff --git a/cmd/restic/cmd_copy.go b/cmd/restic/cmd_copy.go index 2ad5a464c..2c1dc3182 100644 --- a/cmd/restic/cmd_copy.go +++ b/cmd/restic/cmd_copy.go @@ -129,6 +129,10 @@ func runCopy(ctx context.Context, opts CopyOptions, gopts GlobalOptions, args [] if sn.Original != nil { srcOriginal = *sn.Original } + err = checkPartialSnapshot(sn, "fatal", "copy") + if err != nil { + return err + } if originalSns, ok := dstSnapshotByOriginal[srcOriginal]; ok { isCopy := false diff --git a/cmd/restic/cmd_dump.go b/cmd/restic/cmd_dump.go index 978b64616..5bb879a39 100644 --- a/cmd/restic/cmd_dump.go +++ b/cmd/restic/cmd_dump.go @@ -156,6 +156,10 @@ func runDump(ctx context.Context, opts DumpOptions, gopts GlobalOptions, args [] if err != nil { return errors.Fatalf("failed to find snapshot: %v", err) } + err = checkPartialSnapshot(sn, "fatal", "dump") + if err != nil { + return err + } bar := newIndexProgress(gopts.Quiet, gopts.JSON) err = repo.LoadIndex(ctx, bar) diff --git a/cmd/restic/cmd_restore.go b/cmd/restic/cmd_restore.go index a29b8a19e..667212249 100644 --- a/cmd/restic/cmd_restore.go +++ b/cmd/restic/cmd_restore.go @@ -145,6 +145,10 @@ func runRestore(ctx context.Context, opts RestoreOptions, gopts GlobalOptions, if err != nil { return errors.Fatalf("failed to find snapshot: %v", err) } + err = checkPartialSnapshot(sn, "error", "restore") + if err != nil { + return err + } bar := newIndexTerminalProgress(gopts.Quiet, gopts.JSON, term) err = repo.LoadIndex(ctx, bar) diff --git a/cmd/restic/cmd_rewrite.go b/cmd/restic/cmd_rewrite.go index 4e5b39932..cf8ff5009 100644 --- a/cmd/restic/cmd_rewrite.go +++ b/cmd/restic/cmd_rewrite.go @@ -321,6 +321,11 @@ func runRewrite(ctx context.Context, opts RewriteOptions, gopts GlobalOptions, a changedCount := 0 for sn := range FindFilteredSnapshots(ctx, snapshotLister, repo, &opts.SnapshotFilter, args) { + err = checkPartialSnapshot(sn, "fatal", "rewrite") + if err != nil { + return err + } + Verbosef("\n%v\n", sn) changed, err := rewriteSnapshot(ctx, repo, sn, opts) if err != nil {