avoid unfiltered debugging from git-annex-shell

When --debugfilter or annex.debugfilter is set, avoid propigating debug
output from git-annex-shell, since it cannot be filtered.

It would be possible to pass --debugfilter on to git-annex-shell,
but it only started accepting that option in 2022. So it would break
interop with older versions.
This commit is contained in:
Joey Hess 2024-06-27 12:35:35 -04:00
parent 53598e5154
commit 19137ae780
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
2 changed files with 8 additions and 4 deletions

View file

@ -6,6 +6,8 @@ git-annex (10.20240532) UNRELEASED; urgency=medium
* Tab completion of options like --from now includes special remotes.
* Fix Windows build with Win32 2.13.4+
Thanks, Oleg Tolmatcev
* When --debugfilter or annex.debugfilter is set, avoid propigating
debug output from git-annex-shell, since it cannot be filtered.
-- Joey Hess <id@joeyh.name> Mon, 03 Jun 2024 13:03:21 -0400

View file

@ -1,6 +1,6 @@
{- git-annex remote access with ssh and git-annex-shell
-
- Copyright 2011-2022 Joey Hess <id@joeyh.name>
- Copyright 2011-2024 Joey Hess <id@joeyh.name>
-
- Licensed under the GNU AGPL version 3 or higher.
-}
@ -21,6 +21,7 @@ import Remote.Helper.Messages
import Utility.Metered
import Utility.Rsync
import Utility.SshHost
import Utility.Debug
import Types.Remote
import Types.Transfer
import Config
@ -61,9 +62,10 @@ git_annex_shell cs r command params fields
shellcmd = "git-annex-shell"
getshellopts = do
debugenabled <- Annex.getRead Annex.debugenabled
let params' = if debugenabled
then Param "--debug" : params
else params
debugselector <- Annex.getRead Annex.debugselector
let params' = case (debugenabled, debugselector) of
(True, NoDebugSelector) -> Param "--debug" : params
_ -> params
return (Param command : File (fromRawFilePath dir) : params')
uuidcheck NoUUID = []
uuidcheck u@(UUID _) = ["--uuid", fromUUID u]