Propigate GIT_DIR and GIT_WORK_TREE environment to external special remotes.
Since git-annex unsets these when started, they have to be explicitly propigated. Also, this makes --git-dir and --work-tree settings be reflected in the environment. The need for this came up in https://github.com/DanielDent/git-annex-remote-rclone/issues/3
This commit is contained in:
parent
36137c444b
commit
6659c7ec0e
4 changed files with 25 additions and 4 deletions
|
@ -16,6 +16,7 @@ import Types.UrlContents
|
|||
import qualified Git
|
||||
import Config
|
||||
import Git.Config (isTrue, boolConfig)
|
||||
import Git.Env
|
||||
import Remote.Helper.Special
|
||||
import Remote.Helper.ReadOnly
|
||||
import Remote.Helper.Messages
|
||||
|
@ -369,7 +370,9 @@ fromExternal lck external extractor a =
|
|||
startExternal :: ExternalType -> Annex ExternalState
|
||||
startExternal externaltype = do
|
||||
errrelayer <- mkStderrRelayer
|
||||
g <- Annex.gitRepo
|
||||
liftIO $ do
|
||||
p <- propgit g cmdp
|
||||
(Just hin, Just hout, Just herr, pid) <-
|
||||
createProcess p `catchIO` runerr
|
||||
fileEncoding hin
|
||||
|
@ -387,11 +390,14 @@ startExternal externaltype = do
|
|||
}
|
||||
where
|
||||
cmd = externalRemoteProgram externaltype
|
||||
p = (proc cmd [])
|
||||
cmdp = (proc cmd [])
|
||||
{ std_in = CreatePipe
|
||||
, std_out = CreatePipe
|
||||
, std_err = CreatePipe
|
||||
}
|
||||
propgit g p = do
|
||||
environ <- propGitEnv g
|
||||
return $ p { env = Just environ }
|
||||
|
||||
runerr _ = error ("Cannot run " ++ cmd ++ " -- Make sure it's in your PATH and is executable.")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue