From ced91b3fbd6dd3c9644ad95985196b3af7f65397 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 2 Apr 2021 11:56:50 -0400 Subject: [PATCH] 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. --- Annex/BranchState.hs | 7 +++++-- CHANGELOG | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Annex/BranchState.hs b/Annex/BranchState.hs index 8a1beee902..e6de41a582 100644 --- a/Annex/BranchState.hs +++ b/Annex/BranchState.hs @@ -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) diff --git a/CHANGELOG b/CHANGELOG index 33c80fa5b3..3dd060bcea 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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 Thu, 01 Apr 2021 12:17:26 -0400