summaryrefslogtreecommitdiff
path: root/Git
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-09-15 17:25:05 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-09-15 17:43:37 -0400
commit0b63ee6cd56f57f172695cd25b7c7ec89281ba7e (patch)
tree669a76799c46898e9dad846bb245395a234b39b6 /Git
parente1baf48d8853a5015009fe822a125192bb952222 (diff)
run git coprocesses with gitEnv
Diffstat (limited to 'Git')
-rw-r--r--Git/CatFile.hs2
-rw-r--r--Git/CheckAttr.hs2
-rw-r--r--Git/Command.hs5
-rw-r--r--Git/HashObject.hs2
4 files changed, 8 insertions, 3 deletions
diff --git a/Git/CatFile.hs b/Git/CatFile.hs
index 1481bb462..2bd50592c 100644
--- a/Git/CatFile.hs
+++ b/Git/CatFile.hs
@@ -29,7 +29,7 @@ import qualified Utility.CoProcess as CoProcess
type CatFileHandle = CoProcess.CoProcessHandle
catFileStart :: Repo -> IO CatFileHandle
-catFileStart = CoProcess.start "git" . toCommand . gitCommandLine
+catFileStart = gitCoProcessStart
[ Param "cat-file"
, Param "--batch"
]
diff --git a/Git/CheckAttr.hs b/Git/CheckAttr.hs
index 6b321f8b8..13a7287b1 100644
--- a/Git/CheckAttr.hs
+++ b/Git/CheckAttr.hs
@@ -22,7 +22,7 @@ type Attr = String
checkAttrStart :: [Attr] -> Repo -> IO CheckAttrHandle
checkAttrStart attrs repo = do
cwd <- getCurrentDirectory
- h <- CoProcess.start "git" $ toCommand $ gitCommandLine params repo
+ h <- gitCoProcessStart params repo
return (h, attrs, cwd)
where
params =
diff --git a/Git/Command.hs b/Git/Command.hs
index 04b0723d0..431569559 100644
--- a/Git/Command.hs
+++ b/Git/Command.hs
@@ -13,6 +13,7 @@ import System.Process
import Common
import Git
import Git.Types
+import qualified Utility.CoProcess as CoProcess
{- Constructs a git command line operating on the specified repo. -}
gitCommandLine :: [CommandParam] -> Repo -> [CommandParam]
@@ -80,3 +81,7 @@ reap = do
-- throws an exception when there are no child processes
catchDefaultIO (getAnyProcessStatus False True) Nothing
>>= maybe noop (const reap)
+
+{- Runs a git command as a coprocess. -}
+gitCoProcessStart :: [CommandParam] -> Repo -> IO CoProcess.CoProcessHandle
+gitCoProcessStart params repo = CoProcess.start "git" (toCommand $ gitCommandLine params repo) (gitEnv repo)
diff --git a/Git/HashObject.hs b/Git/HashObject.hs
index c90c9ec3d..7d6b5cc19 100644
--- a/Git/HashObject.hs
+++ b/Git/HashObject.hs
@@ -17,7 +17,7 @@ import qualified Utility.CoProcess as CoProcess
type HashObjectHandle = CoProcess.CoProcessHandle
hashObjectStart :: Repo -> IO HashObjectHandle
-hashObjectStart = CoProcess.start "git" . toCommand . gitCommandLine
+hashObjectStart = gitCoProcessStart
[ Param "hash-object"
, Param "-w"
, Param "--stdin-paths"