avoid withWorkTreeRelated affecting annex symlink calculation
This commit is contained in:
parent
f41045bf19
commit
251405eca2
5 changed files with 13 additions and 9 deletions
|
@ -45,11 +45,13 @@ withWorkTreeRelated :: FilePath -> Annex a -> Annex a
|
||||||
withWorkTreeRelated d = withAltRepo modrepo unmodrepo
|
withWorkTreeRelated d = withAltRepo modrepo unmodrepo
|
||||||
where
|
where
|
||||||
modrepo g = do
|
modrepo g = do
|
||||||
let g' = g { location = modlocation (location g) }
|
g' <- addGitEnv g "GIT_COMMON_DIR" =<< absPath (localGitDir g)
|
||||||
addGitEnv g' "GIT_COMMON_DIR" =<< absPath (localGitDir g)
|
g'' <- addGitEnv g' "GIT_DIR" d
|
||||||
unmodrepo g g' = g' { gitEnv = gitEnv g, location = location g }
|
return (g'' { gitEnvOverridesGitDir = True })
|
||||||
modlocation l@(Local {}) = l { gitdir = d }
|
unmodrepo g g' = g'
|
||||||
modlocation _ = error "withWorkTreeRelated of non-local git repo"
|
{ gitEnv = gitEnv g
|
||||||
|
, gitEnvOverridesGitDir = gitEnvOverridesGitDir g
|
||||||
|
}
|
||||||
|
|
||||||
withAltRepo
|
withAltRepo
|
||||||
:: (Repo -> IO Repo)
|
:: (Repo -> IO Repo)
|
||||||
|
|
|
@ -17,9 +17,11 @@ import qualified Utility.CoProcess as CoProcess
|
||||||
{- 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 r@(Repo { location = l@(Local { } ) }) =
|
gitCommandLine params r@(Repo { location = l@(Local { } ) }) =
|
||||||
setdir : settree ++ gitGlobalOpts r ++ params
|
setdir ++ settree ++ gitGlobalOpts r ++ params
|
||||||
where
|
where
|
||||||
setdir = Param $ "--git-dir=" ++ gitdir l
|
setdir
|
||||||
|
| gitEnvOverridesGitDir r = []
|
||||||
|
| otherwise = [Param $ "--git-dir=" ++ gitdir l]
|
||||||
settree = case worktree l of
|
settree = case worktree l of
|
||||||
Nothing -> []
|
Nothing -> []
|
||||||
Just t -> [Param $ "--work-tree=" ++ t]
|
Just t -> [Param $ "--work-tree=" ++ t]
|
||||||
|
|
|
@ -236,6 +236,7 @@ newFrom l = Repo
|
||||||
, remotes = []
|
, remotes = []
|
||||||
, remoteName = Nothing
|
, remoteName = Nothing
|
||||||
, gitEnv = Nothing
|
, gitEnv = Nothing
|
||||||
|
, gitEnvOverridesGitDir = False
|
||||||
, gitGlobalOpts = []
|
, gitGlobalOpts = []
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,7 @@ data Repo = Repo
|
||||||
, remoteName :: Maybe RemoteName
|
, remoteName :: Maybe RemoteName
|
||||||
-- alternate environment to use when running git commands
|
-- alternate environment to use when running git commands
|
||||||
, gitEnv :: Maybe [(String, String)]
|
, gitEnv :: Maybe [(String, String)]
|
||||||
|
, gitEnvOverridesGitDir :: Bool
|
||||||
-- global options to pass to git when running git commands
|
-- global options to pass to git when running git commands
|
||||||
, gitGlobalOpts :: [CommandParam]
|
, gitGlobalOpts :: [CommandParam]
|
||||||
} deriving (Show, Eq, Ord)
|
} deriving (Show, Eq, Ord)
|
||||||
|
|
|
@ -286,5 +286,3 @@ into adjusted view worktrees.]
|
||||||
have already been handled by updateAdjustedBranch. But, if another remote
|
have already been handled by updateAdjustedBranch. But, if another remote
|
||||||
pushed a new master at just the right time, the adjusted branch could be
|
pushed a new master at just the right time, the adjusted branch could be
|
||||||
rebased on top of a master that it doesn't incorporate, which is wrong.
|
rebased on top of a master that it doesn't incorporate, which is wrong.
|
||||||
* Annex symlinks generated in merging into an adjusted branch are badly
|
|
||||||
formed to point to the temp git dir's annex object dir.
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue