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

Re: [PATCH v4] json_writer: new routines to create data in JSON format

From
Ramsay Jones <ramsay@ramsayjones.plus.com>
Date
Mar 27, 2018, 03:18 UTC
Message-ID
<ce076d5e-f30f-006e-a25e-ff1a900562bf@ramsayjones.plus.com>
In-Reply-To
<20180326143136.47116-2-git@jeffhostetler.com>
On 26/03/18 15:31, git@jeffhostetler.com wrote:
Show 35 quoted lines
> From: Jeff Hostetler <jeffhost@microsoft.com>
> 
> Add a series of jw_ routines and "struct json_writer" structure to compose
> JSON data.  The resulting string data can then be output by commands wanting
> to support a JSON output format.
> 
> The json-writer routines can be used to generate structured data in a
> JSON-like format.  We say "JSON-like" because we do not enforce the Unicode
> (usually UTF-8) requirement on string fields.  Internally, Git does not
> necessarily have Unicode/UTF-8 data for most fields, so it is currently
> unclear the best way to enforce that requirement.  For example, on Linx
> pathnames can contain arbitrary 8-bit character data, so a command like
> "status" would not know how to encode the reported pathnames.  We may want
> to revisit this (or double encode such strings) in the future.
> 
> The initial use for the json-writer routines is for generating telemetry
> data for executed Git commands.  Later, we may want to use them in other
> commands, such as status.
> 
> Helped-by: René Scharfe <l.s.r@web.de>
> Helped-by: Wink Saville <wink@saville.com>
> Helped-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
> Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
> ---
>  Makefile                    |   2 +
>  json-writer.c               | 395 +++++++++++++++++++++++++++++
>  json-writer.h               |  92 +++++++
>  t/helper/test-json-writer.c | 590 ++++++++++++++++++++++++++++++++++++++++++++
>  t/t0019-json-writer.sh      | 253 +++++++++++++++++++
>  5 files changed, 1332 insertions(+)
>  create mode 100644 json-writer.c
>  create mode 100644 json-writer.h
>  create mode 100644 t/helper/test-json-writer.c
>  create mode 100755 t/t0019-json-writer.sh
> 
[snip]

Thanks, this version fixes all issues I had (with the compilation and sparse warnings).

[Was using UINT64_C(0xffffffffffffffff) a problem on windows?]

ATB, Ramsay Jones

Previous: git@jeffhostetler.comNext: Jeff Hostetler
Message 3 of 14 in “routines to generate JSON data”
  1. routines to generate JSON datagit@jeffhostetler.com, Mar 26, 2018
  2. json_writer: new routines to create data in JSON formatgit@jeffhostetler.com, Mar 26, 2018
  3. Ramsay JonesMar 27, 2018
  4. Jeff HostetlerMar 27, 2018
  5. Ramsay JonesMar 27, 2018
  6. Jeff HostetlerMar 27, 2018
  7. Wink SavilleMar 27, 2018
  8. Randall S. BeckerMar 27, 2018
  9. Junio C HamanoMar 28, 2018
  10. Ramsay JonesMar 27, 2018
  11. Junio C HamanoMar 28, 2018
  12. Duy NguyenJun 2, 2018
  13. Jeff KingJun 2, 2018
  14. Jeff HostetlerJun 4, 2018

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.