display explanations in --debug too
When --explain is not enabled. This can be useful debugging information as well. Sponsored-by: Dartmouth College's DANDI project
This commit is contained in:
parent
846384fc3a
commit
473d66132d
2 changed files with 12 additions and 7 deletions
|
@ -1,6 +1,6 @@
|
||||||
{- git-annex debugging
|
{- git-annex debugging
|
||||||
-
|
-
|
||||||
- Copyright 2021 Joey Hess <id@joeyh.name>
|
- Copyright 2021-2023 Joey Hess <id@joeyh.name>
|
||||||
-
|
-
|
||||||
- Licensed under the GNU AGPL version 3 or higher.
|
- Licensed under the GNU AGPL version 3 or higher.
|
||||||
-}
|
-}
|
||||||
|
@ -10,6 +10,7 @@ module Annex.Debug (
|
||||||
DebugSource(..),
|
DebugSource(..),
|
||||||
debug,
|
debug,
|
||||||
fastDebug,
|
fastDebug,
|
||||||
|
fastDebug',
|
||||||
configureDebug,
|
configureDebug,
|
||||||
debugSelectorFromGitConfig,
|
debugSelectorFromGitConfig,
|
||||||
parseDebugSelector,
|
parseDebugSelector,
|
||||||
|
@ -27,5 +28,8 @@ import Annex.Debug.Utility
|
||||||
fastDebug :: DebugSource -> String -> Annex.Annex ()
|
fastDebug :: DebugSource -> String -> Annex.Annex ()
|
||||||
fastDebug src msg = do
|
fastDebug src msg = do
|
||||||
rd <- Annex.getRead id
|
rd <- Annex.getRead id
|
||||||
when (Annex.debugenabled rd) $
|
fastDebug' rd src msg
|
||||||
liftIO $ Utility.Debug.fastDebug (Annex.debugselector rd) src msg
|
|
||||||
|
fastDebug' :: Annex.AnnexRead -> DebugSource -> String -> Annex.Annex ()
|
||||||
|
fastDebug' rd src msg = when (Annex.debugenabled rd) $
|
||||||
|
liftIO $ Utility.Debug.fastDebug (Annex.debugselector rd) src msg
|
||||||
|
|
|
@ -303,10 +303,11 @@ jsonOutputEnabled = withMessageState $ \s -> return $
|
||||||
explain :: ActionItem -> Maybe StringContainingQuotedPath -> Annex ()
|
explain :: ActionItem -> Maybe StringContainingQuotedPath -> Annex ()
|
||||||
explain ai (Just msg) = do
|
explain ai (Just msg) = do
|
||||||
rd <- Annex.getRead id
|
rd <- Annex.getRead id
|
||||||
when (Annex.explainenabled rd) $
|
let d = actionItemDesc ai
|
||||||
let d = actionItemDesc ai
|
let msg' = "[ " <> (if d == mempty then "" else (d <> " ")) <> msg <> " ]\n"
|
||||||
in outputMessage JSON.none id $
|
if Annex.explainenabled rd
|
||||||
"[ " <> (if d == mempty then "" else (d <> " ")) <> msg <> " ]\n"
|
then outputMessage JSON.none id msg'
|
||||||
|
else fastDebug' rd "Messages.explain" (decodeBS (noquote msg'))
|
||||||
explain _ _ = return ()
|
explain _ _ = return ()
|
||||||
|
|
||||||
{- Prevents any concurrent console access while running an action, so
|
{- Prevents any concurrent console access while running an action, so
|
||||||
|
|
Loading…
Add table
Reference in a new issue