summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2010-10-19 13:08:05 -0400
committerGravatar Joey Hess <joey@kitenet.net>2010-10-19 13:08:05 -0400
commit3531ce5c54e380d15d54d838c90f4ebe311782af (patch)
tree9ff4c4efffd4a654dda4f73bd77da55bb0f53956
parentd23fc22f0e17c95765f940f81f733f9580e19107 (diff)
fix remote uuid learning bug
-rw-r--r--Remotes.hs11
-rw-r--r--TODO3
-rw-r--r--TypeInternals.hs6
3 files changed, 12 insertions, 8 deletions
diff --git a/Remotes.hs b/Remotes.hs
index f21f5a6ba..828dc753f 100644
--- a/Remotes.hs
+++ b/Remotes.hs
@@ -30,17 +30,22 @@ withKey key = do
g <- Annex.gitRepo
uuids <- liftIO $ keyLocations g key
allremotes <- remotesByCost
- -- this only uses cached data, so may not find new remotes
+ -- This only uses cached data, so may not include new remotes
+ -- or remotes whose uuid has changed (eg by a different drive being
+ -- mounted at their location). So unless it happens to find all
+ -- remotes, try harder, loading the remotes' configs.
remotes <- reposByUUID allremotes uuids
- if (0 == length remotes)
+ remotesread <- Annex.flagIsSet RemotesRead
+ if ((length allremotes /= length remotes) && not remotesread)
then tryharder allremotes uuids
else return remotes
where
tryharder allremotes uuids = do
- -- more expensive; check each remote's config
+ -- more expensive; read each remote's config
mayberemotes <- mapM tryGitConfigRead allremotes
let allremotes' = catMaybes mayberemotes
remotes' <- reposByUUID allremotes' uuids
+ Annex.flagChange RemotesRead True
return remotes'
{- Cost Ordered list of remotes. -}
diff --git a/TODO b/TODO
index e6fdcd0b2..410c694c2 100644
--- a/TODO
+++ b/TODO
@@ -1,9 +1,6 @@
* bug: cannot "git annex ../foo" (GitRepo.relative is buggy and
git-ls-files also refuses w/o --full-name, which would need other changes)
-* bug: doesn't learn new remote's uuids if a known (but maybe not accessible)
- uuids has a wanted file
-
* --push/--pull should take a reponame and files, and push those files
to that repo; dropping them from the current repo
diff --git a/TypeInternals.hs b/TypeInternals.hs
index e8f7cb9e7..4a9d2653e 100644
--- a/TypeInternals.hs
+++ b/TypeInternals.hs
@@ -10,8 +10,10 @@ import Data.String.Utils
import qualified GitRepo as Git
--- command-line flags
-data Flag = Force deriving (Eq, Read, Show)
+data Flag =
+ Force | -- command-line flags
+ RemotesRead -- indicates that remote repo configs have been read
+ deriving (Eq, Read, Show)
-- git-annex's runtime state type doesn't really belong here,
-- but it uses Backend, so has to be here to avoid a depends loop.