diff options
author | Joey Hess <joey@kitenet.net> | 2012-12-29 14:45:19 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-12-29 14:45:19 -0400 |
commit | 992eb6d6931cfc2ca8da0fe2d25e58742ce8cd77 (patch) | |
tree | cb1b35a324ee240fc2291b847e96e46944e5fbfc /Checks.hs | |
parent | a2acf0ed7f27bf4ce37be39d1c5f47c414183ead (diff) |
convert notBareRepo to a CommandCheck
This avoids some small overhead by only running the check once per command;
it also ensures that, even if the command doesn't find anything to run on,
it still fails to run when in a bare repo.
Diffstat (limited to 'Checks.hs')
-rw-r--r-- | Checks.hs | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -14,6 +14,7 @@ import Common.Annex import Types.Command import Init import Config +import qualified Git commonChecks :: [CommandCheck] commonChecks = [repoExists] @@ -25,6 +26,10 @@ notDirect :: Command -> Command notDirect = addCheck $ whenM isDirect $ error "You cannot run this subcommand in a direct mode repository." +notBareRepo :: Command -> Command +notBareRepo = addCheck $ whenM (fromRepo Git.repoIsLocalBare) $ + error "You cannot run this subcommand in a bare repository." + dontCheck :: CommandCheck -> Command -> Command dontCheck check cmd = mutateCheck cmd $ \c -> filter (/= check) c |