avoid ugly error message
Http remotes that do expose a git config file, but are not initialized resulted in an ugly and unncessary error message, now sqelched. When git-annex-shell configlist is run w/o the autoinit field, it may not generate a uuid for the repository. So in that case, it's not unexpected for the config it does list to not include a UUID, and dumping out the config in a warning message is not needed. If configlist is asked to autoinit and we don't get back a config with a UUID in it, that suggests some problem, and what we got back may not be a config at all but some diagnostic message, so it does make sense to output it then.
This commit is contained in:
parent
8cda10777a
commit
d227093002
4 changed files with 49 additions and 4 deletions
|
@ -248,7 +248,7 @@ tryGitConfigRead autoinit r
|
|||
| haveconfig r = return r -- already read
|
||||
| Git.repoIsSsh r = storeUpdatedRemote $ do
|
||||
v <- Ssh.onRemote NoConsumeStdin r
|
||||
(pipedconfig, return (Left $ giveup "configlist failed"))
|
||||
(pipedconfig autoinit, return (Left $ giveup "configlist failed"))
|
||||
"configlist" [] configlistfields
|
||||
case v of
|
||||
Right r'
|
||||
|
@ -263,11 +263,11 @@ tryGitConfigRead autoinit r
|
|||
where
|
||||
haveconfig = not . M.null . Git.config
|
||||
|
||||
pipedconfig cmd params = do
|
||||
pipedconfig mustincludeuuuid cmd params = do
|
||||
v <- liftIO $ Git.Config.fromPipe r cmd params
|
||||
case v of
|
||||
Right (r', val) -> do
|
||||
unless (isUUIDConfigured r' || S.null val) $ do
|
||||
unless (isUUIDConfigured r' || S.null val || not mustincludeuuuid) $ do
|
||||
warning $ "Failed to get annex.uuid configuration of repository " ++ Git.repoDescribe r
|
||||
warning $ "Instead, got: " ++ show val
|
||||
warning $ "This is unexpected; please check the network transport!"
|
||||
|
@ -279,7 +279,7 @@ tryGitConfigRead autoinit r
|
|||
liftIO $ hClose h
|
||||
let url = Git.repoLocation r ++ "/config"
|
||||
ifM (liftIO $ Url.downloadQuiet nullMeterUpdate url tmpfile uo)
|
||||
( Just <$> pipedconfig "git" [Param "config", Param "--null", Param "--list", Param "--file", File tmpfile]
|
||||
( Just <$> pipedconfig False "git" [Param "config", Param "--null", Param "--list", Param "--file", File tmpfile]
|
||||
, return Nothing
|
||||
)
|
||||
case v of
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue