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
This commit is contained in:
parent
7029ef1c3d
commit
cedc28a783
9 changed files with 105 additions and 60 deletions
|
@ -69,7 +69,7 @@ startKey o afile (si, key, ai) = case fromToOptions o of
|
|||
( Command.Move.toStart Command.Move.RemoveNever afile key ai si =<< getParsed r
|
||||
, do
|
||||
(numcopies, mincopies) <- getnummincopies
|
||||
Command.Drop.startRemote afile ai si numcopies mincopies key =<< getParsed r
|
||||
Command.Drop.startRemote pcc afile ai si numcopies mincopies key =<< getParsed r
|
||||
)
|
||||
FromRemote r -> checkFailedTransferDirection ai Download $ do
|
||||
haskey <- flip Remote.hasKey key =<< getParsed r
|
||||
|
@ -82,10 +82,11 @@ startKey o afile (si, key, ai) = case fromToOptions o of
|
|||
Right False -> ifM (inAnnex key)
|
||||
( do
|
||||
(numcopies, mincopies) <- getnummincopies
|
||||
Command.Drop.startLocal afile ai si numcopies mincopies key []
|
||||
Command.Drop.startLocal pcc afile ai si numcopies mincopies key []
|
||||
, stop
|
||||
)
|
||||
where
|
||||
getnummincopies = case afile of
|
||||
AssociatedFile Nothing -> (,) <$> getNumCopies <*> getMinCopies
|
||||
AssociatedFile (Just af) -> getFileNumMinCopies af
|
||||
pcc = Command.Drop.PreferredContentChecked False
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue