From 43e2c9837ef3fd104b80737b71288730e0f85f48 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Sun, 8 Nov 2015 21:24:51 +0100 Subject: [PATCH] check: removing orphaned packs is handled in 'optimize' --- cmd/restic/cmd_check.go | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/cmd/restic/cmd_check.go b/cmd/restic/cmd_check.go index e8e54aa37..a94ad138b 100644 --- a/cmd/restic/cmd_check.go +++ b/cmd/restic/cmd_check.go @@ -5,14 +5,12 @@ import ( "fmt" "os" - "github.com/restic/restic/backend" "github.com/restic/restic/checker" ) 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"` - CheckUnused bool `long:"check-unused" description:"Check for unused blobs" default:"false"` + ReadData bool `long:"read-data" description:"Read data blobs" default:"false"` + CheckUnused bool `long:"check-unused" description:"Check for unused blobs" default:"false"` global *GlobalOptions } @@ -81,14 +79,9 @@ func (cmd CmdCheck) Execute(args []string) error { cmd.global.Verbosef("Check all packs\n") go chkr.Packs(errChan, done) - foundOrphanedPacks := false for err := range errChan { errorsFound = true fmt.Fprintf(os.Stderr, "%v\n", err) - - if e, ok := err.(checker.PackError); ok && e.Orphaned { - foundOrphanedPacks = true - } } cmd.global.Verbosef("Check snapshots, trees and blobs\n") @@ -114,19 +107,6 @@ func (cmd CmdCheck) Execute(args []string) error { } } - if foundOrphanedPacks && cmd.RemoveOrphaned { - IDs := chkr.OrphanedPacks() - cmd.global.Verbosef("Remove %d orphaned packs... ", len(IDs)) - - for _, id := range IDs { - if err := repo.Backend().Remove(backend.Data, id.String()); err != nil { - fmt.Fprintf(os.Stderr, "%v\n", err) - } - } - - cmd.global.Verbosef("done\n") - } - if errorsFound { return errors.New("repository contains errors") }