git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 21, 2024, 17:19 UTC
Message-ID
<xmqqa5h5ztd9.fsf@gitster.g>
In-Reply-To
<pull.1768.v2.git.git.1724234729288.gitgitgadget@gmail.com>
"ahmed akef via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 7 quoted lines
>  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
Previous: ahmed akef via GitGitGadgetNext: ahmed akef via GitGitGadget
Message 3 of 6 in “docs: explain the order of output in the batched mode of git-cat-file(1)”
  1. docs: explain the order of output in the batched mode of git-cat-file(1)ahmed akef via GitGitGadget, Aug 21, 2024
  2. docs: explain the order of output in the batched mode of git-cat-file(1)ahmed akef via GitGitGadget, Aug 21, 2024
  3. Junio C HamanoAug 21, 2024
  4. docs: explain the order of output in the batched mode of git-cat-file(1)ahmed akef via GitGitGadget, Aug 22, 2024
  5. Ahmed AkefAug 22, 2024
  6. Junio C HamanoAug 22, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.