summaryrefslogtreecommitdiff
path: root/Command/Smudge.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-05-16 14:55:05 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-05-16 14:55:05 -0400
commit8e9a8b42470e979fdf9aef9c87b2d7d36aa89c64 (patch)
tree577b39126866cf44d80d03abb44857ef8e90a0e6 /Command/Smudge.hs
parent51ec94f83c66c6a6811e5c20ffa55aa32acdecf1 (diff)
reorder associated file db update
There's a potential race where the smudge filter is run at the same time an object is being downloaded. If the download finished after the inAnnex check, and before the keys db was updated, the associated file would not get updated with the downloaded content. I'm not sure this closes the race; it may only narrow the window. Problem is, the keys database needs to communicate between two different processes. In the case of the assistant, the transferkeys command is the other process, and it closes the db handle after getting the file. So, it should re-open the database and so see the update that the smudge filter has written to it. But, what if the smudge filter takes a while to update the database?
Diffstat (limited to 'Command/Smudge.hs')
-rw-r--r--Command/Smudge.hs2
1 files changed, 1 insertions, 1 deletions
diff --git a/Command/Smudge.hs b/Command/Smudge.hs
index 52367d499..933a0a01e 100644
--- a/Command/Smudge.hs
+++ b/Command/Smudge.hs
@@ -47,6 +47,7 @@ smudge file = do
case parseLinkOrPointer b of
Nothing -> liftIO $ B.putStr b
Just k -> do
+ Database.Keys.addAssociatedFile k =<< inRepo (toTopFilePath file)
-- A previous unlocked checkout of the file may have
-- led to the annex object getting modified;
-- don't provide such modified content as it
@@ -61,7 +62,6 @@ smudge file = do
=<< catchMaybeIO (B.readFile content)
, liftIO $ B.putStr b
)
- Database.Keys.addAssociatedFile k =<< inRepo (toTopFilePath file)
stop
-- Clean filter is fed file content on stdin, decides if a file