use MatchingKey when a Key is known
This fixes a bug where a file that was not preferred content could be transferred to a remote. This happened when the file got deleted after the sync started running. The only time checkMatcher is run without a Key is in calls to checkFileMatcher, which are only done by add, addurl, import, and smudge --clean. Those won't be affected by this kind of race. Anything else that might be precaching and have a similar race as sync will also be fixed, but I don't know if it actually affected anything other than sync. As well as fixing a bug, this also probably makes sync and --auto faster by avoiding the redundant key lookup. This commit was sponsored by Graham Spencer on Patreon.
This commit is contained in:
parent
d84371ff73
commit
d032b0885d
3 changed files with 36 additions and 3 deletions
|
@ -72,7 +72,7 @@ checkMatcher :: FileMatcher Annex -> Maybe Key -> AssociatedFile -> AssumeNotPre
|
|||
checkMatcher matcher mkey afile notpresent notconfigured d
|
||||
| isEmpty matcher = notconfigured
|
||||
| otherwise = case (mkey, afile) of
|
||||
(_, AssociatedFile (Just file)) -> go =<< fileMatchInfo file
|
||||
(Nothing, AssociatedFile (Just file)) -> go =<< fileMatchInfo file
|
||||
(Just key, _) -> go (MatchingKey key afile)
|
||||
_ -> d
|
||||
where
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue