fix remote uuid learning bug
This commit is contained in:
parent
d23fc22f0e
commit
3531ce5c54
3 changed files with 12 additions and 8 deletions
11
Remotes.hs
11
Remotes.hs
|
@ -30,17 +30,22 @@ withKey key = do
|
||||||
g <- Annex.gitRepo
|
g <- Annex.gitRepo
|
||||||
uuids <- liftIO $ keyLocations g key
|
uuids <- liftIO $ keyLocations g key
|
||||||
allremotes <- remotesByCost
|
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
|
remotes <- reposByUUID allremotes uuids
|
||||||
if (0 == length remotes)
|
remotesread <- Annex.flagIsSet RemotesRead
|
||||||
|
if ((length allremotes /= length remotes) && not remotesread)
|
||||||
then tryharder allremotes uuids
|
then tryharder allremotes uuids
|
||||||
else return remotes
|
else return remotes
|
||||||
where
|
where
|
||||||
tryharder allremotes uuids = do
|
tryharder allremotes uuids = do
|
||||||
-- more expensive; check each remote's config
|
-- more expensive; read each remote's config
|
||||||
mayberemotes <- mapM tryGitConfigRead allremotes
|
mayberemotes <- mapM tryGitConfigRead allremotes
|
||||||
let allremotes' = catMaybes mayberemotes
|
let allremotes' = catMaybes mayberemotes
|
||||||
remotes' <- reposByUUID allremotes' uuids
|
remotes' <- reposByUUID allremotes' uuids
|
||||||
|
Annex.flagChange RemotesRead True
|
||||||
return remotes'
|
return remotes'
|
||||||
|
|
||||||
{- Cost Ordered list of remotes. -}
|
{- Cost Ordered list of remotes. -}
|
||||||
|
|
3
TODO
3
TODO
|
@ -1,9 +1,6 @@
|
||||||
* bug: cannot "git annex ../foo" (GitRepo.relative is buggy and
|
* bug: cannot "git annex ../foo" (GitRepo.relative is buggy and
|
||||||
git-ls-files also refuses w/o --full-name, which would need other changes)
|
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
|
* --push/--pull should take a reponame and files, and push those files
|
||||||
to that repo; dropping them from the current repo
|
to that repo; dropping them from the current repo
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,10 @@ import Data.String.Utils
|
||||||
|
|
||||||
import qualified GitRepo as Git
|
import qualified GitRepo as Git
|
||||||
|
|
||||||
-- command-line flags
|
data Flag =
|
||||||
data Flag = Force deriving (Eq, Read, Show)
|
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,
|
-- 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.
|
-- but it uses Backend, so has to be here to avoid a depends loop.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue