Revert "--json-exceptions"
authorJoey Hess <joeyh@joeyh.name>
Tue, 25 Apr 2023 21:37:34 +0000 (17:37 -0400)
committerJoey Hess <joeyh@joeyh.name>
Tue, 25 Apr 2023 21:37:34 +0000 (17:37 -0400)
This reverts commit a325524454fdc45a61f91844efb3065f6e34b318.

Turns out this was predicated on an incorrect belief that json output
didn't already sometimes lack the "key" field. Since json output already
can when `giveup` was used, it seems unncessary to add a whole new
option for this.

33 files changed:
CHANGELOG
CmdLine/GitAnnex/Options.hs
CmdLine/Seek.hs
Messages.hs
Messages/Internal.hs
Messages/JSON.hs
Messages/Serialized.hs
Types/Messages.hs
doc/git-annex-add.mdwn
doc/git-annex-addurl.mdwn
doc/git-annex-copy.mdwn
doc/git-annex-drop.mdwn
doc/git-annex-dropkey.mdwn
doc/git-annex-examinekey.mdwn
doc/git-annex-export.mdwn
doc/git-annex-find.mdwn
doc/git-annex-findkeys.mdwn
doc/git-annex-fsck.mdwn
doc/git-annex-get.mdwn
doc/git-annex-import.mdwn
doc/git-annex-info.mdwn
doc/git-annex-lock.mdwn
doc/git-annex-metadata.mdwn
doc/git-annex-mirror.mdwn
doc/git-annex-move.mdwn
doc/git-annex-registerurl.mdwn
doc/git-annex-status.mdwn
doc/git-annex-unlock.mdwn
doc/git-annex-unregisterurl.mdwn
doc/git-annex-whereis.mdwn
doc/todo/api_for_telling_when_nonexistant_or_non_git_files_passed/comment_3_3f0872f13160a77a82bd5a95fc3f397d._comment
doc/todo/api_for_telling_when_nonexistant_or_non_git_files_passed/comment_5_105453fbbe7361f3d409ab87079a8a41._comment [deleted file]
doc/todo/api_for_telling_when_nonexistant_or_non_git_files_passed/comment_8_f34293aa30b8b9abc71fac4e713aded3._comment [new file with mode: 0644]

index 5f244e02c9295bef44afde8b82de8552593e1fba..1dd4b21053c40ee4ece08e27b6622532d42745c3 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -25,8 +25,6 @@ git-annex (10.20230408) UNRELEASED; urgency=medium
   * assistant --autostop: Avoid crashing when ~/.config/git-annex/autostart
     lists a directory that it cannot chdir to.
   * Honor --force option when operating on a local git remote.
-  * Added a --json-exceptions option, which makes some exceptions be output
-    in json.
 
  -- Joey Hess <id@joeyh.name>  Sat, 08 Apr 2023 13:57:18 -0400
 
index fde99a5392e2f343c93fc9cb8a6e75e9c67fdcfc..d5364a0a604f884edf5491a38514928042b8b157 100644 (file)
@@ -445,20 +445,13 @@ jsonOptions =
                <> help "include error messages in JSON"
                <> hidden
                )
-       , annexFlag (setAnnexState $ Annex.setOutput (JSONOutput jsonexceptionsoptions))
-               ( long "json-exceptions"
-               <> help "include exceptions in JSON"
-               <> hidden
-               )
        ]
   where
        stdjsonoptions = JSONOptions
                { jsonProgress = False
                , jsonErrorMessages = False
-               , jsonExceptions = False
                }
        jsonerrormessagesoptions = stdjsonoptions { jsonErrorMessages = True }
-       jsonexceptionsoptions = stdjsonoptions { jsonExceptions = True }
 
 jsonProgressOption :: [AnnexOption]
 jsonProgressOption = 
@@ -472,7 +465,6 @@ jsonProgressOption =
        jsonoptions = JSONOptions
                { jsonProgress = True
                , jsonErrorMessages = False
-               , jsonExceptions = False
                }
 
 -- Note that a command that adds this option should wrap its seek
index bd06f55803c44c8b03d441cb0dba54fd1c0ecbca..d2815383a57f6487868b3b2b941481d70da0660e 100644 (file)
@@ -568,9 +568,9 @@ workTreeItems' (AllowHidden allowhidden) ww ps = case ww of
                        let p' = toRawFilePath p
                        relf <- liftIO $ relPathCwdToFile p'
                        ifM (not <$> (exists p' <||> hidden currbranch relf))
-                               ( prob FileNotFound (QuotedPath (toRawFilePath p) <> " not found")
+                               ( prob (QuotedPath (toRawFilePath p) <> " not found")
                                , ifM (viasymlink stopattop (upFrom relf))
-                                       ( prob FileBeyondSymbolicLink (QuotedPath (toRawFilePath p) <> " is beyond a symbolic link")
+                                       ( prob (QuotedPath (toRawFilePath p) <> " is beyond a symbolic link")
                                        , return True
                                        )
                                )
@@ -605,8 +605,8 @@ workTreeItems' (AllowHidden allowhidden) ww ps = case ww of
                        <$> catObjectMetaDataHidden f currbranch
                | otherwise = return False
 
-       prob eid msg = do
-               showException False eid msg
+       prob msg = do
+               toplevelWarning False msg
                Annex.incError
                return False
        
index 53d0587197483e4af393b9db625f7fd86eae72e1..565822365c71eb787233ef8adbde28a545dbbdf5 100644 (file)
@@ -27,8 +27,6 @@ module Messages (
        showEndFail,
        showEndResult,
        endResult,
-       ExceptionId(..),
-       showException,
        toplevelWarning,
        warning,
        earlyWarning,
@@ -199,26 +197,6 @@ endResult :: Bool -> S.ByteString
 endResult True = "ok"
 endResult False = "failed"
 
-{- Unique ids for different exceptions. Do not change the constructors. -}
-data ExceptionId
-       = FileNotFound
-       | FileBeyondSymbolicLink
-       deriving (Show)
-
-{- Displays an message that is not associated with any file being
- - processed. -}
-showException :: Bool -> ExceptionId -> StringContainingQuotedPath -> Annex ()
-showException makeway eid msg = do
-       when makeway $
-               outputMessage JSON.none id "\n"
-       outputException (show eid) (mentionedfile msg)
-               ("git-annex: " <> msg <> "\n")
-  where
-       mentionedfile (QuotedPath p) = Just p
-       mentionedfile (a :+: b) = mentionedfile a <|> mentionedfile b
-       mentionedfile (UnquotedString _) = Nothing
-       mentionedfile (UnquotedByteString _) = Nothing
-
 toplevelWarning :: Bool -> StringContainingQuotedPath -> Annex ()
 toplevelWarning makeway s = warning' makeway id ("git-annex: " <> s)
 
index 6600b98a1768e7d3db9a807f74dd80c8968d0adc..a16c7d2c61abdc314a677c06cb15a53579086ef0 100644 (file)
@@ -90,14 +90,11 @@ outputError consolewhitespacef msg = withMessageState $ \s -> case (outputType s
                qp <- coreQuotePath <$> Annex.getGitConfig
                liftIO $ outputSerialized h $ OutputError $ decodeBS $
                        consolewhitespacef $ quote qp msg
-       _ -> outputError' consolewhitespacef msg s
-
-outputError' :: (S.ByteString -> S.ByteString) -> StringContainingQuotedPath -> MessageState -> Annex ()
-outputError' consolewhitespacef msg s
-       | concurrentOutputEnabled s = do
-               qp <- coreQuotePath <$> Annex.getGitConfig
-               concurrentMessage s True (decodeBS $ consolewhitespacef $ quote qp msg) go
-       | otherwise = go
+       _
+               | concurrentOutputEnabled s -> do
+                       qp <- coreQuotePath <$> Annex.getGitConfig
+                       concurrentMessage s True (decodeBS $ consolewhitespacef $ quote qp msg) go
+               | otherwise -> go
   where
        go = do
                qp <- coreQuotePath <$> Annex.getGitConfig
@@ -105,17 +102,6 @@ outputError' consolewhitespacef msg s
                liftIO $ S.hPutStr stderr (consolewhitespacef $ quote qp msg)
                liftIO $ hFlush stderr
 
-outputException :: String -> Maybe RawFilePath -> StringContainingQuotedPath -> Annex ()
-outputException eid mfile msg = withMessageState $ \s -> case outputType s of
-       (JSONOutput jsonoptions) | jsonExceptions jsonoptions ->
-               liftIO $ flushed $ JSON.emit $
-                       JSON.exceptionObject eid (decodeBS (noquote msg)) mfile
-       (SerializedOutput h _) -> do
-               qp <- coreQuotePath <$> Annex.getGitConfig
-               liftIO $ outputSerialized h $ OutputException eid mfile $ decodeBS $
-                       quote qp msg
-       _ -> outputError' id msg s
-
 q :: Monad m => m ()
 q = noop
 
index 443f9b4f20431316013f7b67880f05cce9441bb0..8960dd04a24905adb973cde92d00958dc93d166b 100644 (file)
@@ -1,6 +1,6 @@
 {- git-annex command-line JSON output and input
  -
- - Copyright 2011-2023 Joey Hess <id@joeyh.name>
+ - Copyright 2011-2021 Joey Hess <id@joeyh.name>
  -
  - Licensed under the GNU AGPL version 3 or higher.
  -}
@@ -27,7 +27,6 @@ module Messages.JSON (
        ObjectMap(..),
        JSONActionItem(..),
        AddJSONActionItemFields(..),
-       exceptionObject,
 ) where
 
 import Control.Applicative
@@ -219,14 +218,3 @@ newtype AddJSONActionItemFields a = AddJSONActionItemFields a
 
 instance ToJSON' a => ToJSON' (AddJSONActionItemFields a) where
        toJSON' (AddJSONActionItemFields a) = object [ ("fields", toJSON' a) ]
-
-exceptionObject :: String -> String -> Maybe RawFilePath -> Object
-exceptionObject eid msg mfile = case o of
-       Object o' -> o'
-       _ -> error "internal"
-  where
-       o = object
-               [ "exception" .= toJSON' eid
-               , "message" .= toJSON' msg
-               , "file" .= toJSON' (maybe "" decodeBS mfile)
-               ]
index 5924e10b4d420977e6f7ed73f16b65da4c352eeb..494df5aac52bdc10b8ff4fce8a43399cd66b1820 100644 (file)
@@ -58,9 +58,6 @@ relaySerializedOutput getso sendsor meterreport runannex = go Nothing
                Left (OutputError msg) -> do
                        runannex $ outputError id $ UnquotedString msg
                        loop st         
-               Left (OutputException eid mfile msg) -> do
-                       runannex $ outputException eid mfile $ UnquotedString msg
-                       loop st
                Left (JSONObject b) -> do
                        runannex $ withMessageState $ \s -> case outputType s of
                                JSONOutput _ -> liftIO $ flushed $ JSON.emit' b
index 7a957a263e759f0be866e5eb95047f231b534ff2..e80dc86d63f09b69657a586f286622a6d0ab116b 100644 (file)
@@ -9,7 +9,6 @@ module Types.Messages where
 
 import qualified Utility.Aeson as Aeson
 import Utility.Metered
-import Utility.RawFilePath
 
 import Control.Concurrent
 import System.Console.Regions (ConsoleRegion)
@@ -27,7 +26,6 @@ data OutputType
 data JSONOptions = JSONOptions
        { jsonProgress :: Bool
        , jsonErrorMessages :: Bool
-       , jsonExceptions :: Bool
        }
        deriving (Show)
 
@@ -35,7 +33,6 @@ adjustOutputType :: OutputType -> OutputType -> OutputType
 adjustOutputType (JSONOutput old) (JSONOutput new) = JSONOutput $ JSONOptions
        { jsonProgress = jsonProgress old || jsonProgress new
        , jsonErrorMessages = jsonErrorMessages old || jsonErrorMessages new
-       , jsonExceptions = jsonExceptions old || jsonExceptions new
        }
 adjustOutputType _old new = new
 
@@ -73,7 +70,6 @@ newMessageState = do
 data SerializedOutput
        = OutputMessage S.ByteString
        | OutputError String
-       | OutputException String (Maybe RawFilePath) String
        | BeginProgressMeter
        | UpdateProgressMeterTotalSize TotalSize
        | UpdateProgressMeter BytesProcessed
index d35d7d5a3a751c683669889636a87a46de6ab144..7a1ad2c24e42f91bf4de1b5573dc39b79c873a80 100644 (file)
@@ -84,8 +84,7 @@ annexed content, and other symlinks.
 * `--json`
 
   Enable JSON output. This is intended to be parsed by programs that use
-  git-annex. Each line of output is a JSON object corresponding to a file
-  being processed.
+  git-annex. Each line of output is a JSON object.
 
 * `--json-progress`
 
@@ -93,13 +92,8 @@ annexed content, and other symlinks.
 
 * `--json-error-messages`
 
-  Adds an "error-messages" field to the JSON that contains messages that
-  would normally be output to the standard error when processing a file.
-
-* `--json-exceptions`
-
-  Output additional JSON objects for some exceptions that are not
-  associated with a particular file.
+  Messages that would normally be output to standard error are included in
+  the JSON instead.
 
 * `--batch`
 
index 3e7e0de850ca0e6fef066b0c2384058a97f4bec4..02864cebc6ff50836fa85995674b88df67c44952 100644 (file)
@@ -125,8 +125,7 @@ be used to get better filenames.
 * `--json`
 
   Enable JSON output. This is intended to be parsed by programs that use
-  git-annex. Each line of output is a JSON object corresponding to an url
-  being processed.
+  git-annex. Each line of output is a JSON object.
 
 * `--json-progress`
 
@@ -134,13 +133,8 @@ be used to get better filenames.
 
 * `--json-error-messages`
 
-  Adds an "error-messages" field to the JSON that contains messages that
-  would normally be output to the standard error when processing an url.
-
-* `--json-exceptions`
-
-  Output additional JSON objects for some exceptions that are not
-  associated with a particular url.
+  Messages that would normally be output to standard error are included in
+  the JSON instead.
 
 * `--backend`
 
index 9c956460765ec3e7ccc5d14fe4689400f7185e35..57905b672c0571594ad7ec30df09e9f4ec3f460e 100644 (file)
@@ -112,11 +112,11 @@ Paths of files or directories to operate on can be specified.
 * `-z`
 
   Makes batch input be delimited by nulls instead of the usual newlines.
+
 * `--json`
 
   Enable JSON output. This is intended to be parsed by programs that use
-  git-annex. Each line of output is a JSON object corresponding to a file
-  being processed.
+  git-annex. Each line of output is a JSON object.
 
 * `--json-progress`
 
@@ -124,13 +124,8 @@ Paths of files or directories to operate on can be specified.
 
 * `--json-error-messages`
 
-  Adds an "error-messages" field to the JSON that contains messages that
-  would normally be output to the standard error when processing a file.
-
-* `--json-exceptions`
-
-  Output additional JSON objects for some exceptions that are not
-  associated with a particular file.
+  Messages that would normally be output to standard error are included in
+  the JSON instead.
 
 * Also the [[git-annex-common-options]](1) can be used.
 
index 547cdd08f681b668f895a31887d7cd5731d085f0..aa66696958fcac10f081c480fab803b24f3b0afc 100644 (file)
@@ -126,18 +126,12 @@ Paths of files or directories to drop can be specified.
 * `--json`
 
   Enable JSON output. This is intended to be parsed by programs that use
-  git-annex. Each line of output is a JSON object corresponding to a file
-  being processed.
+  git-annex. Each line of output is a JSON object.
 
 * `--json-error-messages`
 
-  Adds an "error-messages" field to the JSON that contains messages that
-  would normally be output to the standard error when processing a file.
-
-* `--json-exceptions`
-
-  Output additional JSON objects for some exceptions that are not
-  associated with a particular file.
+  Messages that would normally be output to standard error are included in
+  the JSON instead.
 
 * Also the [[git-annex-common-options]](1) can be used.
 
index 02a11876ac76dedaace563bcc5066eb59b84e95b..1b0ba61ac2e25ec45eb64a305d72159abb625a25 100644 (file)
@@ -27,19 +27,12 @@ exist; using it can easily result in data loss.
 * `--json`
 
   Enable JSON output. This is intended to be parsed by programs that use
-  git-annex. Each line of output is a JSON object corresponding to a key
-  being processed.
+  git-annex. Each line of output is a JSON object.
 
 * `--json-error-messages`
 
-  Adds an "error-messages" field to the JSON that contains messages that
-  would normally be output to the standard error when processing a key.
-
-* `--json-exceptions`
-
-  Output additional JSON objects for some exceptions that are not
-  associated with a particular key.
-
+  Messages that would normally be output to standard error are included in
+  the JSON instead.
 
 * Also the [[git-annex-common-options]](1) can be used.
 
index 4a7ef68a45dc5ced927fb8c45c4fec4d75c9742c..4c3e1b304cdfb57d1e8dab3cb26e645f7948dae0 100644 (file)
@@ -40,18 +40,12 @@ that can be determined purely by looking at the key.
 * `--json`
 
   Enable JSON output. This is intended to be parsed by programs that use
-  git-annex. Each line of output is a JSON object corresponding to a key
-  being processed.
+  git-annex. Each line of output is a JSON object.
 
 * `--json-error-messages`
 
-  Adds an "error-messages" field to the JSON that contains messages that
-  would normally be output to the standard error when processing a key.
-
-* `--json-exceptions`
-
-  Output additional JSON objects for some exceptions that are not
-  associated with a particular key.
+  Messages that would normally be output to standard error are included in
+  the JSON instead.
 
 * `--migrate-to-backend=backend`
 
index 7d781a071d1c4998a91d9c77df317964cbc004f1..738e7fbf3c9d38e047b15297907f3d66f11626ad 100644 (file)
@@ -102,8 +102,7 @@ so the overwritten modification is not lost.)
 * `--json`
 
   Enable JSON output. This is intended to be parsed by programs that use
-  git-annex. Each line of output is a JSON object corresponding to a file
-  being processed.
+  git-annex. Each line of output is a JSON object.
 
 * `--json-progress`
 
@@ -111,13 +110,8 @@ so the overwritten modification is not lost.)
 
 * `--json-error-messages`
 
-  Adds an "error-messages" field to the JSON that contains messages that
-  would normally be output to the standard error when processing a file.
-
-* `--json-exceptions`
-
-  Output additional JSON objects for some exceptions that are not
-  associated with a particular file.
+  Messages that would normally be output to standard error are included in
+  the JSON instead.
 
 * Also the [[git-annex-common-options]](1) can be used.
 
index 2abcbac7b28486eb1a2726dd62afa0b2e90db106..7a667d4672df823d322fcd29dda5d6a53735b70e 100644 (file)
@@ -55,19 +55,15 @@ finds files in the current directory and its subdirectories.
 
 * `--json`
 
-  Enable JSON output. This is intended to be parsed by programs that use
-  git-annex. Each line of output is a JSON object corresponding to a file
-  being processed.
+  Output the list of files in JSON format.
 
-* `--json-error-messages`
-
-  Adds an "error-messages" field to the JSON that contains messages that
-  would normally be output to the standard error when processing a file.
+  This is intended to be parsed by programs that use
+  git-annex. Each line of output is a JSON object.
 
-* `--json-exceptions`
+* `--json-error-messages`
 
-  Output additional JSON objects for some exceptions that are not
-  associated with a particular file.
+  Messages that would normally be output to standard error are included in
+  the JSON instead.
 
 * `--batch`
 
index 4e621745925a95e29518a0e9baefed4ec83be2a1..ac1b16d067354875e441b8409174c6ab30e7d3f4 100644 (file)
@@ -50,19 +50,15 @@ Outputs a list of keys known to git-annex.
 
 * `--json`
 
-  Enable JSON output. This is intended to be parsed by programs that use
-  git-annex. Each line of output is a JSON object corresponding to a key
-  being processed.
+  Output the list of keys in JSON format.
 
-* `--json-error-messages`
-
-  Adds an "error-messages" field to the JSON that contains messages that
-  would normally be output to the standard error when processing a key.
+  This is intended to be parsed by programs that use
+  git-annex. Each line of output is a JSON object.
 
-* `--json-exceptions`
+* `--json-error-messages`
 
-  Output additional JSON objects for some exceptions that are not
-  associated with a particular key.
+  Messages that would normally be output to standard error are included in
+  the JSON instead.
 
 * Also the [[git-annex-common-options]](1) can be used.
 
index a46e0d7cfd96c5fed55eca01d5bd253ad06258e1..4083ba4bf1e36148e1dcafccccb9a399a2bd5251 100644 (file)
@@ -103,18 +103,12 @@ better format.
 * `--json`
 
   Enable JSON output. This is intended to be parsed by programs that use
-  git-annex. Each line of output is a JSON object corresponding to a file
-  being processed.
+  git-annex. Each line of output is a JSON object.
 
 * `--json-error-messages`
 
-  Adds an "error-messages" field to the JSON that contains messages that
-  would normally be output to the standard error when processing a file.
-
-* `--json-exceptions`
-
-  Output additional JSON objects for some exceptions that are not
-  associated with a particular file.
+  Messages that would normally be output to standard error are included in
+  the JSON instead.
 
 * `--quiet`
 
index 9afbdfb22acfeae9fa940b6b8aac58fa2560b873..208188171fb3a4c8dbcfa25a859e8c679e69d56c 100644 (file)
@@ -126,8 +126,7 @@ be specified.
 * `--json`
 
   Enable JSON output. This is intended to be parsed by programs that use
-  git-annex. Each line of output is a JSON object corresponding to a file
-  being processed.
+  git-annex. Each line of output is a JSON object.
 
 * `--json-progress`
 
@@ -135,13 +134,8 @@ be specified.
 
 * `--json-error-messages`
 
-  Adds an "error-messages" field to the JSON that contains messages that
-  would normally be output to the standard error when processing a file.
-
-* `--json-exceptions`
-
-  Output additional JSON objects for some exceptions that are not
-  associated with a particular file.
+  Messages that would normally be output to standard error are included in
+  the JSON instead.
 
 * Also the [[git-annex-common-options]](1) can be used.
 
index 704a903fc951797cd33f1ed98cb9fd3583eae6d7..8d56d82270b3716d511a5333a355c70850ecc580 100644 (file)
@@ -202,8 +202,7 @@ link, and that symbolic link will be followed.
 * `--json`
 
   Enable JSON output. This is intended to be parsed by programs that use
-  git-annex. Each line of output is a JSON object corresponding to a file
-  being processed.
+  git-annex. Each line of output is a JSON object.
 
 * `--json-progress`
 
@@ -211,13 +210,8 @@ link, and that symbolic link will be followed.
 
 * `--json-error-messages`
 
-  Adds an "error-messages" field to the JSON that contains messages that
-  would normally be output to the standard error when processing a file.
-
-* `--json-exceptions`
-
-  Output additional JSON objects for some exceptions that are not
-  associated with a particular file.
+  Messages that would normally be output to standard error are included in
+  the JSON instead.
 
 * Also the [[git-annex-common-options]](1) can be used.
 
index b5b7871cf8d9843f7edeb292ba3a5664c84676be..9a2256b491396d2b7a4902af4c30174132fd55a4 100644 (file)
@@ -24,18 +24,12 @@ for the local repository and all annexed content.
 * `--json`
 
   Enable JSON output. This is intended to be parsed by programs that use
-  git-annex. Each line of output is a JSON object corresponding to a item
-  being processed.
+  git-annex. Each line of output is a JSON object.
 
 * `--json-error-messages`
 
-  Adds an "error-messages" field to the JSON that contains messages that
-  would normally be output to the standard error when processing a item.
-
-* `--json-exceptions`
-
-  Output additional JSON objects for some exceptions that are not
-  associated with a particular item.
+  Messages that would normally be output to standard error are included in
+  the JSON instead.
 
 * `--bytes`
 
index f83171b0041882224e4468917f8c2add8e023fde..3e360db41c931f3b58ee8b4bafd99f37f1ca176b 100644 (file)
@@ -26,18 +26,12 @@ can commit.
 * `--json`
 
   Enable JSON output. This is intended to be parsed by programs that use
-  git-annex. Each line of output is a JSON object corresponding to a file
-  being processed.
+  git-annex. Each line of output is a JSON object.
 
 * `--json-error-messages`
 
-  Adds an "error-messages" field to the JSON that contains messages that
-  would normally be output to the standard error when processing a file.
-
-* `--json-exceptions`
-
-  Output additional JSON objects for some exceptions that are not
-  associated with a particular file.
+  Messages that would normally be output to standard error are included in
+  the JSON instead.
 
 * Also the [[git-annex-common-options]](1) can be used.
 
index e8ef9dd5aff02e5d8a0e09e3c815b2fb89087316..9eb6ebf3aa5361d8f164b301e38037685496de72 100644 (file)
@@ -119,16 +119,6 @@ the modified file.
 
        {"command":"metadata","file":"foo","key":"...","author":["bar"],...,"note":"...","success":true}
 
-* `--json-error-messages`
-
-  Adds an "error-messages" field to the JSON that contains messages that
-  would normally be output to the standard error when processing a file.
-
-* `--json-exceptions`
-
-  Output additional JSON objects for some exceptions that are not
-  associated with a particular file.
-
 * `--json-error-messages`
 
   Messages that would normally be output to standard error are included in
index 546aa42c72d4df87742f57d2936ebf78497e0ff2..3dfb9aa938aa18fd2a1294a2f1f90d5f35a6e1ef 100644 (file)
@@ -71,8 +71,7 @@ contents. Use [[git-annex-sync]](1) for that.
 * `--json`
 
   Enable JSON output. This is intended to be parsed by programs that use
-  git-annex. Each line of output is a JSON object corresponding to a file
-  being processed.
+  git-annex. Each line of output is a JSON object.
 
 * `--json-progress`
 
@@ -80,13 +79,8 @@ contents. Use [[git-annex-sync]](1) for that.
 
 * `--json-error-messages`
 
-  Adds an "error-messages" field to the JSON that contains messages that
-  would normally be output to the standard error when processing a file.
-
-* `--json-exceptions`
-
-  Output additional JSON objects for some exceptions that are not
-  associated with a particular file.
+  Messages that would normally be output to standard error are included in
+  the JSON instead.
 
 * Also the [[git-annex-common-options]](1) can be used.
 
index 0d167920b25ba21cdf23718891056b47ff9c6fa2..b30163c891cbfa95224f207981182e53c599b1fd 100644 (file)
@@ -111,8 +111,7 @@ Paths of files or directories to operate on can be specified.
 * `--json`
 
   Enable JSON output. This is intended to be parsed by programs that use
-  git-annex. Each line of output is a JSON object corresponding to a file
-  being processed.
+  git-annex. Each line of output is a JSON object.
 
 * `--json-progress`
 
@@ -120,13 +119,8 @@ Paths of files or directories to operate on can be specified.
 
 * `--json-error-messages`
 
-  Adds an "error-messages" field to the JSON that contains messages that
-  would normally be output to the standard error when processing a file.
-
-* `--json-exceptions`
-
-  Output additional JSON objects for some exceptions that are not
-  associated with a particular file.
+  Messages that would normally be output to standard error are included in
+  the JSON instead.
 
 * Also the [[git-annex-common-options]](1) can be used.
 
index 06ad999bc660c0ec1baa2d0b40b294458a40fcd0..753d06b70460aa7aaa67ad905a59b7b2f0ceb5c5 100644 (file)
@@ -51,19 +51,12 @@ special remote that claims it. (Usually the web special remote.)
 * `--json`
 
   Enable JSON output. This is intended to be parsed by programs that use
-  git-annex. Each line of output is a JSON object corresponding to a key
-  being processed.
+  git-annex. Each line of output is a JSON object.
 
 * `--json-error-messages`
 
-  Adds an "error-messages" field to the JSON that contains messages that
-  would normally be output to the standard error when processing a key.
-
-* `--json-exceptions`
-
-  Output additional JSON objects for some exceptions that are not
-  associated with a particular key.
-
+  Messages that would normally be output to standard error are included in
+  the JSON instead.
 
 * Also the [[git-annex-common-options]](1) can be used.
 
index 469292508c1cb7291cf03ee25ef08e8dcbd88540..962fda51d4d27ba70c46339e7e0e6409ef196fed 100644 (file)
@@ -24,17 +24,12 @@ modified (M), added but not committed (A), and type changed/unlocked (T).
 * `--json`
 
   Enable JSON output. This is intended to be parsed by programs that use
-  git-annex. Each line of output is a JSON object corresponding to a file.
+  git-annex. Each line of output is a JSON object.
 
 * `--json-error-messages`
 
-  Adds an "error-messages" field to the JSON that contains messages that
-  would normally be output to the standard error when processing a file.
-
-* `--json-exceptions`
-
-  Output additional JSON objects for some exceptions that are not
-  associated with a particular file.
+  Messages that would normally be output to standard error are included in
+  the JSON instead.
 
 * Also the [[git-annex-common-options]](1) can be used.
 
index 4fcf6d1df30f72a701da01b1fd9928bd34d4b7d0..1a2bd3259628f895c714f50a554d3f0ead67e4c6 100644 (file)
@@ -53,19 +53,12 @@ repository. So, enable annex.thin with care.
 * `--json`
 
   Enable JSON output. This is intended to be parsed by programs that use
-  git-annex. Each line of output is a JSON object corresponding to a file
-  being processed.
+  git-annex. Each line of output is a JSON object.
 
 * `--json-error-messages`
 
-  Adds an "error-messages" field to the JSON that contains messages that
-  would normally be output to the standard error when processing a file.
-
-* `--json-exceptions`
-
-  Output additional JSON objects for some exceptions that are not
-  associated with a particular file.
-
+  Messages that would normally be output to standard error are included in
+  the JSON instead.
 
 * Also the [[git-annex-common-options]](1) can be used.
 
index afc3f0af4d3630f92982e0bbc31d1aab4bcbd805..ab535a73f62aa4206fe371d15c39866eeea6c53c 100644 (file)
@@ -42,19 +42,12 @@ for it, because the content may still be present on the remote.
 * `--json`
 
   Enable JSON output. This is intended to be parsed by programs that use
-  git-annex. Each line of output is a JSON object corresponding to a key
-  being processed.
+  git-annex. Each line of output is a JSON object.
 
 * `--json-error-messages`
 
-  Adds an "error-messages" field to the JSON that contains messages that
-  would normally be output to the standard error when processing a key.
-
-* `--json-exceptions`
-
-  Output additional JSON objects for some exceptions that are not
-  associated with a particular key.
-
+  Messages that would normally be output to standard error are included in
+  the JSON instead.
 
 * Also the [[git-annex-common-options]](1) can be used.
 
index 9375e0d8fbb96c82b81941805d868650def8e433..84678709f0df52ad80b515e0e5269909623daf4a 100644 (file)
@@ -71,18 +71,12 @@ received from remotes.
 * `--json`
 
   Enable JSON output. This is intended to be parsed by programs that use
-  git-annex. Each line of output is a JSON object corresponding to a file
-  being processed.
+  git-annex. Each line of output is a JSON object.
 
 * `--json-error-messages`
 
-  Adds an "error-messages" field to the JSON that contains messages that
-  would normally be output to the standard error when processing a file.
-
-* `--json-exceptions`
-
-  Output additional JSON objects for some exceptions that are not
-  associated with a particular file.
+  Messages that would normally be output to standard error are included in
+  the JSON instead.
 
 * `--format=value`
 
index f6e1861bdd6eba5b7a924e5022fc7590ed76b239..b48dd361f78909f4e91b2482d9e6ed75118ee5d9 100644 (file)
@@ -31,7 +31,7 @@ bpoldrack makes a good point
 
 So eg:
 
-       {"exception":"UNIQUEID", "file":"foo", "message":"foo not found"}
+       {"exception":"UNIQUEID", "file":"foo", "error-messages":["foo not found"]}
 
 That seems about right to me, and it future proofs git-annex to be able to
 report other exceptions in json output later on.
diff --git a/doc/todo/api_for_telling_when_nonexistant_or_non_git_files_passed/comment_5_105453fbbe7361f3d409ab87079a8a41._comment b/doc/todo/api_for_telling_when_nonexistant_or_non_git_files_passed/comment_5_105453fbbe7361f3d409ab87079a8a41._comment
deleted file mode 100644 (file)
index 160cf54..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-[[!comment format=mdwn
- username="joey"
- subject="""comment 5"""
- date="2023-04-25T18:43:20Z"
- content="""
-I've implemented --json-exceptions:
-
-       joey@darkstar:~/tmp/xxx>git-annex add dne --json-exceptions
-       {"exception":"FileNotFound","file":"dne","message":"git-annex: dne not found\n"}
-       add: 1 failed
-
-Note that when a command like `git-annex get` is run on a file that exists,
-but is not checked into git, `git ls-files` still displays its own error message,
-so --json-exceptions doesn't help with this:
-
-       joey@darkstar:~/tmp/xxx>touch foo
-       joey@darkstar:~/tmp/xxx>git-annex get foo --json-exceptions
-       error: pathspec 'foo' did not match any file(s) known to git
-       Did you forget to 'git add'?
-       get: 1 failed
-
-Datalad will still have to parse the git output if it wants to know what file
-it failed on in that case.
-"""]]
diff --git a/doc/todo/api_for_telling_when_nonexistant_or_non_git_files_passed/comment_8_f34293aa30b8b9abc71fac4e713aded3._comment b/doc/todo/api_for_telling_when_nonexistant_or_non_git_files_passed/comment_8_f34293aa30b8b9abc71fac4e713aded3._comment
new file mode 100644 (file)
index 0000000..1bec987
--- /dev/null
@@ -0,0 +1,34 @@
+[[!comment format=mdwn
+ username="joey"
+ subject="""Re: comment 6"""
+ date="2023-04-25T21:10:21Z"
+ content="""
+Oh well spotted yarikoptic! I wish I had noticed your comment 2 hours ago,
+but I was head down implementing --json-exceptions.
+
+Ok, so `addurl` does `giveup "bad url"` and that does indeed result in json
+output that lacks a `key` and has `"file":null` as well.
+
+I'm sure that somewhere in `git-annex add`, it's possible for it to
+`giveup` with an error too. Oh of course... a device file!
+
+       joey@darkstar:/home/joey/tmp/xxx>git-annex add --force-small null --json --json-error-messages
+       {"command":"add","error-messages":["git-annex: null is not a regular file"],"file":"null","input":["null"],"note":"adding content to git repository","success":false}
+       add: 1 failed
+
+Other perhaps more likely cases where add can `giveup` include when it's unable
+to remove all write perms due to an xattr, and probably some permissions
+problems.
+
+So, json consumers of add already have to deal with the `key` being missing.
+
+Now, it might be that some git-annex commands don't `giveup`, so this would be
+a new complication for consumers of their json. But so would adding a `giveup`
+for any reason to a command, and I don't worry about that.
+
+While I've implemented --json-exceptions, I don't like the complexity, so this new
+information inclines me to rip it back out and instead handle the case of the
+nonexistant file like:
+
+       {"command":"add","exception":"UNIQUEID","file":"foo","input":["foo"],"error-messages":["foo not found"],"success":false}
+"""]]