summaryrefslogtreecommitdiff
path: root/Command/Drop.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-04-30 13:13:28 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-04-30 13:13:28 -0400
commitc4038364f3f2bc496fb45025c6bc18e9e52fd566 (patch)
tree0ac3f8880603563186cd205c5c824b63fa0ad989 /Command/Drop.hs
parent32428ac0d066a02a3accc487aedfe49729cd1bbf (diff)
nub list after adding ocal uuid to it
This potentially fixes a numcopies counting bug when dropping --from a remote, and the local repository is trusted. The local repo would end up in the list twice, so it would verify one less copy than it was supposed to.
Diffstat (limited to 'Command/Drop.hs')
-rw-r--r--Command/Drop.hs11
1 files changed, 4 insertions, 7 deletions
diff --git a/Command/Drop.hs b/Command/Drop.hs
index 63b9ccb7f..f6a9cce4c 100644
--- a/Command/Drop.hs
+++ b/Command/Drop.hs
@@ -93,14 +93,11 @@ performRemote key afile numcopies remote = do
-- When the local repo has the key, that's one additional copy,
-- as long asthe local repo is not untrusted.
(remotes, trusteduuids) <- Remote.keyPossibilitiesTrusted key
- present <- inAnnex key
u <- getUUID
- trusteduuids' <- if present
- then ifM ((<= SemiTrusted) <$> lookupTrust u)
- ( pure (u:trusteduuids)
- , pure trusteduuids
- )
- else pure trusteduuids
+ trusteduuids' <- ifM (inAnnex key <&&> (<= SemiTrusted) <$> lookupTrust u)
+ ( pure (nub (u:trusteduuids))
+ , pure trusteduuids
+ )
let have = filter (/= uuid) trusteduuids'
untrusteduuids <- trustGet UnTrusted
let tocheck = filter (/= remote) $