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 /Command.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 'Command.hs')
-rw-r--r-- | Command.hs | 7 |
1 files changed, 0 insertions, 7 deletions
diff --git a/Command.hs b/Command.hs index 478dfdc39..8225f7b1b 100644 --- a/Command.hs +++ b/Command.hs @@ -17,7 +17,6 @@ module Command ( doCommand, whenAnnexed, ifAnnexed, - notBareRepo, isBareRepo, numCopies, numCopiesCheck, @@ -97,12 +96,6 @@ whenAnnexed a file = ifAnnexed file (a file) (return Nothing) ifAnnexed :: FilePath -> ((Key, Backend) -> Annex a) -> Annex a -> Annex a ifAnnexed file yes no = maybe no yes =<< Backend.lookupFile file -notBareRepo :: Annex a -> Annex a -notBareRepo a = do - whenM isBareRepo $ - error "You cannot run this subcommand in a bare repository." - a - isBareRepo :: Annex Bool isBareRepo = fromRepo Git.repoIsLocalBare |