Subject: Re: [PATCH v2] docs: explain the order of output in the batched mode of git-cat-file(1)

From: Junio C Hamano <[email-masked]>
Date: Wed, 21 Aug 2024 10:19:14 -0700

"ahmed akef via GitGitGadget" <[email-masked]> writes:

>  If `--batch` or `--batch-check` is given, `cat-file` will read objects
> -from stdin, one per line, and print information about them. By default,
> -the whole line is considered as an object, as if it were fed to
> -linkgit:git-rev-parse[1].
> +from stdin, one per line, and print information about them in the same
> +order as they have been read from stdin. By default, the whole line is
> +considered as an object, as if it were fed to linkgit:git-rev-parse[1].

A few "Huh?" I had while reading the above.

 * "as they have been read from stdin"; drop "from stdin" here, as
   we already know we are talking about the mode that reads object
   names from the standard input and there is no need to repeat it.

 * "considered as an object" -> "considered to be an object name" or
   "used as an object name" [*].  This primarily comes from my
   spinal reflex against "consider as", plus my desire to be more
   precise in terminology.

Thanks.

Nothing mentioned below should be part of this patch, but as I
noticed it while studying the current documentation to prepare this
review, I'll record them as #leftoverbits.

The description of how lines read from the standard input should
look like needs more work.  Documentation on "--batch" says "the
input lines must specify the path, separated by whitespace", but is
it clear that it expects "<object name>", followed by a whitespace
(not necessarily a single SP), followed by "<path>"?  Without prior
knowledge, I wouldn't be surprised if somebody read the text as
asking for paths separated by whitespace, e.g.

    README.txt COPYING Makefile

that gives three paths.  The text needs to be tightened to say
something like "must give the path after the object name, separated
by whitespace.  The path is used to find the textconv and smudge
filter".

The section also says "See the section BATCH OUTPUT below for
details." but the section it refers to does not talk anything about
this whitespace thing.  It also is unclear what would happen if the
input line says:

    :COPYING Makefile

Would it apply the textconv/filters meant for Makefile to the blob
stored at COPYING in the index?  If we say

    :README.txt
    
would the command be smart enough to know that the blob came from
the path README.txt and apply the textconv/filters meant for that
path, without the input repeating the same information twice like:

    :README.txt README.txt

or something silly like that?

[Reference]

* https://www.britannica.com/dictionary/eb/qa/consider-and-consider-as