clean up url removal presence update
* rmurl: Fix a case where removing the last url left git-annex thinking content was still present in the web special remote. * SETURLPRESENT, SETURIPRESENT, SETURLMISSING, and SETURIMISSING used to update the presence information of the external special remote that called them; this was not documented behavior and is no longer done. Done by making setUrlPresent and setUrlMissing only update presence info for the web, and only when the url is a web url. See the comment for reasoning about why that's the right thing to do. In AddUrl, had to make it update location tracking, to handle the non-web-url case. This commit was sponsored by Ewen McNeill on Patreon.
This commit is contained in:
parent
ca66e7b66a
commit
451171b7c1
14 changed files with 77 additions and 26 deletions
26
Logs/Web.hs
26
Logs/Web.hs
|
@ -56,20 +56,32 @@ getUrlsWithPrefix key prefix = filter (prefix `isPrefixOf`)
|
|||
. map (fst . getDownloader)
|
||||
<$> getUrls key
|
||||
|
||||
setUrlPresent :: UUID -> Key -> URLString -> Annex ()
|
||||
setUrlPresent uuid key url = do
|
||||
setUrlPresent :: Key -> URLString -> Annex ()
|
||||
setUrlPresent key url = do
|
||||
us <- getUrls key
|
||||
unless (url `elem` us) $ do
|
||||
config <- Annex.getGitConfig
|
||||
addLog (urlLogFile config key) =<< logNow InfoPresent url
|
||||
logChange key uuid InfoPresent
|
||||
-- If the url does not have an OtherDownloader, it must be present
|
||||
-- in the web.
|
||||
case snd (getDownloader url) of
|
||||
OtherDownloader -> return ()
|
||||
_ -> logChange key webUUID InfoPresent
|
||||
|
||||
setUrlMissing :: UUID -> Key -> URLString -> Annex ()
|
||||
setUrlMissing uuid key url = do
|
||||
setUrlMissing :: Key -> URLString -> Annex ()
|
||||
setUrlMissing key url = do
|
||||
config <- Annex.getGitConfig
|
||||
addLog (urlLogFile config key) =<< logNow InfoMissing url
|
||||
whenM (null <$> getUrls key) $
|
||||
logChange key uuid InfoMissing
|
||||
-- If the url was a web url (not OtherDownloader) and none of
|
||||
-- the remaining urls for the key are web urls, the key must not
|
||||
-- be present in the web.
|
||||
when (isweb url) $
|
||||
whenM (null . filter isweb <$> getUrls key) $
|
||||
logChange key webUUID InfoMissing
|
||||
where
|
||||
isweb u = case snd (getDownloader u) of
|
||||
OtherDownloader -> False
|
||||
_ -> True
|
||||
|
||||
{- Finds all known urls. -}
|
||||
knownUrls :: Annex [(Key, URLString)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue