summaryrefslogtreecommitdiff
path: root/Content.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-05-15 02:49:43 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-05-15 03:38:08 -0400
commitcad0e1c8b7eb21f8dceca8dd9fa3bc1d1aa7eabd (patch)
treeb6be12dc1cc83a35ca7d89a862d85e6d71c38572 /Content.hs
parentefa7f544050c0d5be6bc1b0fc0125278e475c213 (diff)
simplified a bunch of Maybe handling
Diffstat (limited to 'Content.hs')
-rw-r--r--Content.hs10
1 files changed, 4 insertions, 6 deletions
diff --git a/Content.hs b/Content.hs
index ade936da3..9040383be 100644
--- a/Content.hs
+++ b/Content.hs
@@ -57,11 +57,11 @@ calcGitLink :: FilePath -> Key -> Annex FilePath
calcGitLink file key = do
g <- Annex.gitRepo
cwd <- liftIO $ getCurrentDirectory
- let absfile = case absNormPath cwd file of
- Just f -> f
- Nothing -> error $ "unable to normalize " ++ file
+ let absfile = maybe whoops id $ absNormPath cwd file
return $ relPathDirToFile (parentDir absfile)
(Git.workTree g) </> ".git" </> annexLocation key
+ where
+ whoops = error $ "unable to normalize " ++ file
{- Updates the LocationLog when a key's presence changes in the current
- repository.
@@ -148,9 +148,7 @@ checkDiskSpace' :: Integer -> Key -> Annex ()
checkDiskSpace' adjustment key = do
g <- Annex.gitRepo
r <- getConfig g "diskreserve" ""
- let reserve = case readSize dataUnits r of
- Nothing -> megabyte
- Just v -> v
+ let reserve = maybe megabyte id $ readSize dataUnits r
stats <- liftIO $ getFileSystemStats (gitAnnexDir g)
case (stats, keySize key) of
(Nothing, _) -> return ()