aboutsummaryrefslogtreecommitdiff
path: root/Git/LsFiles.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-04-19 00:38:29 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-04-19 00:38:29 -0400
commitc5910fd179d374f644ab3c843b243a51a7df9b24 (patch)
tree9623da2ab0411f3862d415a17be7be567688b714 /Git/LsFiles.hs
parentbf1bf600fc94f6b95d5723473b148b35ab32073d (diff)
removed all uses of undefined from code base
It's a code smell, can lead to hard to diagnose error messages.
Diffstat (limited to 'Git/LsFiles.hs')
-rw-r--r--Git/LsFiles.hs13
1 files changed, 7 insertions, 6 deletions
diff --git a/Git/LsFiles.hs b/Git/LsFiles.hs
index c23c282d0..e80c1b288 100644
--- a/Git/LsFiles.hs
+++ b/Git/LsFiles.hs
@@ -181,12 +181,13 @@ parseUnmerged s
| 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)
+ if stage /= 2 && stage /= 3
+ then Nothing
+ else do
+ blobtype <- readBlobType rawblobtype
+ sha <- extractSha rawsha
+ return $ InternalUnmerged (stage == 2) file
+ (Just blobtype) (Just sha)
_ -> Nothing
where
(metadata, file) = separate (== '\t') s