diff options
author | Joey Hess <joey@kitenet.net> | 2012-02-26 14:11:50 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-02-26 14:11:50 -0400 |
commit | 00d814aecc7368bbc0fe1722b27340255772d2f2 (patch) | |
tree | 52b05ab2a32b85ae4ad39760048ed01bfd99d3e6 /Git | |
parent | b889581945f0444127b2e0aac29d0e101dcafca6 (diff) |
fix filename encoding for git cat-file
The filename sent to git cat-file needs to be sent on a File encoded handle.
Also set the read handle to use the File encoding, so that any error
message mentioning the filename is received properly.
The actual file content is read using Data.ByteString.Char8, which
will ignore the read handle's encoding, so this won't change that.
(Whether that is entirely correct remains to be seen.)
Diffstat (limited to 'Git')
-rw-r--r-- | Git/CatFile.hs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Git/CatFile.hs b/Git/CatFile.hs index 41ecb362c..c598d7aa4 100644 --- a/Git/CatFile.hs +++ b/Git/CatFile.hs @@ -43,8 +43,11 @@ catFile h branch file = catObject h $ Ref $ show branch ++ ":" ++ file catObject :: CatFileHandle -> Ref -> IO L.ByteString catObject h object = CoProcess.query h send receive where - send to = hPutStrLn to $ show object + send to = do + fileEncoding to + hPutStrLn to $ show object receive from = do + fileEncoding from header <- hGetLine from case words header of [sha, objtype, size] @@ -56,7 +59,7 @@ catObject h object = CoProcess.query h send receive | otherwise -> dne _ | header == show object ++ " missing" -> dne - | otherwise -> error $ "unknown response from git cat-file " ++ header + | otherwise -> error $ "unknown response from git cat-file " ++ show (header, object) readcontent bytes from = do content <- S.hGet from bytes c <- hGetChar from |