summaryrefslogtreecommitdiff
path: root/Upgrade/V1.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-07-15 03:12:05 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-07-15 03:12:05 -0400
commite78475737636a5d1e0d0a36b475c300cc7bb56cc (patch)
tree1d88de569e951b66ff5321eefaec49ad4b33bf89 /Upgrade/V1.hs
parent9bb797c0eae3c9d2f119a734762a6d5fa7321a80 (diff)
hlint tweaks
Did all sources except Remotes/* and Command/*
Diffstat (limited to 'Upgrade/V1.hs')
-rw-r--r--Upgrade/V1.hs25
1 files changed, 11 insertions, 14 deletions
diff --git a/Upgrade/V1.hs b/Upgrade/V1.hs
index 165a48262..8a3d37a64 100644
--- a/Upgrade/V1.hs
+++ b/Upgrade/V1.hs
@@ -94,7 +94,7 @@ updateSymlinks = do
showNote "updating symlinks..."
g <- Annex.gitRepo
files <- liftIO $ LsFiles.inRepo g [Git.workTree g]
- forM_ files $ fixlink
+ forM_ files fixlink
where
fixlink f = do
r <- lookupFile1 f
@@ -119,7 +119,7 @@ moveLocationLogs = do
if exists
then do
contents <- liftIO $ getDirectoryContents dir
- return $ catMaybes $ map oldlog2key contents
+ return $ mapMaybe oldlog2key contents
else return []
move (l, k) = do
g <- Annex.gitRepo
@@ -196,17 +196,14 @@ lookupFile1 file = do
Left _ -> return Nothing
Right l -> makekey l
where
- getsymlink = do
- l <- readSymbolicLink file
- return $ takeFileName l
- makekey l = do
- case maybeLookupBackendName bname of
- Nothing -> do
- unless (null kname || null bname ||
- not (isLinkToAnnex l)) $
- warning skip
- return Nothing
- Just backend -> return $ Just (k, backend)
+ getsymlink = return . takeFileName =<< readSymbolicLink file
+ makekey l = case maybeLookupBackendName bname of
+ Nothing -> do
+ unless (null kname || null bname ||
+ not (isLinkToAnnex l)) $
+ warning skip
+ return Nothing
+ Just backend -> return $ Just (k, backend)
where
k = fileKey1 l
bname = keyBackendName k
@@ -221,7 +218,7 @@ getKeyFilesPresent1 = do
getKeyFilesPresent1' :: FilePath -> Annex [FilePath]
getKeyFilesPresent1' dir = do
exists <- liftIO $ doesDirectoryExist dir
- if (not exists)
+ if not exists
then return []
else do
dirs <- liftIO $ getDirectoryContents dir