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 | |
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.
-rw-r--r-- | GitAnnex.hs | 11 | ||||
-rw-r--r-- | debian/changelog | 1 | ||||
-rw-r--r-- | doc/git-annex.mdwn | 4 |
3 files changed, 15 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 ..]" diff --git a/debian/changelog b/debian/changelog index ec3176d12..673084d2d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,7 @@ git-annex (3.20110708) UNRELEASED; urgency=low * add: Be even more robust to avoid ever leaving the file seemingly deleted. * Bugfix: Make add ../ work. + * Support the standard git -c name=value -- Joey Hess <joeyh@debian.org> Thu, 07 Jul 2011 21:28:49 -0400 diff --git a/doc/git-annex.mdwn b/doc/git-annex.mdwn index dfb23f5f2..11f617f1b 100644 --- a/doc/git-annex.mdwn +++ b/doc/git-annex.mdwn @@ -387,6 +387,10 @@ Many git-annex commands will stage changes for later `git commit` by you. Specifies a key to operate on. +* -c name=value + + Used to override git configuration settings. May be specified multiple times. + # CONFIGURATION Like other git commands, git-annex is configured via `.git/config`. |