summaryrefslogtreecommitdiff
path: root/Git/CatFile.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-12-20 14:37:53 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-12-20 14:37:53 -0400
commitee3b5b2a4279292d55af43c772cdfd0c56420798 (patch)
tree0227fb4732ef376ac9123a9a89b924793ed841e2 /Git/CatFile.hs
parent6897460d350df41f1e98147f96fde1b66171bc19 (diff)
use Common in a few more modules
Diffstat (limited to 'Git/CatFile.hs')
-rw-r--r--Git/CatFile.hs10
1 files changed, 5 insertions, 5 deletions
diff --git a/Git/CatFile.hs b/Git/CatFile.hs
index 2cef9d5b3..16f0b11b9 100644
--- a/Git/CatFile.hs
+++ b/Git/CatFile.hs
@@ -19,10 +19,10 @@ import System.IO
import qualified Data.ByteString.Char8 as S
import qualified Data.ByteString.Lazy.Char8 as L
+import Common
import Git
import Git.Sha
import Git.Command
-import Utility.SafeCommand
type CatFileHandle = (PipeHandle, Handle, Handle)
@@ -53,21 +53,21 @@ catObject (_, from, to) object = do
[sha, objtype, size]
| length sha == shaSize &&
validobjtype objtype -> handle size
- | otherwise -> empty
+ | otherwise -> dne
_
- | header == show object ++ " missing" -> empty
+ | header == show object ++ " missing" -> dne
| otherwise -> error $ "unknown response from git cat-file " ++ header
where
handle size = case reads size of
[(bytes, "")] -> readcontent bytes
- _ -> empty
+ _ -> dne
readcontent bytes = do
content <- S.hGet from bytes
c <- hGetChar from
when (c /= '\n') $
error "missing newline from git cat-file"
return $ L.fromChunks [content]
- empty = return L.empty
+ dne = return L.empty
validobjtype t
| t == "blob" = True
| t == "commit" = True