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:
parent
fdf1ccbe3f
commit
537f9d9a11
5 changed files with 28 additions and 16 deletions
|
@ -260,7 +260,9 @@ tryGitConfigRead autoinit r hasuuid
|
|||
| haveconfig r = return r -- already read
|
||||
| Git.repoIsSsh r = storeUpdatedRemote $ do
|
||||
v <- Ssh.onRemote NoConsumeStdin r
|
||||
(pipedconfig Git.Config.ConfigList autoinit (Git.repoDescribe r), return (Left $ giveup "configlist failed"))
|
||||
( pipedconfig Git.Config.ConfigList autoinit (Git.repoDescribe r)
|
||||
, return (Left "configlist failed")
|
||||
)
|
||||
"configlist" [] configlistfields
|
||||
case v of
|
||||
Right r'
|
||||
|
@ -289,25 +291,32 @@ tryGitConfigRead autoinit r hasuuid
|
|||
return $ Right r'
|
||||
Left l -> do
|
||||
warning $ "Unable to parse git config from " ++ configloc
|
||||
return $ Left l
|
||||
return $ Left (show l)
|
||||
|
||||
geturlconfig = Url.withUrlOptionsPromptingCreds $ \uo -> do
|
||||
let url = Git.repoLocation r ++ "/config"
|
||||
v <- withTmpFile "git-annex.tmp" $ \tmpfile h -> do
|
||||
liftIO $ hClose h
|
||||
let url = Git.repoLocation r ++ "/config"
|
||||
ifM (liftIO $ Url.downloadQuiet nullMeterUpdate url tmpfile uo)
|
||||
( Just <$> pipedconfig Git.Config.ConfigNullList False url "git" [Param "config", Param "--null", Param "--list", Param "--file", File tmpfile]
|
||||
, return Nothing
|
||||
)
|
||||
Url.download' nullMeterUpdate url tmpfile uo >>= \case
|
||||
Right () -> pipedconfig Git.Config.ConfigNullList
|
||||
False url "git"
|
||||
[ Param "config"
|
||||
, Param "--null"
|
||||
, Param "--list"
|
||||
, Param "--file"
|
||||
, File tmpfile
|
||||
]
|
||||
Left err -> return (Left err)
|
||||
case v of
|
||||
Just (Right r') -> do
|
||||
Right r' -> do
|
||||
-- Cache when http remote is not bare for
|
||||
-- optimisation.
|
||||
unless (Git.Config.isBare r') $
|
||||
setremote setRemoteBare False
|
||||
return r'
|
||||
_ -> do
|
||||
Left err -> do
|
||||
set_ignore "not usable by git-annex" False
|
||||
warning $ url ++ " " ++ err
|
||||
return r
|
||||
|
||||
{- Is this remote just not available, or does
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue