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 /Annex | |
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 'Annex')
-rw-r--r-- | Annex/Content.hs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/Annex/Content.hs b/Annex/Content.hs index c21ac405e..dcfd43866 100644 --- a/Annex/Content.hs +++ b/Annex/Content.hs @@ -291,11 +291,16 @@ getKeysPresent' dir = do let files = concat contents return $ mapMaybe (fileKey . takeFileName) files -{- Things to do to record changes to content. -} -saveState :: Annex () -saveState = do +{- Things to do to record changes to content when shutting down. + - + - It's acceptable to avoid committing changes to the branch, + - especially if performing a short-lived action. + -} +saveState :: Bool -> Annex () +saveState oneshot = do Annex.Queue.flush False - Annex.Branch.commit "update" + unless oneshot $ + Annex.Branch.commit "update" {- Downloads content from any of a list of urls. -} downloadUrl :: [Url.URLString] -> FilePath -> Annex Bool |