prevent dropping required content of other file using same content
authorJoey Hess <joeyh@joeyh.name>
Tue, 25 May 2021 14:57:06 +0000 (10:57 -0400)
committerJoey Hess <joeyh@joeyh.name>
Tue, 25 May 2021 15:34:06 +0000 (11:34 -0400)
commitcedc28a78347b942034559a374e524e99376a14c
treef343ef85923bab6a104b3a013600550efaec6bf4
parent7029ef1c3d4e3b5ce31548ab591d06294607d244
prevent dropping required content of other file using same content

When two files have the same content, and a required content expression
matches one but not the other, dropping the latter file will fail as it
would also remove the content of the required file.

This will slow down drop (w/o --auto), dropunused, mirror, and move, by one
keys db lookup per file. But I did include an optimisation to avoid a
double db lookup in the drop --auto / sync --content case. I suspect that
dropunused could also use PreferredContentChecked True, but haven't
entirely thought it through and it's rarely used with enough files for the
optimisation to matter.

Sponsored-by: Dartmouth College's Datalad project
Annex/Drop.hs
Annex/Wanted.hs
CHANGELOG
Command/Drop.hs
Command/DropUnused.hs
Command/Mirror.hs
Command/Move.hs
Logs/PreferredContent.hs
Test.hs