This commit is contained in:
Joey Hess 2011-11-19 15:57:08 -04:00
parent 0fa1d136dc
commit 128b4bd015
2 changed files with 5 additions and 7 deletions

View file

@ -59,7 +59,7 @@ getRepoUUID r = do
updatecache u = do updatecache u = do
g <- gitRepo g <- gitRepo
when (g /= r) $ storeUUID cachekey u when (g /= r) $ storeUUID cachekey u
cachekey = "remote." ++ fromMaybe "" (Git.repoRemoteName r) ++ ".annex-uuid" cachekey = remoteConfig r "uuid"
getUncachedUUID :: Git.Repo -> UUID getUncachedUUID :: Git.Repo -> UUID
getUncachedUUID = toUUID . Git.configGet configkey "" getUncachedUUID = toUUID . Git.configGet configkey ""

View file

@ -28,13 +28,13 @@ getConfig r key def = do
def' <- fromRepo $ Git.configGet ("annex." ++ key) def def' <- fromRepo $ Git.configGet ("annex." ++ key) def
fromRepo $ Git.configGet (remoteConfig r key) def' fromRepo $ Git.configGet (remoteConfig r key) def'
{- Looks up a per-remote config setting in git config. -}
remoteConfig :: Git.Repo -> ConfigKey -> String remoteConfig :: Git.Repo -> ConfigKey -> String
remoteConfig r key = "remote." ++ fromMaybe "" (Git.repoRemoteName r) ++ ".annex-" ++ key remoteConfig r key = "remote." ++ fromMaybe "" (Git.repoRemoteName r) ++ ".annex-" ++ key
{- Calculates cost for a remote. Either the default, or as configured {- Calculates cost for a remote. Either the default, or as configured
- by remote.<name>.annex-cost, or if remote.<name>.annex-cost-command - by remote.<name>.annex-cost, or if remote.<name>.annex-cost-command
- is set and prints a number, that is used. - is set and prints a number, that is used. -}
-}
remoteCost :: Git.Repo -> Int -> Annex Int remoteCost :: Git.Repo -> Int -> Annex Int
remoteCost r def = do remoteCost r def = do
cmd <- getConfig r "cost-command" "" cmd <- getConfig r "cost-command" ""
@ -55,7 +55,7 @@ semiCheapRemoteCost = 110
expensiveRemoteCost :: Int expensiveRemoteCost :: Int
expensiveRemoteCost = 200 expensiveRemoteCost = 200
{- Adjust's a remote's cost to reflect it being encrypted. -} {- Adjusts a remote's cost to reflect it being encrypted. -}
encryptedRemoteCostAdj :: Int encryptedRemoteCostAdj :: Int
encryptedRemoteCostAdj = 50 encryptedRemoteCostAdj = 50
@ -74,9 +74,7 @@ prop_cost_sane = False `notElem`
- setting, or on command-line options. Allows command-line to override - setting, or on command-line options. Allows command-line to override
- annex-ignore. -} - annex-ignore. -}
repoNotIgnored :: Git.Repo -> Annex Bool repoNotIgnored :: Git.Repo -> Annex Bool
repoNotIgnored r = do repoNotIgnored r = not . Git.configTrue <$> getConfig r "ignore" "false"
ignored <- getConfig r "ignore" "false"
return $ not $ Git.configTrue ignored
{- If a value is specified, it is used; otherwise the default is looked up {- If a value is specified, it is used; otherwise the default is looked up
- in git config. forcenumcopies overrides everything. -} - in git config. forcenumcopies overrides everything. -}