fix reversion caused by earlier optimisation to git-annex branch reads

aeca7c2207 was predicated on the
assumption that updateTo would stage any journal files, but in one case
it did not actually do so. The test suite happened to expose the bug.
This commit is contained in:
Joey Hess 2020-04-10 15:18:38 -04:00
parent df587ff068
commit eedd73b846
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View file

@ -170,15 +170,18 @@ updateTo' pairs = do
if null tomerge if null tomerge
{- Even when no refs need to be merged, the index {- Even when no refs need to be merged, the index
- may still be updated if the branch has gotten ahead - may still be updated if the branch has gotten ahead
- of the index. -} - of the index, or just if the journal is dirty. -}
then do then ifM (needUpdateIndex branchref)
whenM (needUpdateIndex branchref) $ lockJournal $ \jl -> do ( lockJournal $ \jl -> do
forceUpdateIndex jl branchref forceUpdateIndex jl branchref
{- When there are journalled changes {- When there are journalled changes
- as well as the branch being updated, - as well as the branch being updated,
- a commit needs to be done. -} - a commit needs to be done. -}
when dirty $ when dirty $
go branchref True [] jl go branchref dirty [] jl
, when dirty $
lockJournal $ go branchref dirty []
)
else lockJournal $ go branchref dirty tomerge else lockJournal $ go branchref dirty tomerge
return $ not $ null tomerge return $ not $ null tomerge
where where