From d611c20fe039881461db7b76ca3155d10e9b6a1f Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 14 Oct 2015 12:33:02 -0400 Subject: Changed drop ordering when using git annex sync --content or the assistant, to drop from remotes first and from the local repo last. This works better with the behavior changes to drop in many cases. --- Annex/Drop.hs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'Annex/Drop.hs') diff --git a/Annex/Drop.hs b/Annex/Drop.hs index 791273d8e..aabc1c31f 100644 --- a/Annex/Drop.hs +++ b/Annex/Drop.hs @@ -30,7 +30,10 @@ type Reason = String - The UUIDs are ones where the content is believed to be present. - The Remote list can include other remotes that do not have the content; - only ones that match the UUIDs will be dropped from. - - If allowed to drop fromhere, that drop will be tried first. + - + - If allowed to drop fromhere, that drop will be done last. This is done + - because local drops do not need any LockedCopy evidence, and so dropping + - from local last allows the content to be removed from more remotes. - - A VerifiedCopy can be provided as an optimisation when eg, a key - has just been uploaded to a remote. @@ -52,8 +55,8 @@ handleDropsFrom locs rs reason fromhere key afile preverified runner = do , return $ maybeToList afile ) n <- getcopies fs - if fromhere && checkcopies n Nothing - then go fs rs =<< dropl fs n + void $ if fromhere && checkcopies n Nothing + then go fs rs n >>= dropl fs else go fs rs n where getcopies fs = do @@ -78,12 +81,12 @@ handleDropsFrom locs rs reason fromhere key afile preverified runner = do | S.member u untrusted = v | otherwise = decrcopies v Nothing - go _ [] _ = noop + go _ [] n = pure n go fs (r:rest) n | uuid r `S.notMember` slocs = go fs rest n | checkcopies n (Just $ Remote.uuid r) = dropr fs r n >>= go fs rest - | otherwise = noop + | otherwise = pure n checkdrop fs n u a | null fs = check $ -- no associated files; unused content -- cgit v1.2.3