assistant: Fix race in v6 mode that caused downloaded file content to sometimes not replace pointer files.

The keys database handle needs to be closed after merging, because the
smudge filter, in another process, updates the database. Old cached info
can be read for a while from the open database handle; closing it ensures
that the info written by the smudge filter is available.

This is pretty horribly ad-hoc, and it's especially nasty that the
transferrer closes the database every time.
This commit is contained in:
Joey Hess 2016-05-16 14:49:12 -04:00
parent fb8ab2469d
commit 5f0b551c0c
Failed to extract signature
5 changed files with 38 additions and 4 deletions

View file

@ -19,6 +19,7 @@ import qualified Annex.Branch
import qualified Git
import qualified Git.Branch
import qualified Command.Sync
import qualified Database.Keys
import Annex.TaggedPush
import Remote (remoteFromUUID)
@ -89,6 +90,12 @@ onChange file
currbranch mergeConfig
Git.Branch.AutomaticCommit
changedbranch
-- Merging can cause new associated files
-- to appear and the smudge filter will
-- add them to the database. To ensure that
-- this process sees those changes, close
-- the database if it was open.
liftAnnex $ Database.Keys.closeDb
mergecurrent _ = noop
handleDesynced = case fromTaggedBranch changedbranch of