From cd948b56aca7bc79fc3532787a364b5638a541ee Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Sun, 8 Nov 2015 20:46:52 +0100 Subject: [PATCH] cmd_check: Don't display unused blobs by default --- cmd/restic/cmd_check.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/cmd/restic/cmd_check.go b/cmd/restic/cmd_check.go index 919568618..e8e54aa37 100644 --- a/cmd/restic/cmd_check.go +++ b/cmd/restic/cmd_check.go @@ -10,8 +10,9 @@ import ( ) type CmdCheck struct { - ReadData bool `long:"read-data" description:"Read data blobs" default:"false"` - RemoveOrphaned bool `long:"remove" description:"Remove data that isn't used" default:"false"` + ReadData bool `long:"read-data" description:"Read data blobs" default:"false"` + RemoveOrphaned bool `long:"remove" description:"Remove data that isn't used" default:"false"` + CheckUnused bool `long:"check-unused" description:"Check for unused blobs" default:"false"` global *GlobalOptions } @@ -106,8 +107,11 @@ func (cmd CmdCheck) Execute(args []string) error { } } - for _, id := range chkr.UnusedBlobs() { - cmd.global.Verbosef("unused blob %v\n", id.Str()) + if cmd.CheckUnused { + for _, id := range chkr.UnusedBlobs() { + cmd.global.Verbosef("unused blob %v\n", id.Str()) + errorsFound = true + } } if foundOrphanedPacks && cmd.RemoveOrphaned {