summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2010-11-01 00:17:26 -0400
committerGravatar Joey Hess <joey@kitenet.net>2010-11-01 00:17:26 -0400
commite638f9647d10ca0cc63799698456a387ca9b8382 (patch)
tree06a9477d22ddc1726a1ca408832269c2c3be70c6
parent99c522edeff6add3ece41922f862c59b5afdddbe (diff)
add global fallback for per-repo options
-rw-r--r--Remotes.hs19
-rw-r--r--doc/git-annex.mdwn5
2 files changed, 15 insertions, 9 deletions
diff --git a/Remotes.hs b/Remotes.hs
index bb77b00b3..7bb1bcd22 100644
--- a/Remotes.hs
+++ b/Remotes.hs
@@ -125,7 +125,7 @@ reposByCost l = do
-}
repoCost :: Git.Repo -> Annex Int
repoCost r = do
- cost <- repoConfig r "annex-cost" ""
+ cost <- repoConfig r "cost" ""
if (not $ null cost)
then return $ read cost
else if (Git.repoIsUrl r)
@@ -137,7 +137,7 @@ repoCost r = do
- annex-ignore. -}
repoNotIgnored :: Git.Repo -> Annex Bool
repoNotIgnored r = do
- ignored <- repoConfig r "annex-ignore" "false"
+ ignored <- repoConfig r "ignore" "false"
fromName <- Annex.flagGet "fromrepository"
toName <- Annex.flagGet "torepository"
let name = if (not $ null fromName) then fromName else toName
@@ -172,7 +172,7 @@ commandLineRemote = do
- returns the updated git repo. -}
tryGitConfigRead :: Git.Repo -> Annex (Either Git.Repo Git.Repo)
tryGitConfigRead r = do
- sshoptions <- repoConfig r "annex-ssh-options" ""
+ sshoptions <- repoConfig r "ssh-options" ""
if (Map.null $ Git.configMap r)
then do
-- configRead can fail due to IO error or
@@ -228,7 +228,7 @@ sshLocation r file = (Git.urlHost r) ++ ":" ++ shellEscape file
{- Runs scp against a specified remote. (Honors annex-scp-options.) -}
scp :: Git.Repo -> [String] -> Annex Bool
scp r params = do
- scpoptions <- repoConfig r "annex-scp-options" ""
+ scpoptions <- repoConfig r "scp-options" ""
Core.showProgress -- make way for scp progress bar
liftIO $ boolSystem "scp" $ "-p":(words scpoptions) ++ params
@@ -236,7 +236,7 @@ scp r params = do
- (Honors annex-ssh-options.) -}
runCmd :: Git.Repo -> String -> [String] -> Annex Bool
runCmd r command params = do
- sshoptions <- repoConfig r "annex-ssh-options" ""
+ sshoptions <- repoConfig r "ssh-options" ""
if (not $ Git.repoIsUrl r)
then do
cwd <- liftIO $ getCurrentDirectory
@@ -253,10 +253,13 @@ runCmd r command params = do
(unwords $ map shellEscape params)]
else error "running command in non-ssh repo not supported"
-{- Looks up a per-remote config option in git config. -}
+{- Looks up a per-remote config option in git config.
+ - Failing that, tries looking for a global config option. -}
repoConfig :: Git.Repo -> String -> String -> Annex String
repoConfig r key def = do
g <- Annex.gitRepo
- return $ Git.configGet g fullkey def
+ let def' = Git.configGet g global def
+ return $ Git.configGet g local def'
where
- fullkey = "remote." ++ (Git.repoRemoteName r) ++ "." ++ key
+ local = "remote." ++ (Git.repoRemoteName r) ++ ".annex-" ++ key
+ global = "annex." ++ key
diff --git a/doc/git-annex.mdwn b/doc/git-annex.mdwn
index d176a04c0..fa584d360 100644
--- a/doc/git-annex.mdwn
+++ b/doc/git-annex.mdwn
@@ -178,7 +178,8 @@ Many git-annex subcommands will stage changes for later `git commit` by you.
# CONFIGURATION
-Like other git commands, git-annex is configured via `.git/config`.
+Like other git commands, git-annex is configured via `git-config`.
+Here are all the supported configuration settings.
* `annex.uuid` -- a unique UUID for this repository (automatically set)
* `annex.numcopies` -- number of copies of files to keep across all
@@ -201,6 +202,8 @@ Like other git commands, git-annex is configured via `.git/config`.
the bandwidth to 100Kbit/s, set it to "-6 -l 100"
* `remote.<name>.annex-ssh-options` -- Options to use when using ssh
to talk to this repository.
+* `annex.scp-options` and `annex.ssh-options` -- Default scp and ssh
+ options to use if a remote does not have specific options.
# FILES