disable journal read optimisation when alwayscommit=false
The journal read optimisation inaeca7c220
later got fixed ineedd73b84
to stage and commit any files that were left in the journal by a previous git-annex run. That's necessary for the optimisation to work correctly. But it also meant that alwayscommit=false started committing the previous git-annex processes journalled changes, which defeated the purpose of the config setting entirely. So, disable the optimisation when alwayscommit=false, leaving the files in the journal and not committing them. See my comments on the bug report for why this seemed the best approach. Also fixes a problem when annex.merge-annex-branches=false and there are changes in the journal. That config indirectly prevents committing the journal. (Which seems a bit odd given its name, but it always has..) So, when there were changes in the journal, perhaps left there due to alwayscommit=false being set before, the optimisation would prevent git-annex from reading the journal files, and it would operate with out of date information.
This commit is contained in:
parent
0e4c92503e
commit
43a9808292
5 changed files with 46 additions and 26 deletions
|
@ -28,26 +28,24 @@ checkIndexOnce a = unlessM (indexChecked <$> getState) $ do
|
|||
changeState $ \s -> s { indexChecked = True }
|
||||
|
||||
{- Runs an action to update the branch, if it's not been updated before
|
||||
- in this run of git-annex. -}
|
||||
runUpdateOnce :: Annex () -> Annex BranchState
|
||||
- in this run of git-annex.
|
||||
-
|
||||
- The action should return True if anything that was in the journal
|
||||
- before got staged (or if the journal was empty). That lets an opmisation
|
||||
- be done: The journal then does not need to be checked going forward,
|
||||
- until new information gets written to it.
|
||||
-}
|
||||
runUpdateOnce :: Annex Bool -> Annex BranchState
|
||||
runUpdateOnce a = do
|
||||
st <- getState
|
||||
if branchUpdated st
|
||||
then return st
|
||||
else do
|
||||
a
|
||||
journalstaged <- a
|
||||
let stf = \st' -> st'
|
||||
{ branchUpdated = True
|
||||
-- The update staged anything that was
|
||||
-- journalled before, so the journal
|
||||
-- does not need to be checked going
|
||||
-- forward, unless new information
|
||||
-- gets written to it, or unless
|
||||
-- this run of git-annex needs to notice
|
||||
-- changes journalled by other processes
|
||||
-- while it's running.
|
||||
, journalIgnorable = not $
|
||||
journalNeverIgnorable st'
|
||||
, journalIgnorable = journalstaged
|
||||
&& not (journalNeverIgnorable st')
|
||||
}
|
||||
changeState stf
|
||||
return (stf st)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue