diff options
author | Joey Hess <joey@kitenet.net> | 2012-10-19 14:25:15 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-10-19 14:25:15 -0400 |
commit | 5f835c769eb673b28d2d0211adfd6cbdf420b4bc (patch) | |
tree | 96641ced75582a8b3ccde4a3d8af03eee725df15 /Annex/Branch.hs | |
parent | 7723c5ea6a09233057813e7f7f582d4764e2b7ae (diff) |
remove git-annex branch read cache
This cache prevented noticing changes made by another process.
The case I just ran into involved the assistant dropping a file, which
cached its presence info. Then the same file was downloaded again,
but the assistant didn't know its presence info had changed.
I don't see a way to keep this cache. Will instead rely on the OS level
file cache, for files in the journal. May need to add more higher-level
caching of info that it's ok to have a potentially stale copy of,
although much of git-annex already does so.
Diffstat (limited to 'Annex/Branch.hs')
-rw-r--r-- | Annex/Branch.hs | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/Annex/Branch.hs b/Annex/Branch.hs index 3b056eed5..243514fc9 100644 --- a/Annex/Branch.hs +++ b/Annex/Branch.hs @@ -147,7 +147,6 @@ updateTo pairs = do then updateIndex branchref else commitBranch branchref merge_desc (nub $ fullname:refs) - invalidateCache liftIO cleanjournal {- Gets the content of a file, which may be in the journal, or committed @@ -168,20 +167,16 @@ getStale :: FilePath -> Annex String getStale = get' True get' :: Bool -> FilePath -> Annex String -get' staleok file = fromcache =<< getCache file +get' staleok file = fromjournal =<< getJournalFile file where - fromcache (Just content) = return content - fromcache Nothing = fromjournal =<< getJournalFile file - fromjournal (Just content) = cache content + fromjournal (Just content) = return content fromjournal Nothing | staleok = withIndex frombranch | otherwise = do update - withIndex $ frombranch >>= cache - frombranch = L.unpack <$> catFile fullname file - cache content = do - setCache file content - return content + frombranch + frombranch = withIndex $ + L.unpack <$> catFile fullname file {- Applies a function to modifiy the content of a file. - @@ -191,11 +186,9 @@ get' staleok file = fromcache =<< getCache file change :: FilePath -> (String -> String) -> Annex () change file a = lockJournal $ a <$> getStale file >>= set file -{- Records new content of a file into the journal and cache. -} +{- Records new content of a file into the journal -} set :: FilePath -> String -> Annex () -set file content = do - setJournalFile file content - setCache file content +set file content = setJournalFile file content {- Stages the journal, and commits staged changes to the branch. -} commit :: String -> Annex () |