fix remote uuid learning bug

This commit is contained in:
Joey Hess 2010-10-19 13:08:05 -04:00
parent d23fc22f0e
commit 3531ce5c54
3 changed files with 12 additions and 8 deletions

View file

@ -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. -}

3
TODO
View file

@ -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

View file

@ -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.