summaryrefslogtreecommitdiff
path: root/Config.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Config.hs')
-rw-r--r--Config.hs13
1 files changed, 13 insertions, 0 deletions
diff --git a/Config.hs b/Config.hs
index 1016845e7..9cbf2d52f 100644
--- a/Config.hs
+++ b/Config.hs
@@ -86,3 +86,16 @@ remoteNotIgnored r = do
match a = do
n <- Annex.getState a
return $ n == Git.repoRemoteName r
+
+{- If a value is specified, it is used; otherwise the default is looked up
+ - in git config. forcenumcopies overrides everything. -}
+getNumCopies :: Maybe Int -> Annex Int
+getNumCopies v =
+ Annex.getState Annex.forcenumcopies >>= maybe (use v) (return . id)
+ where
+ use (Just n) = return n
+ use Nothing = do
+ g <- Annex.gitRepo
+ return $ read $ Git.configGet g config "1"
+ config = "annex.numcopies"
+