Run shutdown cleanup actions even if there were failures processing the command.

Amoung other fixes, this means that addurl will stage added files even if
adding one of the urls fails.
This commit is contained in:
Joey Hess 2014-12-30 12:49:34 -04:00
parent cdc69d7477
commit e9a5e4d6c6
3 changed files with 10 additions and 6 deletions

View file

@ -53,8 +53,8 @@ dispatch fuzzyok allargs allcmds commonoptions fields header getgitrepo = do
whenM (annexDebug <$> Annex.getGitConfig) $ whenM (annexDebug <$> Annex.getGitConfig) $
liftIO enableDebugOutput liftIO enableDebugOutput
startup startup
performCommandAction cmd params performCommandAction cmd params $
shutdown $ cmdnocommit cmd shutdown $ cmdnocommit cmd
go _flags params (Left e) = do go _flags params (Left e) = do
when fuzzy $ when fuzzy $
autocorrect =<< Git.Config.global autocorrect =<< Git.Config.global

View file

@ -17,13 +17,14 @@ import qualified Annex.Queue
type CommandActionRunner = CommandStart -> CommandCleanup type CommandActionRunner = CommandStart -> CommandCleanup
{- Runs a command, starting with the check stage, and then {- Runs a command, starting with the check stage, and then
- the seek stage. Finishes by printing the number of commandActions that - the seek stage. Finishes by running the continutation, and
- failed. -} - then showing a count of any failures. -}
performCommandAction :: Command -> CmdParams -> Annex () performCommandAction :: Command -> CmdParams -> Annex () -> Annex ()
performCommandAction Command { cmdseek = seek, cmdcheck = c, cmdname = name } params = do performCommandAction Command { cmdseek = seek, cmdcheck = c, cmdname = name } params cont = do
mapM_ runCheck c mapM_ runCheck c
Annex.changeState $ \s -> s { Annex.errcounter = 0 } Annex.changeState $ \s -> s { Annex.errcounter = 0 }
seek params seek params
cont
showerrcount =<< Annex.getState Annex.errcounter showerrcount =<< Annex.getState Annex.errcounter
where where
showerrcount 0 = noop showerrcount 0 = noop

3
debian/changelog vendored
View file

@ -4,6 +4,9 @@ git-annex (5.20141220) UNRELEASED; urgency=medium
* Work around statfs() overflow on some XFS systems. * Work around statfs() overflow on some XFS systems.
* sync: Now supports remote groups, the same way git remote update does. * sync: Now supports remote groups, the same way git remote update does.
* setpresentkey: A new plumbing-level command. * setpresentkey: A new plumbing-level command.
* Run shutdown cleanup actions even if there were failures processing
the command. Amoung other fixes, this means that addurl will stage
added files even if adding one of the urls fails.
-- Joey Hess <id@joeyh.name> Mon, 22 Dec 2014 15:16:38 -0400 -- Joey Hess <id@joeyh.name> Mon, 22 Dec 2014 15:16:38 -0400