Am 07.06.2018 um 16:12 schrieb git@xxxxxxxxxxxxxxxxx: > From: Jeff Hostetler <jeffhost@xxxxxxxxxxxxx> > > 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@xxxxxx> > Helped-by: Wink Saville <wink@xxxxxxxxxxx> > Helped-by: Ramsay Jones <ramsay@xxxxxxxxxxxxxxxxxxxx> > Signed-off-by: Jeff Hostetler <jeffhost@xxxxxxxxxxxxx> > --- > Makefile | 2 + > json-writer.c | 419 ++++++++++++++++++++++++++++++++ > json-writer.h | 113 +++++++++ > t/helper/test-json-writer.c | 572 ++++++++++++++++++++++++++++++++++++++++++++ > t/t0019-json-writer.sh | 236 ++++++++++++++++++ > 5 files changed, 1342 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 > > diff --git a/Makefile b/Makefile > index a1d8775..4ae6946 100644 > --- a/Makefile > +++ b/Makefile > @@ -666,6 +666,7 @@ TEST_PROGRAMS_NEED_X += test-fake-ssh > TEST_PROGRAMS_NEED_X += test-genrandom > TEST_PROGRAMS_NEED_X += test-hashmap > TEST_PROGRAMS_NEED_X += test-index-version > +TEST_PROGRAMS_NEED_X += test-json-writer> TEST_PROGRAMS_NEED_X += test-lazy-init-name-hash > TEST_PROGRAMS_NEED_X += test-line-buffer > TEST_PROGRAMS_NEED_X += test-match-trees This doesn't apply cleanly on master, because most test helpers have been combined into a single binary to reduce their disk footprint and link times. See efd71f8913 (t/helper: add an empty test-tool program) for the overall rationale. test-json-writer could become a built-in as well, I think. You can see e.g. in c932a5ff28 (t/helper: merge test-string-list into test-tool) what needs to be done to convert a helper. René