Improved display of errors when accessing a git http remote fails.

New error message:

  Remote foo not usable by git-annex; setting annex-ignore

  http://localhost/foo/config download failed: Configuration of annex.security.allowed-ip-addresses does not allow accessing address ::1

If git config parse fails, or the git config file is not available at the url,
a better error message for that is also shown.

This commit was sponsored by Mark Reidenbach on Patreon.
This commit is contained in:
Joey Hess 2021-03-24 14:19:32 -04:00
parent fdf1ccbe3f
commit 537f9d9a11
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
5 changed files with 28 additions and 16 deletions

View file

@ -30,7 +30,6 @@ module Utility.Url (
getUrlInfo,
assumeUrlExists,
download,
downloadQuiet,
downloadConduit,
sinkResponseFile,
downloadPartial,
@ -364,11 +363,6 @@ headRequest r = r
download :: MeterUpdate -> URLString -> FilePath -> UrlOptions -> IO (Either String ())
download = download' False
{- Avoids displaying any error message, including silencing curl errors. -}
downloadQuiet :: MeterUpdate -> URLString -> FilePath -> UrlOptions -> IO Bool
downloadQuiet meterupdate url file uo = isRight
<$> download' True meterupdate url file uo
download' :: Bool -> MeterUpdate -> URLString -> FilePath -> UrlOptions -> IO (Either String ())
download' nocurlerror meterupdate url file uo =
catchJust matchHttpException go showhttpexception