aboutsummaryrefslogtreecommitdiff
path: root/Remote/External.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-05-06 12:26:37 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-05-06 12:26:44 -0400
commit2de35be7538023dd70e4c4b3ef984d1ae8a4c5a7 (patch)
treeae2da77522f5f5e6b31135bb1ddb55f12694456b /Remote/External.hs
parent7b33a5f2ab57f8546577bdc0532f925a3917fe78 (diff)
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
Diffstat (limited to 'Remote/External.hs')
-rw-r--r--Remote/External.hs8
1 files changed, 7 insertions, 1 deletions
diff --git a/Remote/External.hs b/Remote/External.hs
index 69c47a6e4..54db82d1f 100644
--- a/Remote/External.hs
+++ b/Remote/External.hs
@@ -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.")