From 62ba9f1950e7f87aabb5b9af919389e645e53d0f Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Tue, 18 Jul 2017 22:15:18 +0200 Subject: [PATCH] check: Disable cache by default --- cmd/restic/cmd_check.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cmd/restic/cmd_check.go b/cmd/restic/cmd_check.go index b64429a0e..1a12585fd 100644 --- a/cmd/restic/cmd_check.go +++ b/cmd/restic/cmd_check.go @@ -19,6 +19,9 @@ var cmdCheck = &cobra.Command{ Long: ` The "check" command tests the repository for errors and reports any errors it finds. It can also be used to read all data and therefore simulate a restore. + +By default, the "check" command will always load all data directly from the +repository and not use a local cache. `, DisableAutoGenTag: true, RunE: func(cmd *cobra.Command, args []string) error { @@ -30,6 +33,7 @@ finds. It can also be used to read all data and therefore simulate a restore. type CheckOptions struct { ReadData bool CheckUnused bool + WithCache bool } var checkOptions CheckOptions @@ -40,6 +44,7 @@ func init() { f := cmdCheck.Flags() f.BoolVar(&checkOptions.ReadData, "read-data", false, "read all data blobs") f.BoolVar(&checkOptions.CheckUnused, "check-unused", false, "find unused blobs") + f.BoolVar(&checkOptions.WithCache, "with-cache", false, "use the cache") } func newReadProgress(gopts GlobalOptions, todo restic.Stat) *restic.Progress { @@ -77,6 +82,11 @@ func runCheck(opts CheckOptions, gopts GlobalOptions, args []string) error { return errors.Fatal("check has no arguments") } + if !opts.WithCache { + // do not use a cache for the checker + gopts.NoCache = true + } + repo, err := OpenRepository(gopts) if err != nil { return err