pass -c option on to all git commands run
The -c option now not only modifies the git configuration seen by git-annex, but it is passed along to every git command git-annex runs. This was easy to plumb through because gitCommandLine is already used to construct every git command line, to add --git-dir and --work-tree
This commit is contained in:
parent
2eeb54a107
commit
c2862d9585
5 changed files with 13 additions and 3 deletions
|
@ -21,7 +21,8 @@ import Git.FilePath
|
||||||
|
|
||||||
{- Constructs a git command line operating on the specified repo. -}
|
{- Constructs a git command line operating on the specified repo. -}
|
||||||
gitCommandLine :: [CommandParam] -> Repo -> [CommandParam]
|
gitCommandLine :: [CommandParam] -> Repo -> [CommandParam]
|
||||||
gitCommandLine params Repo { location = l@(Local _ _ ) } = setdir : settree ++ params
|
gitCommandLine params r@(Repo { location = l@(Local _ _ ) }) =
|
||||||
|
setdir : settree ++ gitGlobalOpts r ++ params
|
||||||
where
|
where
|
||||||
setdir = Param $ "--git-dir=" ++ gitpath (gitdir l)
|
setdir = Param $ "--git-dir=" ++ gitpath (gitdir l)
|
||||||
settree = case worktree l of
|
settree = case worktree l of
|
||||||
|
|
|
@ -230,6 +230,7 @@ newFrom l = return Repo
|
||||||
, remotes = []
|
, remotes = []
|
||||||
, remoteName = Nothing
|
, remoteName = Nothing
|
||||||
, gitEnv = Nothing
|
, gitEnv = Nothing
|
||||||
|
, gitGlobalOpts = []
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ module Git.Types where
|
||||||
import Network.URI
|
import Network.URI
|
||||||
import qualified Data.Map as M
|
import qualified Data.Map as M
|
||||||
import System.Posix.Types
|
import System.Posix.Types
|
||||||
|
import Utility.SafeCommand
|
||||||
|
|
||||||
{- Support repositories on local disk, and repositories accessed via an URL.
|
{- Support repositories on local disk, and repositories accessed via an URL.
|
||||||
-
|
-
|
||||||
|
@ -38,6 +39,8 @@ data Repo = Repo
|
||||||
, remoteName :: Maybe String
|
, remoteName :: Maybe String
|
||||||
-- alternate environment to use when running git commands
|
-- alternate environment to use when running git commands
|
||||||
, gitEnv :: Maybe [(String, String)]
|
, gitEnv :: Maybe [(String, String)]
|
||||||
|
-- global options to pass to git when running git commands
|
||||||
|
, gitGlobalOpts :: [CommandParam]
|
||||||
} deriving (Show, Eq)
|
} deriving (Show, Eq)
|
||||||
|
|
||||||
{- A git ref. Can be a sha1, or a branch or tag name. -}
|
{- A git ref. Can be a sha1, or a branch or tag name. -}
|
||||||
|
|
|
@ -11,6 +11,7 @@ import System.Console.GetOpt
|
||||||
|
|
||||||
import Common.Annex
|
import Common.Annex
|
||||||
import qualified Git.Config
|
import qualified Git.Config
|
||||||
|
import Git.Types
|
||||||
import Command
|
import Command
|
||||||
import Types.TrustLevel
|
import Types.TrustLevel
|
||||||
import qualified Annex
|
import qualified Annex
|
||||||
|
@ -59,12 +60,14 @@ options = Option.common ++
|
||||||
"Trust Amazon Glacier inventory"
|
"Trust Amazon Glacier inventory"
|
||||||
] ++ Option.matcher
|
] ++ Option.matcher
|
||||||
where
|
where
|
||||||
|
trustArg t = ReqArg (Remote.forceTrust t) paramRemote
|
||||||
setnumcopies v = maybe noop
|
setnumcopies v = maybe noop
|
||||||
(\n -> Annex.changeState $ \s -> s { Annex.forcenumcopies = Just n })
|
(\n -> Annex.changeState $ \s -> s { Annex.forcenumcopies = Just n })
|
||||||
(readish v)
|
(readish v)
|
||||||
setuseragent v = Annex.changeState $ \s -> s { Annex.useragent = Just v }
|
setuseragent v = Annex.changeState $ \s -> s { Annex.useragent = Just v }
|
||||||
setgitconfig v = Annex.changeGitRepo =<< inRepo (Git.Config.store v)
|
setgitconfig v = inRepo (Git.Config.store v)
|
||||||
trustArg t = ReqArg (Remote.forceTrust t) paramRemote
|
>>= pure . (\r -> r { gitGlobalOpts = gitGlobalOpts r ++ [Param "-c", Param v] })
|
||||||
|
>>= Annex.changeGitRepo
|
||||||
|
|
||||||
keyOptions :: [Option]
|
keyOptions :: [Option]
|
||||||
keyOptions =
|
keyOptions =
|
||||||
|
|
2
debian/changelog
vendored
2
debian/changelog
vendored
|
@ -12,6 +12,8 @@ git-annex (4.20131102) UNRELEASED; urgency=low
|
||||||
* Fix zombie process that occurred when switching between repository
|
* Fix zombie process that occurred when switching between repository
|
||||||
views in the webapp.
|
views in the webapp.
|
||||||
* map: Work when there are gcrypt remotes.
|
* map: Work when there are gcrypt remotes.
|
||||||
|
* The -c option now not only modifies the git configuration seen by
|
||||||
|
git-annex, but it is passed along to every git command git-annex runs.
|
||||||
|
|
||||||
-- Joey Hess <joeyh@debian.org> Sat, 02 Nov 2013 14:54:36 -0400
|
-- Joey Hess <joeyh@debian.org> Sat, 02 Nov 2013 14:54:36 -0400
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue