diff options
author | Joey Hess <joey@kitenet.net> | 2011-10-14 18:17:46 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-10-14 18:18:28 -0400 |
commit | 9fa92141064a7682e1559bfa91a360c1ad5cb3dc (patch) | |
tree | d009792edd0eb6143080458dd086165acb9cbff8 /Remote | |
parent | 3e07780bf881988eed491e1451b95cab86b7f552 (diff) |
A remote can have a annexUrl configured, that is used by git-annex instead of its usual url. (Similar to pushUrl.)
Diffstat (limited to 'Remote')
-rw-r--r-- | Remote/Git.hs | 13 | ||||
-rw-r--r-- | Remote/Helper/Special.hs | 2 | ||||
-rw-r--r-- | Remote/Web.hs | 2 |
3 files changed, 14 insertions, 3 deletions
diff --git a/Remote/Git.hs b/Remote/Git.hs index 183fcd854..e9919e636 100644 --- a/Remote/Git.hs +++ b/Remote/Git.hs @@ -34,7 +34,18 @@ remote = RemoteType { list :: Annex [Git.Repo] list = do g <- gitRepo - return $ Git.remotes g + let c = Git.configMap g + mapM (tweakurl c) $ Git.remotes g + where + annexurl n = "remote." ++ n ++ ".annexurl" + tweakurl c r = do + let n = fromJust $ Git.repoRemoteName r + case M.lookup (annexurl n) c of + Nothing -> return r + Just url -> do + g <- gitRepo + r' <- liftIO $ Git.genRemote g url + return $ Git.repoRemoteNameSet r' n gen :: Git.Repo -> UUID -> Maybe RemoteConfig -> Annex (Remote Annex) gen r u _ = do diff --git a/Remote/Helper/Special.hs b/Remote/Helper/Special.hs index 1fbd7b19e..5f66e8cd9 100644 --- a/Remote/Helper/Special.hs +++ b/Remote/Helper/Special.hs @@ -24,7 +24,7 @@ findSpecialRemotes s = do return $ map construct $ remotepairs g where remotepairs r = M.toList $ M.filterWithKey match $ Git.configMap r - construct (k,_) = Git.repoRemoteNameSet Git.repoFromUnknown k + construct (k,_) = Git.repoRemoteNameFromKey Git.repoFromUnknown k match k _ = startswith "remote." k && endswith (".annex-"++s) k {- Sets up configuration for a special remote in .git/config. -} diff --git a/Remote/Web.hs b/Remote/Web.hs index 30a1ff008..ed9c94909 100644 --- a/Remote/Web.hs +++ b/Remote/Web.hs @@ -33,7 +33,7 @@ remote = RemoteType { -- (If the web should cease to exist, remove this module and redistribute -- a new release to the survivors by carrier pigeon.) list :: Annex [Git.Repo] -list = return [Git.repoRemoteNameSet Git.repoFromUnknown "remote.web.dummy"] +list = return [Git.repoRemoteNameSet Git.repoFromUnknown "web"] -- Dummy uuid for the whole web. Do not alter. webUUID :: UUID |