This commit is contained in:
Joey Hess 2011-08-30 13:23:21 -04:00
parent 5ef11350aa
commit a64c16bf7d
2 changed files with 4 additions and 6 deletions

View file

@ -122,8 +122,7 @@ lookupBackendName s = fromMaybe unknown $ maybeLookupBackendName s
where where
unknown = error $ "unknown backend " ++ s unknown = error $ "unknown backend " ++ s
maybeLookupBackendName :: String -> Maybe (Backend Annex) maybeLookupBackendName :: String -> Maybe (Backend Annex)
maybeLookupBackendName s = maybeLookupBackendName s
if 1 /= length matches | length matches == 1 = Just $ head matches
then Nothing | otherwise = Nothing
else Just $ head matches
where matches = filter (\b -> s == B.name b) list where matches = filter (\b -> s == B.name b) list

View file

@ -137,8 +137,7 @@ compareSizes units abbrev old new
{- Parses strings like "10 kilobytes" or "0.5tb". -} {- Parses strings like "10 kilobytes" or "0.5tb". -}
readSize :: [Unit] -> String -> Maybe ByteSize readSize :: [Unit] -> String -> Maybe ByteSize
readSize units input readSize units input
| null parsednum = Nothing | null parsednum || null parsedunit = Nothing
| null parsedunit = Nothing
| otherwise = Just $ round $ number * fromIntegral multiplier | otherwise = Just $ round $ number * fromIntegral multiplier
where where
(number, rest) = head parsednum (number, rest) = head parsednum