diff options
author | Joey Hess <joey@kitenet.net> | 2012-03-21 23:41:01 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-03-22 17:32:47 -0400 |
commit | 4eb51126819fe01a003688267f481c6d8014ef47 (patch) | |
tree | 40f88312d53da654b65a7ed25617e5bdbd6be03c /Remote | |
parent | 52b90e5d4c2a22415d48a8e572eab328dfcc4407 (diff) |
rationalize getConfig
getConfig got a remote-specific config, and this confusing name caused it
to be used a couple of places that only were interested in global configs.
Rename to getRemoteConfig and make getConfig only get global configs.
There are no behavior changes here, but remote.<name>.annex-web-options
never actually worked (and per-remote web options is a very unlikely to be
useful case so I didn't make it work), so fix the documentation for it.
Diffstat (limited to 'Remote')
-rw-r--r-- | Remote/Bup.hs | 4 | ||||
-rw-r--r-- | Remote/Directory.hs | 2 | ||||
-rw-r--r-- | Remote/Git.hs | 2 | ||||
-rw-r--r-- | Remote/Helper/Hooks.hs | 2 | ||||
-rw-r--r-- | Remote/Helper/Ssh.hs | 2 | ||||
-rw-r--r-- | Remote/Hook.hs | 7 | ||||
-rw-r--r-- | Remote/Rsync.hs | 4 |
7 files changed, 11 insertions, 12 deletions
diff --git a/Remote/Bup.hs b/Remote/Bup.hs index 4ac91e945..54aff7505 100644 --- a/Remote/Bup.hs +++ b/Remote/Bup.hs @@ -35,7 +35,7 @@ remote = RemoteType { gen :: Git.Repo -> UUID -> Maybe RemoteConfig -> Annex Remote gen r u c = do - buprepo <- getConfig r "buprepo" (error "missing buprepo") + buprepo <- getRemoteConfig r "buprepo" (error "missing buprepo") cst <- remoteCost r (if bupLocal buprepo then semiCheapRemoteCost else expensiveRemoteCost) bupr <- liftIO $ bup2GitRemote buprepo (u', bupr') <- getBupUUID bupr u @@ -99,7 +99,7 @@ pipeBup params inh outh = do bupSplitParams :: Git.Repo -> BupRepo -> Key -> CommandParam -> Annex [CommandParam] bupSplitParams r buprepo k src = do - o <- getConfig r "bup-split-options" "" + o <- getRemoteConfig r "bup-split-options" "" let os = map Param $ words o showOutput -- make way for bup output return $ bupParams "split" buprepo diff --git a/Remote/Directory.hs b/Remote/Directory.hs index ecbf511d6..3627d9a9a 100644 --- a/Remote/Directory.hs +++ b/Remote/Directory.hs @@ -33,7 +33,7 @@ remote = RemoteType { gen :: Git.Repo -> UUID -> Maybe RemoteConfig -> Annex Remote gen r u c = do - dir <- getConfig r "directory" (error "missing directory") + dir <- getRemoteConfig r "directory" (error "missing directory") cst <- remoteCost r cheapRemoteCost let chunksize = chunkSize c return $ encryptableRemote c diff --git a/Remote/Git.hs b/Remote/Git.hs index 3725edd3a..541b05099 100644 --- a/Remote/Git.hs +++ b/Remote/Git.hs @@ -300,7 +300,7 @@ rsyncParamsRemote r sending key file = do rsyncParams :: Git.Repo -> Annex [CommandParam] rsyncParams r = do - o <- getConfig r "rsync-options" "" + o <- getRemoteConfig r "rsync-options" "" return $ options ++ map Param (words o) where -- --inplace to resume partial files diff --git a/Remote/Helper/Hooks.hs b/Remote/Helper/Hooks.hs index ed329b914..2864a8ed5 100644 --- a/Remote/Helper/Hooks.hs +++ b/Remote/Helper/Hooks.hs @@ -84,7 +84,7 @@ runHooks r starthook stophook a = do liftIO $ closeFd fd lookupHook :: Remote -> String -> Annex (Maybe String) -lookupHook r n = go =<< getConfig (repo r) hookname "" +lookupHook r n = go =<< getRemoteConfig (repo r) hookname "" where go "" = return Nothing go command = return $ Just command diff --git a/Remote/Helper/Ssh.hs b/Remote/Helper/Ssh.hs index c61d1b96f..4c5eef0e6 100644 --- a/Remote/Helper/Ssh.hs +++ b/Remote/Helper/Ssh.hs @@ -19,7 +19,7 @@ import Annex.Ssh - passed command. -} sshToRepo :: Git.Repo -> [CommandParam] -> Annex [CommandParam] sshToRepo repo sshcmd = do - opts <- map Param . words <$> getConfig repo "ssh-options" "" + opts <- map Param . words <$> getRemoteConfig repo "ssh-options" "" params <- sshParams (Git.Url.hostuser repo, Git.Url.port repo) opts return $ params ++ sshcmd diff --git a/Remote/Hook.hs b/Remote/Hook.hs index 1e5c27b91..1c87823ca 100644 --- a/Remote/Hook.hs +++ b/Remote/Hook.hs @@ -30,7 +30,7 @@ remote = RemoteType { gen :: Git.Repo -> UUID -> Maybe RemoteConfig -> Annex Remote gen r u c = do - hooktype <- getConfig r "hooktype" (error "missing hooktype") + hooktype <- getRemoteConfig r "hooktype" (error "missing hooktype") cst <- remoteCost r expensiveRemoteCost return $ encryptableRemote c (storeEncrypted hooktype) @@ -74,15 +74,14 @@ hookEnv k f = Just $ fileenv f ++ keyenv lookupHook :: String -> String -> Annex (Maybe String) lookupHook hooktype hook =do - g <- gitRepo - command <- getConfig g hookname "" + command <- getConfig hookname "" if null command then do warning $ "missing configuration for " ++ hookname return Nothing else return $ Just command where - hookname = hooktype ++ "-" ++ hook ++ "-hook" + hookname = "annex." ++ hooktype ++ "-" ++ hook ++ "-hook" runHook :: String -> String -> Key -> Maybe FilePath -> Annex Bool -> Annex Bool runHook hooktype hook k f a = maybe (return False) run =<< lookupHook hooktype hook diff --git a/Remote/Rsync.hs b/Remote/Rsync.hs index 03c9911d7..571cd8f5e 100644 --- a/Remote/Rsync.hs +++ b/Remote/Rsync.hs @@ -60,8 +60,8 @@ gen r u c = do genRsyncOpts :: Git.Repo -> Annex RsyncOpts genRsyncOpts r = do - url <- getConfig r "rsyncurl" (error "missing rsyncurl") - opts <- getConfig r "rsync-options" "" + url <- getRemoteConfig r "rsyncurl" (error "missing rsyncurl") + opts <- getRemoteConfig r "rsync-options" "" return $ RsyncOpts url $ map Param $ filter safe $ words opts where safe o |