summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-11-19 15:57:08 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-11-19 15:57:08 -0400
commit128b4bd01509bcdcdd6120a29d24527cff82d3ab (patch)
treeca961bb70d2bc5ebf67a71c9486c54dde3e75b33
parent0fa1d136dc74828eab820d7c74c811d707cc746a (diff)
tweaks
-rw-r--r--Annex/UUID.hs2
-rw-r--r--Config.hs10
2 files changed, 5 insertions, 7 deletions
diff --git a/Annex/UUID.hs b/Annex/UUID.hs
index 3b64bf3d8..e510a7ccd 100644
--- a/Annex/UUID.hs
+++ b/Annex/UUID.hs
@@ -59,7 +59,7 @@ getRepoUUID r = do
updatecache u = do
g <- gitRepo
when (g /= r) $ storeUUID cachekey u
- cachekey = "remote." ++ fromMaybe "" (Git.repoRemoteName r) ++ ".annex-uuid"
+ cachekey = remoteConfig r "uuid"
getUncachedUUID :: Git.Repo -> UUID
getUncachedUUID = toUUID . Git.configGet configkey ""
diff --git a/Config.hs b/Config.hs
index dbd13ad3f..cc0c92953 100644
--- a/Config.hs
+++ b/Config.hs
@@ -28,13 +28,13 @@ getConfig r key def = do
def' <- fromRepo $ Git.configGet ("annex." ++ 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 r key = "remote." ++ fromMaybe "" (Git.repoRemoteName r) ++ ".annex-" ++ key
{- Calculates cost for a remote. Either the default, or as configured
- 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 r def = do
cmd <- getConfig r "cost-command" ""
@@ -55,7 +55,7 @@ semiCheapRemoteCost = 110
expensiveRemoteCost :: Int
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 = 50
@@ -74,9 +74,7 @@ prop_cost_sane = False `notElem`
- setting, or on command-line options. Allows command-line to override
- annex-ignore. -}
repoNotIgnored :: Git.Repo -> Annex Bool
-repoNotIgnored r = do
- ignored <- getConfig r "ignore" "false"
- return $ not $ Git.configTrue ignored
+repoNotIgnored r = not . Git.configTrue <$> getConfig r "ignore" "false"
{- If a value is specified, it is used; otherwise the default is looked up
- in git config. forcenumcopies overrides everything. -}