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.
This commit is contained in:
Joey Hess 2012-12-29 14:45:19 -04:00
parent e2788a5d15
commit e872c3f648
10 changed files with 26 additions and 28 deletions

View file

@ -13,7 +13,7 @@ import Command
import Option
def :: [Command]
def = [withOptions [foregroundOption, stopOption] $
def = [notBareRepo $ withOptions [foregroundOption, stopOption] $
command "watch" paramNothing seek "watch for changes"]
seek :: [CommandSeek]
@ -28,7 +28,7 @@ stopOption :: Option
stopOption = Option.flag [] "stop" "stop daemon"
start :: Bool -> Bool -> Bool -> CommandStart
start assistant foreground stopdaemon = notBareRepo $ do
start assistant foreground stopdaemon = do
if stopdaemon
then stopDaemon
else startDaemon assistant foreground Nothing -- does not return