From 2566eb85fe2bbd0f9d1798d50ca0d88970a4490c Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 29 Oct 2011 17:49:37 -0400 Subject: fsck: Now works in bare repositories. Checks location log information, and file contents. Does not check that numcopies is satisfied, as .gitattributes information about numcopies is not available in a bare repository. In practice, that should not be a problem, since fsck is also run in a checkout and will check numcopies there. --- Command.hs | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) (limited to 'Command.hs') diff --git a/Command.hs b/Command.hs index b039403ca..4e312e66d 100644 --- a/Command.hs +++ b/Command.hs @@ -81,18 +81,6 @@ doCommand = start success = return True failure = showEndFail >> return False -notAnnexed :: FilePath -> Annex (Maybe a) -> Annex (Maybe a) -notAnnexed file a = maybe a (const $ return Nothing) =<< Backend.lookupFile file - -isAnnexed :: FilePath -> ((Key, Backend Annex) -> Annex (Maybe a)) -> Annex (Maybe a) -isAnnexed file a = maybe (return Nothing) a =<< Backend.lookupFile file - -notBareRepo :: Annex a -> Annex a -notBareRepo a = do - whenM (Git.repoIsLocalBare <$> gitRepo) $ - error "You cannot run this subcommand in a bare repository." - a - {- These functions find appropriate files or other things based on a user's parameters, and prepare actions operating on them. -} withFilesInGit :: (FilePath -> CommandStart) -> CommandSeek @@ -168,7 +156,18 @@ runFilteredGen a d fs = do ok <- matcher f if ok then a v else stop -{- filter out symlinks -} +notAnnexed :: FilePath -> Annex (Maybe a) -> Annex (Maybe a) +notAnnexed file a = maybe a (const $ return Nothing) =<< Backend.lookupFile file + +isAnnexed :: FilePath -> ((Key, Backend Annex) -> Annex (Maybe a)) -> Annex (Maybe a) +isAnnexed file a = maybe (return Nothing) a =<< Backend.lookupFile file + +notBareRepo :: Annex a -> Annex a +notBareRepo a = do + whenM (Git.repoIsLocalBare <$> gitRepo) $ + error "You cannot run this subcommand in a bare repository." + a + notSymlink :: FilePath -> IO Bool notSymlink f = liftIO $ not . isSymbolicLink <$> getSymbolicLinkStatus f -- cgit v1.2.3