diff options
author | Joey Hess <joey@kitenet.net> | 2013-09-08 15:19:14 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-09-08 15:19:14 -0400 |
commit | 8bb2e27dca0a81da54e0ae2a44a8844d5861e8e0 (patch) | |
tree | 4b55618b3a4ac2756f39f16d0cc3ca3021f3633a | |
parent | eaffb01ca5db31f8e1f8f04c4fa90d64e0b7bc6a (diff) |
ignore gcrypt remotes w/o an annex-uuid
-rw-r--r-- | Config.hs | 3 | ||||
-rw-r--r-- | Remote/GCrypt.hs | 5 | ||||
-rw-r--r-- | Remote/Git.hs | 17 |
3 files changed, 17 insertions, 8 deletions
@@ -25,6 +25,9 @@ instance Show ConfigKey where getConfig :: ConfigKey -> String -> Annex String 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 -} setConfig :: ConfigKey -> String -> Annex () setConfig (ConfigKey key) value = do diff --git a/Remote/GCrypt.hs b/Remote/GCrypt.hs index 2ff137f57..3c0706989 100644 --- a/Remote/GCrypt.hs +++ b/Remote/GCrypt.hs @@ -25,6 +25,7 @@ import Config import Config.Cost import Remote.Helper.Git import Remote.Helper.Encryptable +import Remote.Helper.Special import Utility.Metered import Crypto import Annex.UUID @@ -145,7 +146,9 @@ gCryptSetup mu c = go $ M.lookup "gitrepo" c Just v -> do let u = genUUIDInNameSpace gCryptNameSpace v if Just u == mu || mu == Nothing - then return (c', u) + then do + gitConfigSpecialRemote u c' "gcrypt" "true" + return (c', u) else error "uuid mismatch" store :: Remote -> Remote.Rsync.RsyncOpts -> (Cipher, Key) -> Key -> MeterUpdate -> Annex Bool diff --git a/Remote/Git.hs b/Remote/Git.hs index 93c923853..149146616 100644 --- a/Remote/Git.hs +++ b/Remote/Git.hs @@ -144,13 +144,7 @@ tryGitConfigRead r | Git.repoIsHttp r = do headers <- getHttpHeaders store $ geturlconfig headers - | Git.GCrypt.isEncrypted r = do - -- 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.GCrypt.isEncrypted r = handlegcrypt =<< getConfigMaybe (remoteConfig r "uuid") | Git.repoIsUrl r = return r | otherwise = store $ safely $ onLocal r $ do ensureInitialized @@ -218,6 +212,15 @@ tryGitConfigRead r let k = "remote." ++ n ++ ".annex-ignore" warning $ "Remote " ++ n ++ " " ++ msg ++ "; setting " ++ k 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. - If the remote cannot be accessed, or if it cannot determine |