ignore gcrypt remotes w/o an annex-uuid
This commit is contained in:
parent
e05b0f4906
commit
00fb5705ff
3 changed files with 17 additions and 8 deletions
|
@ -25,6 +25,9 @@ instance Show ConfigKey where
|
||||||
getConfig :: ConfigKey -> String -> Annex String
|
getConfig :: ConfigKey -> String -> Annex String
|
||||||
getConfig (ConfigKey key) def = fromRepo $ Git.Config.get key def
|
getConfig (ConfigKey key) def = fromRepo $ Git.Config.get key def
|
||||||
|
|
||||||
|
getConfigMaybe :: ConfigKey -> Annex (Maybe String)
|
||||||
|
getConfigMaybe (ConfigKey key) = fromRepo $ Git.Config.getMaybe key
|
||||||
|
|
||||||
{- Changes a git config setting in both internal state and .git/config -}
|
{- Changes a git config setting in both internal state and .git/config -}
|
||||||
setConfig :: ConfigKey -> String -> Annex ()
|
setConfig :: ConfigKey -> String -> Annex ()
|
||||||
setConfig (ConfigKey key) value = do
|
setConfig (ConfigKey key) value = do
|
||||||
|
|
|
@ -25,6 +25,7 @@ import Config
|
||||||
import Config.Cost
|
import Config.Cost
|
||||||
import Remote.Helper.Git
|
import Remote.Helper.Git
|
||||||
import Remote.Helper.Encryptable
|
import Remote.Helper.Encryptable
|
||||||
|
import Remote.Helper.Special
|
||||||
import Utility.Metered
|
import Utility.Metered
|
||||||
import Crypto
|
import Crypto
|
||||||
import Annex.UUID
|
import Annex.UUID
|
||||||
|
@ -145,7 +146,9 @@ gCryptSetup mu c = go $ M.lookup "gitrepo" c
|
||||||
Just v -> do
|
Just v -> do
|
||||||
let u = genUUIDInNameSpace gCryptNameSpace v
|
let u = genUUIDInNameSpace gCryptNameSpace v
|
||||||
if Just u == mu || mu == Nothing
|
if Just u == mu || mu == Nothing
|
||||||
then return (c', u)
|
then do
|
||||||
|
gitConfigSpecialRemote u c' "gcrypt" "true"
|
||||||
|
return (c', u)
|
||||||
else error "uuid mismatch"
|
else error "uuid mismatch"
|
||||||
|
|
||||||
store :: Remote -> Remote.Rsync.RsyncOpts -> (Cipher, Key) -> Key -> MeterUpdate -> Annex Bool
|
store :: Remote -> Remote.Rsync.RsyncOpts -> (Cipher, Key) -> Key -> MeterUpdate -> Annex Bool
|
||||||
|
|
|
@ -144,13 +144,7 @@ tryGitConfigRead r
|
||||||
| Git.repoIsHttp r = do
|
| Git.repoIsHttp r = do
|
||||||
headers <- getHttpHeaders
|
headers <- getHttpHeaders
|
||||||
store $ geturlconfig headers
|
store $ geturlconfig headers
|
||||||
| Git.GCrypt.isEncrypted r = do
|
| Git.GCrypt.isEncrypted r = handlegcrypt =<< getConfigMaybe (remoteConfig r "uuid")
|
||||||
-- Generate a UUID from the gcrypt-id
|
|
||||||
g <- gitRepo
|
|
||||||
case Git.GCrypt.remoteRepoId g (Git.remoteName r) of
|
|
||||||
Nothing -> return r
|
|
||||||
Just v -> store $ liftIO $ setUUID r $
|
|
||||||
genUUIDInNameSpace gCryptNameSpace v
|
|
||||||
| Git.repoIsUrl r = return r
|
| Git.repoIsUrl r = return r
|
||||||
| otherwise = store $ safely $ onLocal r $ do
|
| otherwise = store $ safely $ onLocal r $ do
|
||||||
ensureInitialized
|
ensureInitialized
|
||||||
|
@ -218,6 +212,15 @@ tryGitConfigRead r
|
||||||
let k = "remote." ++ n ++ ".annex-ignore"
|
let k = "remote." ++ n ++ ".annex-ignore"
|
||||||
warning $ "Remote " ++ n ++ " " ++ msg ++ "; setting " ++ k
|
warning $ "Remote " ++ n ++ " " ++ msg ++ "; setting " ++ k
|
||||||
inRepo $ Git.Command.run [Param "config", Param k, Param "true"]
|
inRepo $ Git.Command.run [Param "config", Param k, Param "true"]
|
||||||
|
|
||||||
|
handlegcrypt Nothing = return r
|
||||||
|
handlegcrypt (Just _cacheduuid) = do
|
||||||
|
-- Generate UUID from the gcrypt-id
|
||||||
|
g <- gitRepo
|
||||||
|
case Git.GCrypt.remoteRepoId g (Git.remoteName r) of
|
||||||
|
Nothing -> return r
|
||||||
|
Just v -> store $ liftIO $ setUUID r $
|
||||||
|
genUUIDInNameSpace gCryptNameSpace v
|
||||||
|
|
||||||
{- Checks if a given remote has the content for a key inAnnex.
|
{- Checks if a given remote has the content for a key inAnnex.
|
||||||
- If the remote cannot be accessed, or if it cannot determine
|
- If the remote cannot be accessed, or if it cannot determine
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue