]> dgit.raspbian.org Git - git-annex.git/commitdiff
fix reversion caused by earlier optimisation to git-annex branch reads
authorJoey Hess <joeyh@joeyh.name>
Fri, 10 Apr 2020 19:18:38 +0000 (15:18 -0400)
committerJoey Hess <joeyh@joeyh.name>
Fri, 10 Apr 2020 19:25:22 +0000 (15:25 -0400)
aeca7c2207a652c8a72f044204a5c0edb4782aac 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.

Annex/Branch.hs

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