summaryrefslogtreecommitdiff
path: root/Command
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-12-09 17:47:05 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-12-09 17:54:54 -0400
commitd2d501503d9aa19787466129394141c794bb84e6 (patch)
tree3a0e3982e420ec42e2d90672628c4d63c7f78eff /Command
parent76ccac53916d308aa4806d38bb8cfb6a9d1f9081 (diff)
use InodeCache when dropping a key to see if a pointer file can be safely reset
The Keys database can hold multiple inode caches for a given key. One for the annex object, and one for each pointer file, which may not be hard linked to it. Inode caches for a key are recorded when its content is added to the annex, but only if it has known pointer files. This is to avoid the overhead of maintaining the database when not needed. When the smudge filter outputs a file's content, the inode cache is not updated, because git's smudge interface doesn't let us write the file. So, dropping will fall back to doing an expensive verification then. Ideally, git's interface would be improved, and then the inode cache could be updated then too.
Diffstat (limited to 'Command')
-rw-r--r--Command/Smudge.hs9
1 files changed, 2 insertions, 7 deletions
diff --git a/Command/Smudge.hs b/Command/Smudge.hs
index b532ac3d1..14d3a7f41 100644
--- a/Command/Smudge.hs
+++ b/Command/Smudge.hs
@@ -48,7 +48,7 @@ smudge file = do
case parseLinkOrPointer b of
Nothing -> liftIO $ B.putStr b
Just k -> do
- updateAssociatedFiles k file
+ Database.Keys.addAssociatedFile k file
content <- calcRepo (gitAnnexLocation k)
liftIO $ B.hPut stdout . fromMaybe b
=<< catchMaybeIO (B.readFile content)
@@ -65,7 +65,7 @@ clean file = do
else ifM (shouldAnnex file)
( do
k <- ingest file
- updateAssociatedFiles k file
+ Database.Keys.addAssociatedFile k file
liftIO $ emitPointer k
, liftIO $ B.hPut stdout b
)
@@ -100,8 +100,3 @@ ingest file = do
emitPointer :: Key -> IO ()
emitPointer = putStrLn . formatPointer
-
-updateAssociatedFiles :: Key -> FilePath -> Annex ()
-updateAssociatedFiles k f = do
- Database.Keys.addAssociatedFile k f
- Database.Keys.flushDb