3518c586cf
Several places assumed this would not happen, and when the AssociatedFile was Nothing, did nothing. As part of this, preferred content checks pass the Key around. Note that checkMatcher is sometimes now called with Just Key and Just File. It currently constructs a FileMatcher, ignoring the Key. However, if it constructed a FileKeyMatcher, which contained both, then it might be possible to speed up parts of Limit, which currently call the somewhat expensive lookupFileKey to get the Key. I have not made this optimisation yet, because I am not sure if the key is always the same. Will need some significant checking to satisfy myself that's the case..
25 lines
792 B
Haskell
25 lines
792 B
Haskell
{- git-annex assistant dropping of unwanted content
|
|
-
|
|
- Copyright 2012 Joey Hess <joey@kitenet.net>
|
|
-
|
|
- Licensed under the GNU GPL version 3 or higher.
|
|
-}
|
|
|
|
module Assistant.Drop (
|
|
handleDrops,
|
|
handleDropsFrom,
|
|
) where
|
|
|
|
import Assistant.Common
|
|
import Assistant.DaemonStatus
|
|
import Annex.Drop (handleDropsFrom, Reason)
|
|
import Logs.Location
|
|
import RunCommand
|
|
|
|
{- Drop from local and/or remote when allowed by the preferred content and
|
|
- numcopies settings. -}
|
|
handleDrops :: Reason -> Bool -> Key -> AssociatedFile -> Maybe Remote -> Assistant ()
|
|
handleDrops reason fromhere key f knownpresentremote = do
|
|
syncrs <- syncDataRemotes <$> getDaemonStatus
|
|
locs <- liftAnnex $ loggedLocations key
|
|
liftAnnex $ handleDropsFrom locs syncrs reason fromhere key f knownpresentremote callCommand
|