Make import --deduplicate and --skip-duplicates only hash once, not twice
authorJoey Hess <joeyh@joeyh.name>
Thu, 9 Feb 2017 19:32:22 +0000 (15:32 -0400)
committerJoey Hess <joeyh@joeyh.name>
Thu, 9 Feb 2017 19:32:22 +0000 (15:32 -0400)
commitf617988a29a241bd6eb062f947709b8fc934e0ac
tree1d5aad5b7d9a4b0a2e4c7e92b8c2659227d1d1d7
parent30ab4ecc4bd6d09235141bd7b2fff61e4edb1eac
Make import --deduplicate and --skip-duplicates only hash once, not twice

import: --deduplicate and --skip-duplicates were implemented inneficiently;
they unncessarily hashed each file twice. They have been improved to only
hash once.

The new approach is to lock down (minimally) and hash files, and then
reuse that information when importing them.

This was rather tricky, especially in detecting changes to files while
they are being imported.

The output of import changed slightly. While before it silently skipped
over files with eg --skip-duplicates, now it shows each file as it starts
to act on it. Since every file is hashed first thing, it would otherwise
not be clear what file import is chewing on. (Actually, it wasn't clear
before when any of the duplicates switches were used.)

This commit was sponsored by Alexander Thompson on Patreon.
Annex/Ingest.hs
Assistant/Threads/Committer.hs
CHANGELOG
Command/Import.hs
Command/Smudge.hs