avoid nub

It's O(N^2) which could matter when there are many dup files using the
same key.
This commit is contained in:
Joey Hess 2021-06-15 10:48:11 -04:00
parent b3712b6047
commit 77517ab506
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View file

@ -55,7 +55,7 @@ handleDropsFrom locs rs reason fromhere key afile si preverified runner = do
l <- map (`fromTopFilePath` g) l <- map (`fromTopFilePath` g)
<$> Database.Keys.getAssociatedFiles key <$> Database.Keys.getAssociatedFiles key
let fs = case afile of let fs = case afile of
AssociatedFile (Just f) -> nub (f : l) AssociatedFile (Just f) -> f : filter (/= f) l
AssociatedFile Nothing -> l AssociatedFile Nothing -> l
n <- getcopies fs n <- getcopies fs
void $ if fromhere && checkcopies n Nothing void $ if fromhere && checkcopies n Nothing