summaryrefslogtreecommitdiff
path: root/Annex/Content.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-02-25 16:11:47 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-02-25 16:18:55 -0400
commit1f73db3469e29448bcb1520893de11b23da6fb1f (patch)
treeb16fe0b9552818d16067e7cbb7c3403b73fe5e94 /Annex/Content.hs
parentb49c0c2633d662a7c91a609aec74f95f189129ad (diff)
improve alwayscommit=false mode
Now changes are staged into the branch's index, but not committed, which avoids growing a large journal. And sync and merge always explicitly commit, ensuring that even when they do nothing else, they commit the staged changes. Added a flag file to indicate that the branch's journal contains uncommitted changes. (Could use git ls-files, but don't want to run that every time.) In the future, this ability to have uncommitted changes staged in the journal might be used on remotes after a series of oneshot commands.
Diffstat (limited to 'Annex/Content.hs')
-rw-r--r--Annex/Content.hs8
1 files changed, 5 insertions, 3 deletions
diff --git a/Annex/Content.hs b/Annex/Content.hs
index 3a388129e..f328051e3 100644
--- a/Annex/Content.hs
+++ b/Annex/Content.hs
@@ -312,9 +312,11 @@ getKeysPresent' dir = do
saveState :: Bool -> Annex ()
saveState oneshot = do
Annex.Queue.flush False
- alwayscommit <- Git.configTrue <$> fromRepo (Git.Config.get "annex.alwayscommit" "true")
- unless (oneshot || not alwayscommit) $ do
- Annex.Branch.commit "update"
+ unless oneshot $ do
+ alwayscommit <- Git.configTrue <$> fromRepo (Git.Config.get "annex.alwayscommit" "true")
+ if alwayscommit
+ then Annex.Branch.commit "update"
+ else Annex.Branch.stage
{- Downloads content from any of a list of urls. -}
downloadUrl :: [Url.URLString] -> FilePath -> Annex Bool