diff options
| author | Jeff Hostetler <jeffhost@microsoft.com> | 2018-07-13 16:54:08 +0000 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2018-07-16 13:55:39 -0700 |
| commit | 75459410edd8d3bf38a2f1ad785f54b97770b324 (patch) | |
| tree | 2b5d0ed8135d0e2649ebf26f577f26030fb185af /t/helper/test-tool.c | |
| parent | b2453d34496cb62b9c63c7a7c9b4bead2431f715 (diff) | |
| download | git-75459410edd8d3bf38a2f1ad785f54b97770b324.tar.gz | |
json_writer: new routines to create JSON data
Add "struct json_writer" and a series of jw_ routines to compose JSON
data into a string buffer. The resulting string may then be printed by
commands wanting to support a JSON-like output format.
The json_writer is limited to correctly formatting structured data for
output. It does not attempt to build an object model of the JSON data.
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 Linux 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.
Helped-by: Eric Sunshine <sunshine@sunshineco.com>
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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/helper/test-tool.c')
| -rw-r--r-- | t/helper/test-tool.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c index 805a45de9c..707499e113 100644 --- a/t/helper/test-tool.c +++ b/t/helper/test-tool.c @@ -19,6 +19,7 @@ static struct test_cmd cmds[] = { { "genrandom", cmd__genrandom }, { "hashmap", cmd__hashmap }, { "index-version", cmd__index_version }, + { "json-writer", cmd__json_writer }, { "lazy-init-name-hash", cmd__lazy_init_name_hash }, { "match-trees", cmd__match_trees }, { "mergesort", cmd__mergesort }, |
