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:
parent
13c090b37a
commit
2e9d4ac754
5 changed files with 19 additions and 14 deletions
|
@ -45,12 +45,12 @@ commonGlobalOptions =
|
|||
<> help "allow verbose output (default)"
|
||||
<> hidden
|
||||
)
|
||||
, globalFlag (setAnnexState $ setdebug True)
|
||||
, globalFlag (setdebug True)
|
||||
( long "debug" <> short 'd'
|
||||
<> help "show debug messages"
|
||||
<> hidden
|
||||
)
|
||||
, globalFlag (setAnnexState $ setdebug False)
|
||||
, globalFlag (setdebug False)
|
||||
( long "no-debug"
|
||||
<> help "don't show debug messages"
|
||||
<> hidden
|
||||
|
@ -74,15 +74,17 @@ commonGlobalOptions =
|
|||
setforcebackend v = setAnnexState $
|
||||
Annex.changeState $ \s -> s { Annex.forcebackend = Just v }
|
||||
|
||||
-- Overriding this way, rather than just setting annexDebug
|
||||
-- makes the config be passed on to any git-annex child processes.
|
||||
setdebug v = Annex.addGitConfigOverride $
|
||||
decodeBS' $ debugconfig <> "=" <> boolConfig' v
|
||||
setdebug v = mconcat
|
||||
[ setAnnexRead $ \rd -> rd { Annex.debugenabled = v }
|
||||
-- Also set in git config so it will be passed on to any
|
||||
-- git-annex child processes.
|
||||
, setAnnexState $ Annex.addGitConfigOverride $
|
||||
decodeBS' $ debugconfig <> "=" <> boolConfig' v
|
||||
]
|
||||
|
||||
setdebugfilter v = mconcat
|
||||
[ setAnnexRead $ \rd -> rd
|
||||
{ Annex.debugselector = parseDebugSelector v
|
||||
}
|
||||
{ Annex.debugselector = parseDebugSelector v }
|
||||
-- Also set in git config so it will be passed on to any
|
||||
-- git-annex child processes.
|
||||
, setAnnexState $ Annex.addGitConfigOverride $
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue