Support hot-swapping of removable drives containing gcrypt repositories.
To support this, a core.gcrypt-id is stored by git-annex inside the git config of a local gcrypt repository, when setting it up. That is compared with the remote's cached gcrypt-id. When different, a drive has been changed. git-annex then looks up the remote config for the uuid mapped from the core.gcrypt-id, and tweaks the configuration appropriately. When there is no known config for the uuid, it will refuse to use the remote.
This commit is contained in:
parent
5aecf2b42d
commit
5fe49b98f8
15 changed files with 85 additions and 42 deletions
|
@ -67,7 +67,7 @@ remoteList = do
|
|||
return rs'
|
||||
else return rs
|
||||
where
|
||||
process m t = enumerate t >>= mapM (remoteGen m t)
|
||||
process m t = enumerate t >>= mapM (remoteGen m t) >>= return . catMaybes
|
||||
|
||||
{- Forces the remoteList to be re-generated, re-reading the git config. -}
|
||||
remoteListRefresh :: Annex [Remote]
|
||||
|
@ -80,16 +80,17 @@ remoteListRefresh = do
|
|||
remoteList
|
||||
|
||||
{- Generates a Remote. -}
|
||||
remoteGen :: (M.Map UUID RemoteConfig) -> RemoteType -> Git.Repo -> Annex Remote
|
||||
remoteGen :: (M.Map UUID RemoteConfig) -> RemoteType -> Git.Repo -> Annex (Maybe Remote)
|
||||
remoteGen m t r = do
|
||||
u <- getRepoUUID r
|
||||
g <- fromRepo id
|
||||
let gc = extractRemoteGitConfig g (Git.repoDescribe r)
|
||||
let c = fromMaybe M.empty $ M.lookup u m
|
||||
addHooks <$> generate t r u c gc
|
||||
mrmt <- generate t r u c gc
|
||||
return $ addHooks <$> mrmt
|
||||
|
||||
{- Updates a local git Remote, re-reading its git config. -}
|
||||
updateRemote :: Remote -> Annex Remote
|
||||
updateRemote :: Remote -> Annex (Maybe Remote)
|
||||
updateRemote remote = do
|
||||
m <- readRemoteLog
|
||||
remote' <- updaterepo $ repo remote
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue