testremote passes on p2phttp remote

This commit is contained in:
Joey Hess 2024-07-24 14:36:37 -04:00
parent f5624a69e3
commit 515c42e1e3
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
2 changed files with 11 additions and 1 deletions

View file

@ -91,3 +91,9 @@ parseP2PHttpUrl us
p2pHttpUrlWithoutUUID :: String -> String p2pHttpUrlWithoutUUID :: String -> String
p2pHttpUrlWithoutUUID = reverse . dropWhile (/= '/') . reverse p2pHttpUrlWithoutUUID = reverse . dropWhile (/= '/') . reverse
unavailableP2PHttpUrl :: P2PHttpUrl -> P2PHttpUrl
unavailableP2PHttpUrl p = p
#ifdef WITH_SERVANT
{ p2pHttpBaseUrl = (p2pHttpBaseUrl p) { baseUrlHost = "!dne!" } }
#endif

View file

@ -264,7 +264,7 @@ defaultRepoCost r
| otherwise = expensiveRemoteCost | otherwise = expensiveRemoteCost
unavailable :: Git.Repo -> UUID -> RemoteConfig -> RemoteGitConfig -> RemoteStateHandle -> Annex (Maybe Remote) 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 where
r' = case Git.location r of r' = case Git.location r of
Git.Local { Git.gitdir = d } -> Git.Local { Git.gitdir = d } ->
@ -275,6 +275,10 @@ unavailable r = gen r'
in r { Git.location = Git.Url (url { uriAuthority = Just auth' })} in r { Git.location = Git.Url (url { uriAuthority = Just auth' })}
Nothing -> r { Git.location = Git.Unknown } Nothing -> r { Git.location = Git.Unknown }
_ -> r -- already unavailable _ -> r -- already unavailable
gc' = gc
{ remoteAnnexP2PHttpUrl =
unavailableP2PHttpUrl <$> remoteAnnexP2PHttpUrl gc
}
{- Tries to read the config for a specified remote, updates state, and {- Tries to read the config for a specified remote, updates state, and
- returns the updated repo. -} - returns the updated repo. -}