From 515c42e1e35c17c884aec8e6d530dfa33c29ed93 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 24 Jul 2024 14:36:37 -0400 Subject: [PATCH] testremote passes on p2phttp remote --- P2P/Http/Url.hs | 6 ++++++ Remote/Git.hs | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/P2P/Http/Url.hs b/P2P/Http/Url.hs index 92439623fb..6d308741c9 100644 --- a/P2P/Http/Url.hs +++ b/P2P/Http/Url.hs @@ -91,3 +91,9 @@ parseP2PHttpUrl us p2pHttpUrlWithoutUUID :: String -> String p2pHttpUrlWithoutUUID = reverse . dropWhile (/= '/') . reverse + +unavailableP2PHttpUrl :: P2PHttpUrl -> P2PHttpUrl +unavailableP2PHttpUrl p = p +#ifdef WITH_SERVANT + { p2pHttpBaseUrl = (p2pHttpBaseUrl p) { baseUrlHost = "!dne!" } } +#endif diff --git a/Remote/Git.hs b/Remote/Git.hs index ceccacc66e..93a0c89c7a 100644 --- a/Remote/Git.hs +++ b/Remote/Git.hs @@ -264,7 +264,7 @@ defaultRepoCost r | otherwise = expensiveRemoteCost unavailable :: Git.Repo -> UUID -> RemoteConfig -> RemoteGitConfig -> RemoteStateHandle -> Annex (Maybe Remote) -unavailable r = gen r' +unavailable r u c gc = gen r' u c gc' where r' = case Git.location r of Git.Local { Git.gitdir = d } -> @@ -275,6 +275,10 @@ unavailable r = gen r' in r { Git.location = Git.Url (url { uriAuthority = Just auth' })} Nothing -> r { Git.location = Git.Unknown } _ -> r -- already unavailable + gc' = gc + { remoteAnnexP2PHttpUrl = + unavailableP2PHttpUrl <$> remoteAnnexP2PHttpUrl gc + } {- Tries to read the config for a specified remote, updates state, and - returns the updated repo. -}