diff options
author | Joey Hess <joey@kitenet.net> | 2012-01-28 15:41:52 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-01-28 15:41:52 -0400 |
commit | b81d662cbf0036d0e2b632ed95a877feab2a4860 (patch) | |
tree | 210d8138f9cde552ebe450fbbdc2a6d6508086b2 /CmdLine.hs | |
parent | 303666965ab5bc891c8ed44969553afb642c3f9c (diff) |
Avoid repeated location log commits when a remote is receiving files.
Done by adding a oneshot mode, in which location log changes are written to
the journal, but not committed. Taking advantage of git-annex's existing
ability to recover in this situation.
This is used by git-annex-shell and other places where changes are made to
a remote's location log.
Diffstat (limited to 'CmdLine.hs')
-rw-r--r-- | CmdLine.hs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/CmdLine.hs b/CmdLine.hs index 29b95d01b..61e6c26bb 100644 --- a/CmdLine.hs +++ b/CmdLine.hs @@ -29,8 +29,8 @@ type Params = [String] type Flags = [Annex ()] {- Runs the passed command line. -} -dispatch :: Params -> [Command] -> [Option] -> String -> IO Git.Repo -> IO () -dispatch args cmds commonoptions header getgitrepo = do +dispatch :: Bool -> Params -> [Command] -> [Option] -> String -> IO Git.Repo -> IO () +dispatch oneshot args cmds commonoptions header getgitrepo = do setupConsole r <- E.try getgitrepo :: IO (Either E.SomeException Git.Repo) case r of @@ -40,7 +40,7 @@ dispatch args cmds commonoptions header getgitrepo = do (actions, state') <- Annex.run state $ do sequence_ flags prepCommand cmd params - tryRun state' cmd $ [startup] ++ actions ++ [shutdown] + tryRun state' cmd $ [startup] ++ actions ++ [shutdown oneshot] where (flags, cmd, params) = parseCmd args cmds commonoptions header @@ -89,9 +89,9 @@ startup :: Annex Bool startup = return True {- Cleanup actions. -} -shutdown :: Annex Bool -shutdown = do - saveState +shutdown :: Bool -> Annex Bool +shutdown oneshot = do + saveState oneshot liftIO Git.Command.reap -- zombies from long-running git processes sshCleanup -- ssh connection caching return True |