diff options
author | Joey Hess <joey@kitenet.net> | 2012-12-13 00:29:06 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-12-13 00:29:06 -0400 |
commit | de6406afce6de0cf8a48bc2ecf9be1e7de93e40e (patch) | |
tree | 08705fab60c11d4073734a8c2500a88b1aab7852 /Git/Sha.hs | |
parent | 3e55a8f164d67d5bd1ef86ae2f38fb2c6c3a51b2 (diff) | |
parent | 94554782894ec6c26da3b46312d5d1d16d596458 (diff) |
Merge branch 'master' into desymlink
Conflicts:
Annex/CatFile.hs
Annex/Content.hs
Git/LsFiles.hs
Git/LsTree.hs
Diffstat (limited to 'Git/Sha.hs')
-rw-r--r-- | Git/Sha.hs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Git/Sha.hs b/Git/Sha.hs index 2a01ede83..e62b29dab 100644 --- a/Git/Sha.hs +++ b/Git/Sha.hs @@ -14,8 +14,8 @@ import Git.Types any trailing newline, returning the sha. -} getSha :: String -> IO String -> IO Sha getSha subcommand a = maybe bad return =<< extractSha <$> a - where - bad = error $ "failed to read sha from git " ++ subcommand + where + bad = error $ "failed to read sha from git " ++ subcommand {- Extracts the Sha from a string. There can be a trailing newline after - it, but nothing else. -} @@ -24,12 +24,12 @@ extractSha s | len == shaSize = val s | len == shaSize + 1 && length s' == shaSize = val s' | otherwise = Nothing - where - len = length s - s' = firstLine s - val v - | all (`elem` "1234567890ABCDEFabcdef") v = Just $ Ref v - | otherwise = Nothing + where + len = length s + s' = firstLine s + val v + | all (`elem` "1234567890ABCDEFabcdef") v = Just $ Ref v + | otherwise = Nothing {- Size of a git sha. -} shaSize :: Int |