use MatchingKey when a Key is known
authorJoey Hess <joeyh@joeyh.name>
Mon, 9 Nov 2020 19:12:08 +0000 (15:12 -0400)
committerJoey Hess <joeyh@joeyh.name>
Mon, 9 Nov 2020 19:17:22 +0000 (15:17 -0400)
commitd032b0885d80d12c00fa8813e88deab1631eef8a
tree2c1c19d1dd22c9c6f371c69a89b4c3f275282803
parentd84371ff73ae224b6c300575ad32632e194774bb
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.
Annex/FileMatcher.hs
CHANGELOG
doc/bugs/sync_content_copies_unwanted_removed_files.mdwn