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

Re: Feature request: --format=json

From
F.Fred .Flintstone <eldmannen@gmail.com>
Date
Apr 17, 2017, 13:09 UTC
Message-ID
<CAJgfmqW4ck9SwBrT_Z7bTOzM2zG==_ONUhTfhbLJtRu=vT+wyg@mail.gmail.com>
In-Reply-To
<CACsJy8BASVSxJ4RzNKVpj9MyD=fMR-fpspMdET1bT45yMrf_0w@mail.gmail.com>

So I would either have to do: git rev-list --all Then iterate over each line and do git-cat-file commit <commit-id>.

Or do: git rev-list --all | git cat-file --batch

If I do it in a batch, then it will be tricky to reliably parse since I don't know when the message body ends and when the next commit starts.

JSON output would have been very handy.
On Mon, Apr 17, 2017 at 2:59 PM, Duy Nguyen <pclouds@gmail.com> wrote:
Show 20 quoted lines
> On Mon, Apr 17, 2017 at 7:44 PM, Fred .Flintstone <eldmannen@gmail.com> wrote:
>> So I did "git rev-list --all --pretty" and it looks like "git log".
>> Which outputs a human-readable format.
>>
>> However, if I want something more suitable for machine parsing, is
>> there any way to get that output?
>>
>> Example maybe I want another date format like ISO dates, or maybe a
>> serializable format like JSON or CSV or something. Maybe I want more
>> data than commit, auhor, date, subject and body?
>
> "git cat-file commit <commit-id>" should give you a machine-readable
> format of everything (it's the same thing that git-log parses and
> shows you; not counting options like --diff, --stat...). <commit-id>
> is from rev-list output (without --pretty, that's not for machine
> processing). You probably can use "git cat-file --batch" too, just
> pipe the whole rev-list output through it. You don't get to choose a
> convenient format this way though.
> --
> Duy
Previous: Duy NguyenNext: Junio C Hamano
Message 6 of 14 in “Feature request: --format=json”
  1. Fred .FlintstoneApr 8, 2017
  2. Ævar Arnfjörð BjarmasonApr 8, 2017
  3. Junio C HamanoApr 17, 2017
  4. Fred .FlintstoneApr 17, 2017
  5. Duy NguyenApr 17, 2017
  6. Fred .FlintstoneApr 17, 2017
  7. Junio C HamanoApr 18, 2017
  8. Fred .FlintstoneApr 18, 2017
  9. Samuel LijinApr 18, 2017
  10. Fred .FlintstoneApr 18, 2017
  11. demerphqApr 18, 2017
  12. Sebastian SchuberthApr 17, 2017
  13. Duy NguyenApr 24, 2017
  14. shawn wilsonApr 24, 2017

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.