summaryrefslogtreecommitdiff
path: root/Git/HashObject.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-02-21 00:16:24 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-02-21 00:16:24 -0400
commitcac130b205fca9fc45833296dc326b3fd6385163 (patch)
treebd27ca58e17fa0fd2daa79011257b2d5b22bf717 /Git/HashObject.hs
parent7e17151e69fcd86fd5cb90dd61ff55d2d017fee7 (diff)
cleanup
Diffstat (limited to 'Git/HashObject.hs')
-rw-r--r--Git/HashObject.hs21
1 files changed, 8 insertions, 13 deletions
diff --git a/Git/HashObject.hs b/Git/HashObject.hs
index 5848d0144..617e5ac28 100644
--- a/Git/HashObject.hs
+++ b/Git/HashObject.hs
@@ -14,20 +14,13 @@ import qualified Utility.CoProcess as CoProcess
type HashObjectHandle = CoProcess.CoProcessHandle
-{- Starts git hash-object and returns a handle. -}
hashObjectStart :: Repo -> IO HashObjectHandle
-hashObjectStart repo = do
- h <- CoProcess.start "git" $ toCommand $ gitCommandLine params repo
- CoProcess.query h fileEncoding (const $ return ())
- return h
- where
- params =
- [ Param "hash-object"
- , Param "-w"
- , Param "--stdin-paths"
- ]
+hashObjectStart = CoProcess.start "git" . toCommand . gitCommandLine
+ [ Param "hash-object"
+ , Param "-w"
+ , Param "--stdin-paths"
+ ]
-{- Stops git hash-object. -}
hashObjectStop :: HashObjectHandle -> IO ()
hashObjectStop = CoProcess.stop
@@ -35,5 +28,7 @@ hashObjectStop = CoProcess.stop
hashFile :: HashObjectHandle -> FilePath -> IO Sha
hashFile h file = CoProcess.query h send receive
where
- send to = hPutStrLn to file
+ send to = do
+ fileEncoding to
+ hPutStrLn to file
receive from = Ref <$> hGetLine from