diff options
| author | Justin Tobler <jltobler@gmail.com> | 2025-03-19 13:34:08 -0500 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-03-21 03:40:02 -0700 |
| commit | c3d59c2e70c939c39cbeb545b30899d52b650dfc (patch) | |
| tree | 273253be1d971cff21eb6f6e72d0440b3e27c13c /Documentation | |
| parent | rev-list: refactor early option parsing (diff) | |
| download | git-c3d59c2e70c939c39cbeb545b30899d52b650dfc.tar.gz git-c3d59c2e70c939c39cbeb545b30899d52b650dfc.zip | |
rev-list: support delimiting objects with NUL bytes
When walking objects, git-rev-list(1) prints each object entry on a
separate line. Some options, such as `--objects`, may print additional
information about tree and blob object on the same line in the form:
$ git rev-list --objects <rev>
<tree/blob oid> SP [<path>] LF
Note that in this form the SP is appended regardless of whether the tree
or blob object has path information available. Paths containing a
newline are also truncated at the newline.
Introduce the `-z` option for git-rev-list(1) which reformats the output
to use NUL-delimiters between objects and associated info in the
following form:
$ git rev-list -z --objects <rev>
<oid> NUL [path=<path> NUL]
In this form, the start of each record is signaled by an OID entry that
is all hexidecimal and does not contain any '='. Additional path info
from `--objects` is appended to the record as a token/value pair
`path=<path>` as-is without any truncation.
For now, the `--objects` flag is the only options that can be used in
combination with `-z`. In a subsequent commit, NUL-delimited support for
other options is added. Other options that do not make sense when used
in combination with `-z` are rejected.
Signed-off-by: Justin Tobler <jltobler@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation')
| -rw-r--r-- | Documentation/rev-list-options.adoc | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Documentation/rev-list-options.adoc b/Documentation/rev-list-options.adoc index 785c0786e0..aef83813b8 100644 --- a/Documentation/rev-list-options.adoc +++ b/Documentation/rev-list-options.adoc @@ -361,6 +361,27 @@ ifdef::git-rev-list[] --progress=<header>:: Show progress reports on stderr as objects are considered. The `<header>` text will be printed with each progress update. + +-z:: + Instead of being newline-delimited, each outputted object and its + accompanying metadata is delimited using NUL bytes. Output is printed + in the following form: ++ +----------------------------------------------------------------------- +<OID> NUL [<token>=<value> NUL]... +----------------------------------------------------------------------- ++ +Additional object metadata, such as object paths, is printed using the +`<token>=<value>` form. Token values are printed as-is without any +encoding/truncation. An OID entry never contains a '=' character and thus +is used to signal the start of a new object record. Examples: ++ +----------------------------------------------------------------------- +<OID> NUL +<OID> NUL path=<path> NUL +----------------------------------------------------------------------- ++ +This mode is only compatible with the `--objects` output option. endif::git-rev-list[] History Simplification |
