summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-04-17 13:31:39 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-04-17 13:31:39 -0400
commit99729065ad220c525b9af09fbe9ac084217aefe7 (patch)
tree6680bf887800ed09f4cdb18aaff0fd53be349bb0
parentf10602dba8b61f82a654a0c855b5afe71bd80e0f (diff)
drop --from: When local repository is untrusted, its copy of a file does not count.
-rw-r--r--Command/Drop.hs12
-rw-r--r--debian/changelog2
-rw-r--r--doc/bugs/Drop_--from_always_trusts_local_repository.mdwn2
3 files changed, 13 insertions, 3 deletions
diff --git a/Command/Drop.hs b/Command/Drop.hs
index 269c4c26b..71f19a828 100644
--- a/Command/Drop.hs
+++ b/Command/Drop.hs
@@ -78,12 +78,18 @@ performRemote :: Key -> AssociatedFile -> NumCopies -> Remote -> CommandPerform
performRemote key afile numcopies remote = lockContent key $ do
-- Filter the remote it's being dropped from out of the lists of
-- places assumed to have the key, and places to check.
- -- When the local repo has the key, that's one additional copy.
+ -- 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
- let have = filter (/= uuid) $
- if present then u:trusteduuids else trusteduuids
+ trusteduuids' <- if present
+ then ifM ((<= SemiTrusted) <$> lookupTrust u)
+ ( pure (u:trusteduuids)
+ , pure trusteduuids
+ )
+ else pure trusteduuids
+ let have = filter (/= uuid) trusteduuids'
untrusteduuids <- trustGet UnTrusted
let tocheck = filter (/= remote) $
Remote.remotesWithoutUUID remotes (have++untrusteduuids)
diff --git a/debian/changelog b/debian/changelog
index 5fcec002a..817e4d4b6 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -21,6 +21,8 @@ git-annex (5.20140413) UNRELEASED; urgency=medium
the configuration of a previously known repository.
Useful if a repository got deleted and you want
to clone it back the way it was.
+ * drop --from: When local repository is untrusted, its copy of a file does
+ not count.
-- Joey Hess <joeyh@debian.org> Fri, 11 Apr 2014 21:33:35 -0400
diff --git a/doc/bugs/Drop_--from_always_trusts_local_repository.mdwn b/doc/bugs/Drop_--from_always_trusts_local_repository.mdwn
index a1b27cf5b..53bdda332 100644
--- a/doc/bugs/Drop_--from_always_trusts_local_repository.mdwn
+++ b/doc/bugs/Drop_--from_always_trusts_local_repository.mdwn
@@ -42,3 +42,5 @@ index 269c4c2..09ea99a 100644
let tocheck = filter (/= remote) $
Remote.remotesWithoutUUID remotes (have++untrusteduuids)
"""]]
+
+> [[fixed|done]] --[[Joey]]