From e676cd43c0523bd47c16efb898d5e3e7a0362557 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 26 Jul 2021 11:39:57 -0400 Subject: [PATCH] propagate debugging into remote's Annex monad This is needed to make the debugging added in 00733848509940d81026c24919a909acc6dfa21e actually be displayed when running git-annex get from a local remote. --- Remote/Git.hs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/Remote/Git.hs b/Remote/Git.hs index bd659184c7..37d009d3f1 100644 --- a/Remote/Git.hs +++ b/Remote/Git.hs @@ -269,7 +269,7 @@ tryGitConfigRead autoinit r hasuuid set_ignore "uses a protocol not supported by git-annex" False return r | otherwise = storeUpdatedRemote $ - liftIO readlocalannexconfig + readlocalannexconfig `catchNonAsync` const failedreadlocalconfig where haveconfig = not . M.null . Git.config @@ -355,8 +355,8 @@ tryGitConfigRead autoinit r hasuuid warning $ "remote " ++ Git.repoDescribe r ++ ":" ++ show e Annex.getState Annex.repo - s <- Annex.new r - Annex.eval s $ check `finally` stopCoProcesses + s <- newLocal r + liftIO $ Annex.eval s $ check `finally` stopCoProcesses failedreadlocalconfig = do unless hasuuid $ case Git.remoteName r of @@ -773,10 +773,20 @@ onLocalRepo repo a = do lra <- mkLocalRemoteAnnex repo onLocal' lra a +newLocal :: Git.Repo -> Annex (Annex.AnnexState, Annex.AnnexRead) +newLocal repo = do + (st, rd) <- liftIO $ Annex.new repo + debugenabled <- Annex.getRead Annex.debugenabled + debugselector <- Annex.getRead Annex.debugselector + return (st, rd + { Annex.debugenabled = debugenabled + , Annex.debugselector = debugselector + }) + onLocal' :: LocalRemoteAnnex -> Annex a -> Annex a onLocal' (LocalRemoteAnnex repo mv) a = liftIO (takeMVar mv) >>= \case Nothing -> do - v <- liftIO $ Annex.new repo + v <- newLocal repo go (v, ensureInitialized >> a) Just v -> go (v, a) where