From fdfd56c647d685ad5618917341db0b7c97e1b63a Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 8 Apr 2016 14:24:00 -0400 Subject: avoid withWorkTreeRelated affecting annex symlink calculation --- Git/Command.hs | 6 ++++-- Git/Construct.hs | 1 + Git/Types.hs | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) (limited to 'Git') diff --git a/Git/Command.hs b/Git/Command.hs index 02e3e5a34..206056368 100644 --- a/Git/Command.hs +++ b/Git/Command.hs @@ -17,9 +17,11 @@ import qualified Utility.CoProcess as CoProcess {- Constructs a git command line operating on the specified repo. -} gitCommandLine :: [CommandParam] -> Repo -> [CommandParam] gitCommandLine params r@(Repo { location = l@(Local { } ) }) = - setdir : settree ++ gitGlobalOpts r ++ params + setdir ++ settree ++ gitGlobalOpts r ++ params where - setdir = Param $ "--git-dir=" ++ gitdir l + setdir + | gitEnvOverridesGitDir r = [] + | otherwise = [Param $ "--git-dir=" ++ gitdir l] settree = case worktree l of Nothing -> [] Just t -> [Param $ "--work-tree=" ++ t] diff --git a/Git/Construct.hs b/Git/Construct.hs index 03dd29f41..765562212 100644 --- a/Git/Construct.hs +++ b/Git/Construct.hs @@ -236,6 +236,7 @@ newFrom l = Repo , remotes = [] , remoteName = Nothing , gitEnv = Nothing + , gitEnvOverridesGitDir = False , gitGlobalOpts = [] } diff --git a/Git/Types.hs b/Git/Types.hs index 44135738d..327c1d722 100644 --- a/Git/Types.hs +++ b/Git/Types.hs @@ -39,6 +39,7 @@ data Repo = Repo , remoteName :: Maybe RemoteName -- alternate environment to use when running git commands , gitEnv :: Maybe [(String, String)] + , gitEnvOverridesGitDir :: Bool -- global options to pass to git when running git commands , gitGlobalOpts :: [CommandParam] } deriving (Show, Eq, Ord) -- cgit v1.2.3