aboutsummaryrefslogtreecommitdiff
path: root/Command.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-10-29 17:49:37 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-10-29 18:03:28 -0400
commit2566eb85fe2bbd0f9d1798d50ca0d88970a4490c (patch)
tree29cda2f8ef30eb8637c0bc7d695d3d3f77df0136 /Command.hs
parentfef2cf739872b905bbdf493f9f3ba7124400c633 (diff)
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.
Diffstat (limited to 'Command.hs')
-rw-r--r--Command.hs25
1 files changed, 12 insertions, 13 deletions
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