This commit is contained in:
Joey Hess 2012-04-21 23:32:33 -04:00
parent bee420bd2d
commit ed79596b75
27 changed files with 56 additions and 52 deletions

View file

@ -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/ -}

View file

@ -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

View file

@ -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). -}

View file

@ -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

View file

@ -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