diff options
author | 2015-01-28 17:17:26 -0400 | |
---|---|---|
committer | 2015-01-28 17:17:26 -0400 | |
commit | 20a8350e36f6e38b55603e6578fa7b1c4967c1a9 (patch) | |
tree | 6c6b884cbc52496d614be996d702e0b8f6dc9300 /Logs/MetaData.hs | |
parent | 6e765717650f0270cdc497d38245bcbc4180e60c (diff) |
implement annex.tune.branchhash1
I hope this doesn't impact speed much -- it does have to pull out a value
from Annex state every time it accesses the branch now.
The test case I dropped has never caught any problems that I can remember,
and would have been rather difficult to convert.
Diffstat (limited to 'Logs/MetaData.hs')
-rw-r--r-- | Logs/MetaData.hs | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/Logs/MetaData.hs b/Logs/MetaData.hs index 3091935cf..ed4e2363e 100644 --- a/Logs/MetaData.hs +++ b/Logs/MetaData.hs @@ -38,6 +38,7 @@ import Common.Annex import Types.MetaData import Annex.MetaData.StandardFields import qualified Annex.Branch +import qualified Annex import Logs import Logs.SingleValue @@ -52,7 +53,9 @@ instance SingleValueSerializable MetaData where deserialize = Types.MetaData.deserialize getMetaDataLog :: Key -> Annex (Log MetaData) -getMetaDataLog = readLog . metaDataLogFile +getMetaDataLog key = do + config <- Annex.getGitConfig + readLog $ metaDataLogFile config key {- Go through the log from oldest to newest, and combine it all - into a single MetaData representing the current state. @@ -97,10 +100,12 @@ addMetaData k metadata = addMetaData' k metadata =<< liftIO getPOSIXTime addMetaData' :: Key -> MetaData -> POSIXTime -> Annex () addMetaData' k d@(MetaData m) now | d == emptyMetaData = noop - | otherwise = Annex.Branch.change (metaDataLogFile k) $ - showLog . simplifyLog - . S.insert (LogEntry now metadata) - . parseLog + | otherwise = do + config <- Annex.getGitConfig + Annex.Branch.change (metaDataLogFile config k) $ + showLog . simplifyLog + . S.insert (LogEntry now metadata) + . parseLog where metadata = MetaData $ M.filterWithKey (\f _ -> not (isLastChangedField f)) m @@ -181,6 +186,7 @@ copyMetaData oldkey newkey | oldkey == newkey = noop | otherwise = do l <- getMetaDataLog oldkey - unless (S.null l) $ - Annex.Branch.change (metaDataLogFile newkey) $ + unless (S.null l) $ do + config <- Annex.getGitConfig + Annex.Branch.change (metaDataLogFile config newkey) $ const $ showLog l |