From 5c2dfeee46a878023275b56266e8044cfb9b34f2 Mon Sep 17 00:00:00 2001 From: Sezal Agrawal Date: Fri, 20 Sep 2019 00:12:17 +0530 Subject: [PATCH] operations: display 'All duplicates removed' only if dedupe successful -fixes rclone#3550 --- fs/operations/dedupe.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/fs/operations/dedupe.go b/fs/operations/dedupe.go index a39c63129..6ab09b57e 100644 --- a/fs/operations/dedupe.go +++ b/fs/operations/dedupe.go @@ -85,13 +85,16 @@ func dedupeDeleteIdentical(ctx context.Context, ht hash.Type, remote string, obj // Delete identical duplicates, filling remainingObjs with the ones remaining for md5sum, hashObjs := range byHash { + remainingObjs = append(remainingObjs, hashObjs[0]) if len(hashObjs) > 1 { fs.Logf(remote, "Deleting %d/%d identical duplicates (%v %q)", len(hashObjs)-1, len(hashObjs), ht, md5sum) for _, o := range hashObjs[1:] { - _ = DeleteFile(ctx, o) + err := DeleteFile(ctx, o) + if err != nil { + remainingObjs = append(remainingObjs, o) + } } } - remainingObjs = append(remainingObjs, hashObjs[0]) } return remainingObjs