diff options
author | Joey Hess <joey@kitenet.net> | 2011-07-14 16:44:23 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-07-14 16:51:20 -0400 |
commit | 0c46cbab09af8cc8761668885e58944d397b856d (patch) | |
tree | bf39b70a8f2936c23e9248c403a5398deaa5d3b9 /GitAnnex.hs | |
parent | dddbc09ff0199967602ad5d4112b2b4e04780177 (diff) |
Support the standard git -c name=value
This allows eg, `git-annex -c annex.rsync-options=-6 get file`
The overridden git configs are not passed on to git plumbing commands
that are run. Perhaps someone will find a need to do that, but I don't yet
and it would require storing more state to know what config settings
have been overridden and need to be passed on.
Diffstat (limited to 'GitAnnex.hs')
-rw-r--r-- | GitAnnex.hs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/GitAnnex.hs b/GitAnnex.hs index 85eb2bf26..6f4e5d492 100644 --- a/GitAnnex.hs +++ b/GitAnnex.hs @@ -8,12 +8,14 @@ module GitAnnex where import System.Console.GetOpt +import Control.Monad.State (liftIO) import qualified Git import CmdLine import Command import Options import Utility +import Types import Types.TrustLevel import qualified Annex import qualified Remote @@ -102,9 +104,11 @@ options = commonOptions ++ , Option [] ["trust"] (ReqArg (Remote.forceTrust Trusted) paramRemote) "override trust setting" , Option [] ["semitrust"] (ReqArg (Remote.forceTrust SemiTrusted) paramRemote) - "override trust setting back to default value" + "override trust setting back to default" , Option [] ["untrust"] (ReqArg (Remote.forceTrust UnTrusted) paramRemote) "override trust setting to untrusted" + , Option ['c'] ["config"] (ReqArg setgitconfig "NAME=VALUE") + "override git configuration setting" ] where setto v = Annex.changeState $ \s -> s { Annex.toremote = Just v } @@ -112,6 +116,11 @@ options = commonOptions ++ addexclude v = Annex.changeState $ \s -> s { Annex.exclude = v:Annex.exclude s } setnumcopies v = Annex.changeState $ \s -> s {Annex.forcenumcopies = readMaybe v } setkey v = Annex.changeState $ \s -> s { Annex.defaultkey = Just v } + setgitconfig :: String -> Annex () + setgitconfig v = do + g <- Annex.gitRepo + g' <- liftIO $ Git.configStore g v + Annex.changeState $ \s -> s { Annex.repo = g' } header :: String header = "Usage: git-annex command [option ..]" |