back compat fix for info --json on unknown item

This was changed in a0e6fa18eb in a way
that broke datalad, which expected to see a "file" field in the --json.

See 45ddd4b12f
This commit is contained in:
Joey Hess 2023-05-01 12:05:21 -04:00
parent 66fe3b0908
commit 1beca851ff
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View file

@ -182,7 +182,11 @@ itemInfo o (si, p) = ifM (isdir (toRawFilePath p))
noInfo :: String -> SeekInput -> String -> Annex ()
noInfo s si msg = do
showStartMessage (StartMessage "info" (ActionItemOther (Just (UnquotedString s))) si)
-- The string may not really be a file, but use ActionItemTreeFile,
-- rather than ActionItemOther to avoid breaking back-compat of
-- json output.
let ai = ActionItemTreeFile (toRawFilePath s)
showStartMessage (StartMessage "info" ai si)
showNote (UnquotedString msg)
showEndFail
Annex.incError