summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-12-05 12:44:08 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-12-05 12:44:08 -0400
commit3540e34025049ed4420810f21cdad6a5adc851c5 (patch)
tree6ed24edcb6da8d95b15b6191c8c93482f3666210
parent0517167a9cff40fcdddb0f2997cb729dd2d4fe03 (diff)
assistant: Avoid trying to drop content from remotes that don't have it.
-rw-r--r--Assistant/Drop.hs11
-rw-r--r--debian/changelog1
-rw-r--r--doc/bugs/assistant_wants_my_gpg_passphrase_when_it_has_nothing_to_drop_or_copy_to_that_remote.mdwn2
3 files changed, 13 insertions, 1 deletions
diff --git a/Assistant/Drop.hs b/Assistant/Drop.hs
index 7b85ece8d..8098300ae 100644
--- a/Assistant/Drop.hs
+++ b/Assistant/Drop.hs
@@ -11,7 +11,7 @@ import Assistant.Common
import Assistant.DaemonStatus
import Logs.Location
import Logs.Trust
-import Types.Remote (AssociatedFile)
+import Types.Remote (AssociatedFile, uuid)
import qualified Remote
import qualified Command.Drop
import Command
@@ -19,6 +19,8 @@ import Annex.Wanted
import Annex.Exception
import Config
+import qualified Data.Set as S
+
{- Drop from local and/or remote when allowed by the preferred content and
- numcopies settings. -}
handleDrops :: Bool -> Key -> AssociatedFile -> Maybe Remote -> Assistant ()
@@ -29,6 +31,10 @@ handleDrops fromhere key f knownpresentremote = do
locs <- loggedLocations key
handleDropsFrom locs syncrs fromhere key f knownpresentremote
+{- The UUIDs are ones where the content is believed to be present.
+ - The Remote list can include other remotes that do not have the content;
+ - only ones that match the UUIDs will be dropped from.
+ - If allows to drop fromhere, that drop will be tried first. -}
handleDropsFrom :: [UUID] -> [Remote] -> Bool -> Key -> AssociatedFile -> Maybe Remote -> Annex ()
handleDropsFrom _ _ _ _ Nothing _ = noop
handleDropsFrom locs rs fromhere key (Just f) knownpresentremote
@@ -48,6 +54,7 @@ handleDropsFrom locs rs fromhere key (Just f) knownpresentremote
go [] _ = noop
go (r:rest) n
+ | uuid r `S.notMember` slocs = go rest n
| checkcopies n = dropr r n >>= go rest
| otherwise = noop
@@ -66,3 +73,5 @@ handleDropsFrom locs rs fromhere key (Just f) knownpresentremote
Command.Drop.startRemote f numcopies key r
safely a = either (const False) id <$> tryAnnex a
+
+ slocs = S.fromList locs
diff --git a/debian/changelog b/debian/changelog
index 78af41bd9..d43bdcff8 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -20,6 +20,7 @@ git-annex (3.20121128) UNRELEASED; urgency=low
* webapp: Added help buttons and links next to fields that require
explanations.
* webapp: Encryption can be disabled when setting up remotes.
+ * assistant: Avoid trying to drop content from remotes that don't have it.
-- Joey Hess <joeyh@debian.org> Wed, 28 Nov 2012 13:31:07 -0400
diff --git a/doc/bugs/assistant_wants_my_gpg_passphrase_when_it_has_nothing_to_drop_or_copy_to_that_remote.mdwn b/doc/bugs/assistant_wants_my_gpg_passphrase_when_it_has_nothing_to_drop_or_copy_to_that_remote.mdwn
index f9a8424c4..657a4dd3d 100644
--- a/doc/bugs/assistant_wants_my_gpg_passphrase_when_it_has_nothing_to_drop_or_copy_to_that_remote.mdwn
+++ b/doc/bugs/assistant_wants_my_gpg_passphrase_when_it_has_nothing_to_drop_or_copy_to_that_remote.mdwn
@@ -1,3 +1,5 @@
I am running 3.20121112 and this bug appeared when I upgraded to that from 3.20121017.
After performing the startup scan after I login, git-annex gets GPG to sends me a pinentry pop-up asking for my GPG passphrase. However, I know that there is nothing to be dropped or copied to the encrypted SSH remote that I am being asked to provide access to. So I can't see any good reason why I would be asked for the passphrase.
+
+> [[fixed|done]] --[[Joey]]