Make --debug also enable debugging in child git-annex processes

Especially necessary with stalldetection using child processes for
transfers.

This commit was sponsored by Jack Hill on Patreon.
This commit is contained in:
Joey Hess 2021-03-22 14:25:28 -04:00
parent 1ddaa6b541
commit 5545e78a1e
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
4 changed files with 19 additions and 7 deletions

View file

@ -69,7 +69,8 @@ gitAnnexChildProcess subcmd ps f a = do
{- Parameters to pass to a git-annex child process to run a subcommand {- Parameters to pass to a git-annex child process to run a subcommand
- with some parameters. - with some parameters.
- -
- Includes -c values that were passed on the git-annex command line. - Includes -c values that were passed on the git-annex command line
- or due to --debug being enabled.
-} -}
gitAnnexChildProcessParams :: String -> [CommandParam] -> Annex [CommandParam] gitAnnexChildProcessParams :: String -> [CommandParam] -> Annex [CommandParam]
gitAnnexChildProcessParams subcmd ps = do gitAnnexChildProcessParams subcmd ps = do

View file

@ -15,6 +15,7 @@ git-annex (8.20210311) UNRELEASED; urgency=medium
* unregisterurl: Fix a bug that caused an url to not be unregistered * unregisterurl: Fix a bug that caused an url to not be unregistered
when it is claimed by a special remote other than the web. when it is claimed by a special remote other than the web.
* Work around some buggy webdav server behavior involving renaming files. * Work around some buggy webdav server behavior involving renaming files.
* Make --debug also enable debugging in child git-annex processes.
-- Joey Hess <id@joeyh.name> Fri, 12 Mar 2021 12:06:37 -0400 -- Joey Hess <id@joeyh.name> Fri, 12 Mar 2021 12:06:37 -0400

View file

@ -1,20 +1,25 @@
{- common command-line options {- common command-line options
- -
- Copyright 2010-2011 Joey Hess <id@joeyh.name> - Copyright 2010-2021 Joey Hess <id@joeyh.name>
- -
- Licensed under the GNU AGPL version 3 or higher. - Licensed under the GNU AGPL version 3 or higher.
-} -}
{-# LANGUAGE OverloadedStrings #-}
module CmdLine.Option where module CmdLine.Option where
import Options.Applicative import Options.Applicative
import Annex.Common
import CmdLine.Usage import CmdLine.Usage
import CmdLine.GlobalSetter import CmdLine.GlobalSetter
import qualified Annex import qualified Annex
import Types.Messages import Types.Messages
import Types.DeferredParse import Types.DeferredParse
import Types.GitConfig
import Git.Types (ConfigKey(..))
import Git.Config
import Utility.FileSystemEncoding
-- Global options accepted by both git-annex and git-annex-shell sub-commands. -- Global options accepted by both git-annex and git-annex-shell sub-commands.
commonGlobalOptions :: [GlobalOption] commonGlobalOptions :: [GlobalOption]
@ -39,12 +44,12 @@ commonGlobalOptions =
<> help "allow verbose output (default)" <> help "allow verbose output (default)"
<> hidden <> hidden
) )
, globalFlag setdebug , globalFlag (setdebug True)
( long "debug" <> short 'd' ( long "debug" <> short 'd'
<> help "show debug messages" <> help "show debug messages"
<> hidden <> hidden
) )
, globalFlag unsetdebug , globalFlag (setdebug False)
( long "no-debug" ( long "no-debug"
<> help "don't show debug messages" <> help "don't show debug messages"
<> hidden <> hidden
@ -59,5 +64,8 @@ commonGlobalOptions =
setforce v = Annex.changeState $ \s -> s { Annex.force = v } setforce v = Annex.changeState $ \s -> s { Annex.force = v }
setfast v = Annex.changeState $ \s -> s { Annex.fast = v } setfast v = Annex.changeState $ \s -> s { Annex.fast = v }
setforcebackend v = Annex.changeState $ \s -> s { Annex.forcebackend = Just v } setforcebackend v = Annex.changeState $ \s -> s { Annex.forcebackend = Just v }
setdebug = Annex.overrideGitConfig $ \c -> c { annexDebug = True } -- Overriding this way, rather than just setting annexDebug
unsetdebug = Annex.overrideGitConfig $ \c -> c { annexDebug = False } -- makes the config be passed on to any git-annex child processes.
setdebug b = Annex.addGitConfigOverride $ decodeBS' $
debugconfig <> "=" <> boolConfig' b
(ConfigKey debugconfig) = annexConfig "debug"

View file

@ -24,3 +24,5 @@ I'm on RHEL7 and this problem is present in git master for me ever since the int
### Have you had any luck using git-annex before? (Sometimes we get tired of reading bug reports all day and a lil' positive end note does wonders) ### Have you had any luck using git-annex before? (Sometimes we get tired of reading bug reports all day and a lil' positive end note does wonders)
I've written ESRPs and recovered many lost files =) I've written ESRPs and recovered many lost files =)
> [[fixed|done]] --[[Joey]]