summaryrefslogtreecommitdiff
path: root/Annex/Direct.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-04-06 16:01:39 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-04-06 16:07:25 -0400
commitf758f6d5cbef989bff75fcd140edb8e0b8899b84 (patch)
treec7832b9d65a1a0411662f4d3fb6a6f9f1868a065 /Annex/Direct.hs
parentd653a5842f8a070e7d53a6f8fcd7838106efeee7 (diff)
Bugfix: Direct mode no longer repeatedly checksums duplicated files.
Fixed by storing a list of cached inodes for a key, instead of just one. Backwards compatability note: An old git-annex version will fail to parse an inode cache file that has been written by a new version, and has multiple items. It will succees if just one. So old git-annexes will have even worse behavior when there are duplicated files, if that is possible. I don't think it will be a problem. (Famous last words.) Also, note that it doesn't expire old and unused inode caches for a key. It would be possible to add this if needed; just look through the associated files for a key and if there are more cached inodes, throw out any not corresponding to associated files. Unless a file is being copied repeatedly and the old copy deleted, this lack of expiry should not be a problem.
Diffstat (limited to 'Annex/Direct.hs')
-rw-r--r--Annex/Direct.hs8
1 files changed, 4 insertions, 4 deletions
diff --git a/Annex/Direct.hs b/Annex/Direct.hs
index e3779adc8..a0388017e 100644
--- a/Annex/Direct.hs
+++ b/Annex/Direct.hs
@@ -52,8 +52,8 @@ stageDirect = do
- it really was. -}
oldcache <- recordedInodeCache key
case oldcache of
- Nothing -> modifiedannexed file key cache
- Just c -> unlessM (compareInodeCaches c cache) $
+ [] -> modifiedannexed file key cache
+ _ -> unlessM (elemInodeCaches cache oldcache) $
modifiedannexed file key cache
(Just key, Nothing, _) -> deletedannexed file key
(Nothing, Nothing, _) -> deletegit file
@@ -87,11 +87,11 @@ addDirect file cache = do
got Nothing = do
showEndFail
return False
- got (Just (key, _)) = ifM (sameInodeCache file $ Just cache)
+ got (Just (key, _)) = ifM (sameInodeCache file [cache])
( do
l <- inRepo $ gitAnnexLink file key
stageSymlink file =<< hashSymlink l
- writeInodeCache key cache
+ addInodeCache key cache
void $ addAssociatedFile key file
logStatus key InfoPresent
showEndOk