suppress "(Recording state in git)" message when committing change to remote state

This was shown redundantly for a tricky reason -- while it runs
inside a doSideAction block that would appear to supress it,
the action being run is in a different state monad; for the remote,
and so the suppression doesn't work.

Always suppressing the message when committing to a local remote is
ok do to though -- it mirrors the /dev/nulling of the git annex shell commit
output. And it turns out that any time there is a git-annex branch state
change to commit on the remote, the local repo has also had a similar
change made, and so the message has been shown already.
This commit is contained in:
Joey Hess 2012-05-20 00:14:56 -04:00
parent ebbd24e5ed
commit 37ef39c929
2 changed files with 12 additions and 3 deletions

View file

@ -14,6 +14,7 @@ module Messages (
MeterUpdate, MeterUpdate,
showSideAction, showSideAction,
doSideAction, doSideAction,
doQuietSideAction,
showStoringStateAction, showStoringStateAction,
showOutput, showOutput,
showLongNote, showLongNote,
@ -91,12 +92,19 @@ showSideAction m = Annex.getState Annex.output >>= go
showStoringStateAction :: Annex () showStoringStateAction :: Annex ()
showStoringStateAction = showSideAction "Recording state in git" showStoringStateAction = showSideAction "Recording state in git"
{- Performs an action, supressing showSideAction messages. -}
doQuietSideAction :: Annex a -> Annex a
doQuietSideAction = doSideAction' InBlock
{- Performs an action, that may call showSideAction multiple times. {- Performs an action, that may call showSideAction multiple times.
- Only the first will be displayed. -} - Only the first will be displayed. -}
doSideAction :: Annex a -> Annex a doSideAction :: Annex a -> Annex a
doSideAction a = do doSideAction = doSideAction' StartBlock
doSideAction' :: SideActionBlock -> Annex a -> Annex a
doSideAction' b a = do
o <- Annex.getState Annex.output o <- Annex.getState Annex.output
set $ o { sideActionBlock = StartBlock } set $ o { sideActionBlock = b }
set o `after` a set o `after` a
where where
set o = Annex.changeState $ \s -> s { Annex.output = o } set o = Annex.changeState $ \s -> s { Annex.output = o }

View file

@ -310,6 +310,7 @@ commitOnCleanup r a = go `after` a
go = Annex.addCleanup (Git.repoLocation r) cleanup go = Annex.addCleanup (Git.repoLocation r) cleanup
cleanup cleanup
| not $ Git.repoIsUrl r = liftIO $ onLocal r $ | not $ Git.repoIsUrl r = liftIO $ onLocal r $
doQuietSideAction $
Annex.Branch.commit "update" Annex.Branch.commit "update"
| otherwise = void $ do | otherwise = void $ do
Just (shellcmd, shellparams) <- Just (shellcmd, shellparams) <-