Re: Feature request: --format=json

2017-04-24 Thread shawn wilson
On Mon, Apr 24, 2017 at 5:28 AM, Duy Nguyen wrote: > On Mon, Apr 24, 2017 at 3:33 PM, shawn wilson wrote: >> Late to the party, but I too would also like json format output (mainly so I >> could pipe stuff to jq instead of looking at the man page for which

Re: Feature request: --format=json

2017-04-24 Thread Duy Nguyen
On Mon, Apr 24, 2017 at 3:33 PM, shawn wilson wrote: > Late to the party, but I too would also like json format output (mainly so I > could pipe stuff to jq instead of looking at the man page for which %thing > I'm looking for). That said, it's not at the PR level of want for

Re: Feature request: --format=json

2017-04-18 Thread demerphq
On 18 April 2017 at 10:44, Fred .Flintstone wrote: > Well the easiest way to work with that would be JSON. > So the best would be if Git could output the data I want in JSON format. > Then it would be easy for me to work with data. > > With git rev-list and git-cat file, its

Re: Feature request: --format=json

2017-04-18 Thread Fred .Flintstone
But a repository or branch can have thousands of commits, so running `git commit-file ` seems maybe not be a wide idea. But parsing `git cat-file --batch` is difficult, because there seems to be no reliable way to discern when a commit starts and ends. I don't code in C though. A JSON formatter

Re: Feature request: --format=json

2017-04-18 Thread Samuel Lijin
If for some reason your use case is so performance intensive that you can't just `git cat-file commit` every entry in `git rev-list --all` individually, then you can also pipe input into `git cat-file --batch` and read output as you pipe input in, which will give you a very simple mechanism for

Re: Feature request: --format=json

2017-04-18 Thread Fred .Flintstone
Well the easiest way to work with that would be JSON. So the best would be if Git could output the data I want in JSON format. Then it would be easy for me to work with data. With git rev-list and git-cat file, its not so easy to reliably parse that output. On Tue, Apr 18, 2017 at 2:38 AM, Junio

Re: Feature request: --format=json

2017-04-17 Thread Junio C Hamano
"Fred .Flintstone" writes: > So I would either have to do: > git rev-list --all > Then iterate over each line and do git-cat-file commit . > > 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

Re: Feature request: --format=json

2017-04-17 Thread Sebastian Schuberth
On 2017-04-17 14:44, Fred .Flintstone wrote: However, if I want something more suitable for machine parsing, is there any way to get that output? Instead of machine parsing, why not directly get what you want via libgit2 (or one of its language bindings), or jgit? [1]

Re: Feature request: --format=json

2017-04-17 Thread Fred .Flintstone
So I would either have to do: git rev-list --all Then iterate over each line and do git-cat-file commit . 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

Re: Feature request: --format=json

2017-04-17 Thread Duy Nguyen
On Mon, Apr 17, 2017 at 7:44 PM, Fred .Flintstone 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? >

Re: Feature request: --format=json

2017-04-17 Thread Fred .Flintstone
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

Re: Feature request: --format=json

2017-04-16 Thread Junio C Hamano
Ævar Arnfjörð Bjarmason writes: > On Sat, Apr 8, 2017 at 6:07 PM, Fred .Flintstone wrote: >> $ git log --format=json >> [{ >> "commit": "64eabf050e315a4c7a11e0c05ca163be7cf9075e", >> "tree": "b1e977800f40bbf6de906b1fe4f2de4b4b14f0fd", >>

Re: Feature request: --format=json

2017-04-08 Thread Ævar Arnfjörð Bjarmason
On Sat, Apr 8, 2017 at 6:07 PM, Fred .Flintstone wrote: > $ git log --format=json > [{ > "commit": "64eabf050e315a4c7a11e0c05ca163be7cf9075e", > "tree": "b1e977800f40bbf6de906b1fe4f2de4b4b14f0fd", > "author": "Tux 1490981516 +0200", >

Feature request: --format=json

2017-04-08 Thread Fred .Flintstone
$ git log --format=json [{ "commit": "64eabf050e315a4c7a11e0c05ca163be7cf9075e", "tree": "b1e977800f40bbf6de906b1fe4f2de4b4b14f0fd", "author": "Tux 1490981516 +0200", "committer": "Tux 1490981516 +0200", "message": "This is a test commit",