From d92b1734f476d7f67f176d7f853c7013baffb301 Mon Sep 17 00:00:00 2001 From: Gilbert Chen Date: Wed, 27 Sep 2023 15:31:08 -0400 Subject: [PATCH] Skip identical entries when listing chunks The prune command can remove redundant chunks (chunks with the same chunk id but at different subdirectory level). However, if the same chunk appears mutliple times in the listing returned by the storage, it will be treated as a redundant chunk and thus removed. --- src/duplicacy_snapshotmanager.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/duplicacy_snapshotmanager.go b/src/duplicacy_snapshotmanager.go index 28ddc580..0482512b 100644 --- a/src/duplicacy_snapshotmanager.go +++ b/src/duplicacy_snapshotmanager.go @@ -2427,7 +2427,13 @@ func (manager *SnapshotManager) pruneSnapshotsExhaustive(referencedFossils map[s } allFiles, _ := manager.ListAllFiles(manager.storage, chunkDir) + uniqueFiles := make(map[string]bool) for _, file := range allFiles { + if _, found := uniqueFiles[file]; found { + continue + } + uniqueFiles[file] = true + if len(file) == 0 || file[len(file)-1] == '/' { continue }