fix fastDebug to check if debugging is actually enabled

Had to add to AnnexRead an indication of whether debugging is enabled.

Could have just made setupConsole not install a debug output action that
outputs, and have enableDebug be what installs that, but then in the
common case where there is no debug selector, and so all debug output is
selected, it would run the debug output action every time, which entails
an IORef access. Which would make fastDebug too slow..
This commit is contained in:
Joey Hess 2021-04-06 16:28:37 -04:00
parent 13c090b37a
commit 2e9d4ac754
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
5 changed files with 19 additions and 14 deletions

View file

@ -142,14 +142,14 @@ subCmdName argv = (name, args)
| otherwise = (Just a, reverse c ++ as)
-- | Note that the GlobalSetter must have already had its annexReadSetter
-- applied before entering the Annex monad; that cannot be changed while
-- running in the Annex monad.
-- applied before entering the Annex monad to run this; that cannot be
-- changed while running in the Annex monad.
prepRunCommand :: Command -> GlobalSetter -> Annex ()
prepRunCommand cmd globalsetter = do
when (cmdnomessages cmd) $
Annex.setOutput QuietOutput
annexStateSetter globalsetter
whenM (annexDebug <$> Annex.getGitConfig) $
whenM (Annex.getRead Annex.debugenabled) $
enableDebugOutput
findAddonCommand :: Maybe String -> IO (Maybe Command)