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
|
@ -293,7 +293,7 @@ toHereStart removewhen afile key ai si =
|
|||
- repository reduces the number of copies, and should fail if
|
||||
- that would violate numcopies settings.
|
||||
-
|
||||
- On the other hand, when the destiation repository does not already
|
||||
- On the other hand, when the destination repository does not already
|
||||
- have a copy of a file, it can be dropped without making numcopies
|
||||
- worse, so the move is allowed even if numcopies is not met.
|
||||
-
|
||||
|
@ -311,7 +311,7 @@ toHereStart removewhen afile key ai si =
|
|||
-}
|
||||
willDropMakeItWorse :: UUID -> UUID -> DestStartedWithCopy -> Key -> AssociatedFile -> Annex DropCheck
|
||||
willDropMakeItWorse srcuuid destuuid (DestStartedWithCopy deststartedwithcopy) key afile =
|
||||
ifM (Command.Drop.checkRequiredContent srcuuid key afile)
|
||||
ifM (Command.Drop.checkRequiredContent (Command.Drop.PreferredContentChecked False) srcuuid key afile)
|
||||
( if deststartedwithcopy
|
||||
then unlessforced DropCheckNumCopies
|
||||
else ifM checktrustlevel
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue