diff options
Diffstat (limited to 'Annex')
-rw-r--r-- | Annex/Content.hs | 6 | ||||
-rw-r--r-- | Annex/LockPool.hs | 7 | ||||
-rw-r--r-- | Annex/Perms.hs | 2 | ||||
-rw-r--r-- | Annex/Ssh.hs | 2 | ||||
-rw-r--r-- | Annex/Version.hs | 2 |
5 files changed, 9 insertions, 10 deletions
diff --git a/Annex/Content.hs b/Annex/Content.hs index 7022364d0..c5771af28 100644 --- a/Annex/Content.hs +++ b/Annex/Content.hs @@ -98,7 +98,7 @@ lockContent key a = do case v of Left _ -> error "content is locked" Right _ -> return $ Just fd - unlock Nothing = return () + unlock Nothing = noop unlock (Just l) = closeFd l {- Calculates the relative path to use to link a file to a key. -} @@ -237,10 +237,10 @@ cleanObjectLoc key = do file <- inRepo $ gitAnnexLocation key liftIO $ removeparents file (3 :: Int) where - removeparents _ 0 = return () + removeparents _ 0 = noop removeparents file n = do let dir = parentDir file - maybe (return ()) (const $ removeparents dir (n-1)) + maybe noop (const $ removeparents dir (n-1)) =<< catchMaybeIO (removeDirectory dir) {- Removes a key's file from .git/annex/objects/ -} diff --git a/Annex/LockPool.hs b/Annex/LockPool.hs index 3eb1363ee..b99a8ec4d 100644 --- a/Annex/LockPool.hs +++ b/Annex/LockPool.hs @@ -18,7 +18,7 @@ import Annex.Perms lockFile :: FilePath -> Annex () lockFile file = go =<< fromPool file where - go (Just _) = return () -- already locked + go (Just _) = noop -- already locked go Nothing = do mode <- annexFileMode fd <- liftIO $ noUmask mode $ @@ -27,10 +27,9 @@ lockFile file = go =<< fromPool file changePool $ M.insert file fd unlockFile :: FilePath -> Annex () -unlockFile file = go =<< fromPool file +unlockFile file = maybe noop go =<< fromPool file where - go Nothing = return () - go (Just fd) = do + go fd = do liftIO $ closeFd fd changePool $ M.delete file diff --git a/Annex/Perms.hs b/Annex/Perms.hs index 12dfdd667..c54908b43 100644 --- a/Annex/Perms.hs +++ b/Annex/Perms.hs @@ -37,7 +37,7 @@ setAnnexPerm file = withShared $ liftIO . go go GroupShared = groupWriteRead file go AllShared = modifyFileMode file $ addModes $ [ ownerWriteMode, groupWriteMode ] ++ readModes - go _ = return () + go _ = noop {- Gets the appropriate mode to use for creating a file in the annex - (other than content files, which are locked down more). -} diff --git a/Annex/Ssh.hs b/Annex/Ssh.hs index 02a1ee705..6a230312a 100644 --- a/Annex/Ssh.hs +++ b/Annex/Ssh.hs @@ -81,7 +81,7 @@ sshCleanup = do v <- liftIO $ tryIO $ setLock fd (WriteLock, AbsoluteSeek, 0, 0) case v of - Left _ -> return () + Left _ -> noop Right _ -> stopssh socketfile liftIO $ closeFd fd stopssh socketfile = do diff --git a/Annex/Version.hs b/Annex/Version.hs index cf5d22484..a1d040244 100644 --- a/Annex/Version.hs +++ b/Annex/Version.hs @@ -35,7 +35,7 @@ setVersion = setConfig versionField defaultVersion checkVersion :: Version -> Annex () checkVersion v - | v `elem` supportedVersions = return () + | v `elem` supportedVersions = noop | v `elem` upgradableVersions = err "Upgrade this repository: git-annex upgrade" | otherwise = err "Upgrade git-annex." where |