From cad0e1c8b7eb21f8dceca8dd9fa3bc1d1aa7eabd Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 15 May 2011 02:49:43 -0400 Subject: simplified a bunch of Maybe handling --- Content.hs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'Content.hs') 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 () -- cgit v1.2.3