Avoid excess commits to the git-annex branch when stall detection is enabled

When git-annex transferrer started up, and the journal contained something,
it would commit it to the git-annex branch. This caused excess commits to
the branch, in cases where normally several changes would be journalled and
committed together. That generated some excess git objects and was also
just noisy on stdout.

Since transferrer uses enableInteractiveBranchAccess, it does not need to
commit journalled changes, since the optimisation that avoids checking
the journal when reading from the branch is disabled for processes that
call that.

This commit was sponsored by Svenne Krap on Patreon.
This commit is contained in:
Joey Hess 2021-04-02 11:56:50 -04:00
parent c75f7e1d98
commit ced91b3fbd
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
2 changed files with 7 additions and 2 deletions

View file

@ -37,18 +37,21 @@ checkIndexOnce a = unlessM (indexChecked <$> getState) $ do
- 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.
-
- When interactive access is enabled, the journal is always checked when
- reading values from the branch, and so this does not need to update
- the branch.
-}
runUpdateOnce :: Annex Bool -> Annex BranchState
runUpdateOnce a = do
st <- getState
if branchUpdated st
if branchUpdated st || needInteractiveAccess st
then return st
else do
journalstaged <- a
let stf = \st' -> st'
{ branchUpdated = True
, journalIgnorable = journalstaged
&& not (needInteractiveAccess st')
}
changeState stf
return (stf st)

View file

@ -1,6 +1,8 @@
git-annex (8.20210331) UNRELEASED; urgency=medium
* Fix build with persistent-2.12.0.1
* Avoid excess commits to the git-annex branch when stall detection is
enabled.
-- Joey Hess <id@joeyh.name> Thu, 01 Apr 2021 12:17:26 -0400