mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
builtin/repo: add keyvalue and nul format for structure stats
All repository structure stats are outputted in a human-friendly table form. This format is not suitable for machine parsing. Add a --format option that supports three output modes: `table`, `keyvalue`, and `nul`. The `table` mode is the default format and prints the same table output as before. With the `keyvalue` mode, each line of output contains a key-value pair of a repository stat. The '=' character is used to delimit between keys and values. The `nul` mode is similar to `keyvalue`, but key-values are delimited by a NUL character instead of a newline. Also, instead of a '=' character to delimit between keys and values, a newline character is used. This allows stat values to support special characters without having to cquote them. These two new modes provides output that is more machine-friendly. Signed-off-by: Justin Tobler <jltobler@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
eb5cf58ffc
commit
17215675b5
@@ -9,7 +9,7 @@ SYNOPSIS
|
||||
--------
|
||||
[synopsis]
|
||||
git repo info [--format=(keyvalue|nul)] [-z] [<key>...]
|
||||
git repo structure
|
||||
git repo structure [--format=(table|keyvalue|nul)]
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
@@ -44,7 +44,7 @@ supported:
|
||||
+
|
||||
`-z` is an alias for `--format=nul`.
|
||||
|
||||
`structure`::
|
||||
`structure [--format=(table|keyvalue|nul)]`::
|
||||
Retrieve statistics about the current repository structure. The
|
||||
following kinds of information are reported:
|
||||
+
|
||||
@@ -52,7 +52,26 @@ supported:
|
||||
* Reachable object counts categorized by type
|
||||
|
||||
+
|
||||
The table output format may change and is not intended for machine parsing.
|
||||
The output format can be chosen through the flag `--format`. Three formats are
|
||||
supported:
|
||||
+
|
||||
`table`:::
|
||||
Outputs repository stats in a human-friendly table. This format may
|
||||
change and is not intended for machine parsing. This is the default
|
||||
format.
|
||||
|
||||
`keyvalue`:::
|
||||
Each line of output contains a key-value pair for a repository stat.
|
||||
The '=' character is used to delimit between the key and the value.
|
||||
Values containing "unusual" characters are quoted as explained for the
|
||||
configuration variable `core.quotePath` (see linkgit:git-config[1]).
|
||||
|
||||
`nul`:::
|
||||
Similar to `keyvalue`, but uses a NUL character to delimit between
|
||||
key-value pairs instead of a newline. Also uses a newline character as
|
||||
the delimiter between the key and value instead of '='. Unlike the
|
||||
`keyvalue` format, values containing "unusual" characters are never
|
||||
quoted.
|
||||
|
||||
INFO KEYS
|
||||
---------
|
||||
|
||||
Reference in New Issue
Block a user