better layout
And a theoretical fix to branchstate cache invalidation, but not a bug that could actually happen.
This commit is contained in:
parent
82e655efd0
commit
dfee6e1ed6
1 changed files with 38 additions and 33 deletions
|
@ -121,9 +121,7 @@ commit message = do
|
|||
{- Ensures that the branch is up-to-date; should be called before
|
||||
- data is read from it. Runs only once per git-annex run. -}
|
||||
update :: Annex ()
|
||||
update = do
|
||||
state <- getState
|
||||
unless (branchUpdated state) $ do
|
||||
update = onceonly $ do
|
||||
-- check what needs updating before taking the lock
|
||||
fs <- getJournalFiles
|
||||
c <- filterM changedbranch =<< siblingBranches
|
||||
|
@ -154,7 +152,6 @@ update = do
|
|||
liftIO $ Git.UnionMerge.merge_index g branches
|
||||
liftIO $ Git.commit g "update" fullname (nub $ fullname:refs)
|
||||
invalidateCache
|
||||
Annex.changeState $ \s -> s { Annex.branchstate = state { branchUpdated = True } }
|
||||
where
|
||||
changedbranch (_, branch) = do
|
||||
g <- gitRepo
|
||||
|
@ -166,6 +163,14 @@ update = do
|
|||
Params "--oneline -n1"
|
||||
]
|
||||
return $ not $ L.null diffs
|
||||
onceonly a = unlessM (branchUpdated <$> getState) $ do
|
||||
r <- a
|
||||
Annex.changeState setupdated
|
||||
return r
|
||||
setupdated s = s { Annex.branchstate = new }
|
||||
where
|
||||
new = old { branchUpdated = True }
|
||||
old = Annex.branchstate s
|
||||
|
||||
{- Checks if a git ref exists. -}
|
||||
refExists :: GitRef -> Annex Bool
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue