diff options
author | Joey Hess <joey@kitenet.net> | 2012-10-18 00:45:22 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-10-20 16:21:43 -0400 |
commit | 7c5d445f32a3ecc583d1031f0d01606ffaea9f59 (patch) | |
tree | 9dcec016b1ef93d96e293e43f5a5780123bfb059 /Git/LsFiles.hs | |
parent | ff6df3c4eb4339ecf9905f7f7c97c5ab04f324bb (diff) |
remove some more !!
Diffstat (limited to 'Git/LsFiles.hs')
-rw-r--r-- | Git/LsFiles.hs | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/Git/LsFiles.hs b/Git/LsFiles.hs index 5dd988fc3..4f8ac3fc6 100644 --- a/Git/LsFiles.hs +++ b/Git/LsFiles.hs @@ -120,17 +120,19 @@ data InternalUnmerged = InternalUnmerged parseUnmerged :: String -> Maybe InternalUnmerged parseUnmerged s - | null file || length ws < 3 = Nothing - | otherwise = do - stage <- readish (ws !! 2) :: Maybe Int - unless (stage == 2 || stage == 3) $ - fail undefined -- skip stage 1 - blobtype <- readBlobType (ws !! 0) - sha <- extractSha (ws !! 1) - return $ InternalUnmerged (stage == 2) file (Just blobtype) (Just sha) + | null file = Nothing + | otherwise = case words metadata of + (rawblobtype:rawsha:rawstage:_) -> do + stage <- readish rawstage :: Maybe Int + unless (stage == 2 || stage == 3) $ + fail undefined -- skip stage 1 + blobtype <- readBlobType rawblobtype + sha <- extractSha rawsha + return $ InternalUnmerged (stage == 2) file + (Just blobtype) (Just sha) + _ -> Nothing where (metadata, file) = separate (== '\t') s - ws = words metadata reduceUnmerged :: [Unmerged] -> [InternalUnmerged] -> [Unmerged] reduceUnmerged c [] = c |