summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-07-02 19:16:28 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-07-02 19:16:28 -0400
commitf626512b07f3675f184101c4c945861381862339 (patch)
tree7f6a387e3506ca2bdefa080660fafa4e91007fda
parentbd5884d8dd873d6bc7a5e938afb2d835b7bd968f (diff)
further improved git cat-file error handling
-rw-r--r--Branch.hs7
1 files changed, 4 insertions, 3 deletions
diff --git a/Branch.hs b/Branch.hs
index 59f2d3134..d9cbe61a7 100644
--- a/Branch.hs
+++ b/Branch.hs
@@ -241,8 +241,7 @@ catFile file = do
[Param "cat-file", Param "--batch"]
let gitcmd = join " " ("git" : toCommand cmd)
(_, from, to) <- liftIO $ hPipeBoth "sh"
- -- want stderr on stdin to see error messages
- ["-c", "exec " ++ gitcmd ++ " 2>&1"]
+ ["-c", "exec " ++ gitcmd ++ " 2>/dev/null"]
setState state { catFileHandles = Just (from, to) }
ask (from, to)
ask (from, to) = liftIO $ do
@@ -255,7 +254,9 @@ catFile file = do
| length sha == Git.shaSize &&
blob == "blob" -> handle from size
| otherwise -> empty
- _ -> empty
+ _
+ | header == want ++ " missing" -> empty
+ | otherwise -> error $ "unknown response from git cat-file " ++ header
handle from size = case reads size of
[(bytes, "")] -> readcontent from bytes
_ -> empty