Avoid unncessary write to the location log when a file is unlocked and then added back with unchanged content.

Implemented with no additional overhead of compares etc.

This is safe to do for presence logs because of their locality of change;
a given repo's presence logs are only ever changed in that repo, or in a
repo that has just been actively changing the content of that repo.

So, we don't need to worry about a split-brain situation where there'd
be disagreement about the location of a key in a repo. And so, it's ok to
not update the timestamp when that's the only change that would be made
due to logging presence info.
This commit is contained in:
Joey Hess 2015-10-12 14:46:28 -04:00
parent 82ba8c9a6a
commit f9adb905fc
Failed to extract signature
7 changed files with 65 additions and 14 deletions

View file

@ -48,7 +48,7 @@ logChange = logChange' logNow
logChange' :: (LogStatus -> String -> Annex LogLine) -> Key -> UUID -> LogStatus -> Annex ()
logChange' mklog key (UUID u) s = do
config <- Annex.getGitConfig
addLog (locationLogFile config key) =<< mklog s u
maybeAddLog (locationLogFile config key) =<< mklog s u
logChange' _ _ NoUUID _ = noop
{- Returns a list of repository UUIDs that, according to the log, have