Fix reversion in 6.20161012 that prevented adding files with a space in their name.

This commit is contained in:
Joey Hess 2016-10-31 18:35:38 -04:00
parent a986b12cf2
commit b530e43285
No known key found for this signature in database
GPG key ID: C910D9222512E3C7
3 changed files with 17 additions and 11 deletions

View file

@ -109,17 +109,18 @@ query hdl object receive = CoProcess.query hdl send receive
send to = hPutStrLn to (fromRef object)
parseResp :: Ref -> String -> Maybe ParsedResp
parseResp object l = case words l of
[sha, objtype, size]
| length sha == shaSize ->
case (readObjectType objtype, reads size) of
(Just t, [(bytes, "")]) ->
Just $ ParsedResp (Ref sha) bytes t
_ -> Nothing
| otherwise -> Nothing
_
| l == fromRef object ++ " missing" -> Just DNE
| otherwise -> Nothing
parseResp object l
| " missing" `isSuffixOf` l -- less expensive than full check
&& l == fromRef object ++ " missing" = Just DNE
| otherwise = case words l of
[sha, objtype, size]
| length sha == shaSize ->
case (readObjectType objtype, reads size) of
(Just t, [(bytes, "")]) ->
Just $ ParsedResp (Ref sha) bytes t
_ -> Nothing
| otherwise -> Nothing
_ -> Nothing
{- Gets a list of files and directories in a tree. (Not recursive.) -}
catTree :: CatFileHandle -> Ref -> IO [(FilePath, FileMode)]