avoid redundant prompt for http password in git-annex get that does autoinit

autoEnableSpecialRemotes runs a subprocess, and if the uuid for a git
remote has not been probed yet, that will do a http get that will prompt
for a password. And then the parent process will subsequently prompt
for a password when getting annexed files from the remote.

So the solution is for autoEnableSpecialRemotes to run remoteList before
the subprocess, which will probe for the uuid for the git remote in the
same process that will later be used to get annexed files.

But, Remote.Git imports Annex.Init, and Remote.List imports Remote.Git,
so Annex.Init cannot import Remote.List. Had to pass remoteList into
functions in Annex.Init to get around this dependency loop.
This commit is contained in:
Joey Hess 2022-09-09 14:43:43 -04:00
parent 9621beabc4
commit c62fe5e9a8
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
6 changed files with 44 additions and 13 deletions

View file

@ -350,7 +350,7 @@ tryGitConfigRead autoinit r hasuuid
readlocalannexconfig = do
let check = do
Annex.BranchState.disableUpdate
catchNonAsync autoInitialize $ \e ->
catchNonAsync (autoInitialize (pure [])) $ \e ->
warning $ "remote " ++ Git.repoDescribe r ++
":" ++ show e
Annex.getState Annex.repo
@ -605,7 +605,7 @@ repairRemote r a = return $ do
s <- Annex.new r
Annex.eval s $ do
Annex.BranchState.disableUpdate
ensureInitialized
ensureInitialized (pure [])
a `finally` stopCoProcesses
data LocalRemoteAnnex = LocalRemoteAnnex Git.Repo (MVar [(Annex.AnnexState, Annex.AnnexRead)])
@ -647,7 +647,7 @@ onLocal' (LocalRemoteAnnex repo mv) a = liftIO (takeMVar mv) >>= \case
[] -> do
liftIO $ putMVar mv []
v <- newLocal repo
go (v, ensureInitialized >> a)
go (v, ensureInitialized (pure []) >> a)
(v:rest) -> do
liftIO $ putMVar mv rest
go (v, a)