summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-12-31 01:42:42 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-12-31 01:42:42 -0400
commit015a497914d0614afff705d5f9acd79d956740ec (patch)
tree8d1d4199a0b5aba1264fda1285d7433335e6f1d5
parente7d3e546c298add0a39ec1a979d9b1574b9b9b76 (diff)
avoid syncing remotes configured annex-ignore, unless explicitly specified
-rw-r--r--Command/Sync.hs4
-rw-r--r--Remote.hs7
2 files changed, 8 insertions, 3 deletions
diff --git a/Command/Sync.hs b/Command/Sync.hs
index 81b77e5cc..d8eb0fc39 100644
--- a/Command/Sync.hs
+++ b/Command/Sync.hs
@@ -54,12 +54,12 @@ syncRemotes rs = do
else wanted
where
wanted
- | null rs = filterM hasurl =<< Remote.remoteList
+ | null rs = filterM hasurl =<< Remote.enabledRemoteList
| otherwise = listed
listed = mapM Remote.byName rs
hasurl r = not . null <$> geturl r
geturl r = fromRepo $ Git.Config.get ("remote." ++ Remote.name r ++ ".url") ""
- pickfast = (++) <$> listed <*> (fastest <$> Remote.remoteList)
+ pickfast = (++) <$> listed <*> (fastest <$> Remote.enabledRemoteList)
fastest = fromMaybe [] . headMaybe .
map snd . sort . M.toList . costmap
costmap = M.fromListWith (++) . map costpair
diff --git a/Remote.hs b/Remote.hs
index 643ba2d0d..94c301192 100644
--- a/Remote.hs
+++ b/Remote.hs
@@ -17,6 +17,7 @@ module Remote (
remoteTypes,
remoteList,
+ enabledRemoteList,
remoteMap,
byName,
prettyPrintUUIDs,
@@ -85,6 +86,10 @@ remoteList = do
u <- getRepoUUID r
generate t r u (M.lookup u m)
+{- All remotes that are not ignored. -}
+enabledRemoteList :: Annex [Remote Annex]
+enabledRemoteList = filterM (repoNotIgnored . repo) =<< remoteList
+
{- Map of UUIDs of Remotes and their names. -}
remoteMap :: Annex (M.Map UUID String)
remoteMap = M.fromList . map (\r -> (uuid r, name r)) <$> remoteList
@@ -196,7 +201,7 @@ keyPossibilities' withtrusted key = do
let validtrusteduuids = validuuids `intersect` trusted
-- remotes that match uuids that have the key
- allremotes <- filterM (repoNotIgnored . repo) =<< remoteList
+ allremotes <- enabledRemoteList
let validremotes = remotesWithUUID allremotes validuuids
return (sort validremotes, validtrusteduuids)