Re: [PATCH v2 2/2] [GSOC] ref-filter: add %(raw) atom
From: Christian Couder <hidden>
Date: 2021-06-04 13:25:23
On Fri, Jun 4, 2021 at 2:12 PM ZheNing Hu via GitGitGadget [off-list ref] wrote:
From: ZheNing Hu <redacted> Add new formatting option `%(raw)`, which will print the raw object data without any changes. It will help further to migrate all cat-file formatting logic from cat-file to ref-filter. The raw data of blob, tree objects may contain '\0', but most of the logic in `ref-filter` depands on the output of the atom being
s/depands/depends/
text (specifically, no embedded NULs in it).
quoted hunk ↗ jump to hunk
diff --git a/Documentation/git-for-each-ref.txt b/Documentation/git-for-each-ref.txt index 2ae2478de706..8f8d8cd1e04f 100644 --- a/Documentation/git-for-each-ref.txt +++ b/Documentation/git-for-each-ref.txt@@ -235,6 +235,15 @@ and `date` to extract the named component. For email fields (`authoremail`, without angle brackets, and `:localpart` to get the part before the `@` symbol out of the trimmed email. +The raw data in a object is `raw`.
s/a object/an object/
+ +raw:size:: + The raw data size of the object. + +Note that `--format=%(raw)` can not be used with `--python`, `--shell`, `--tcl`, +`--perl` because the host language may not support arbitrary binary data in the +variables of its string type.
quoted hunk ↗ jump to hunk
@@ -1765,7 +1815,7 @@ static int populate_value(struct ref_array_item *ref, struct strbuf *err) int deref = 0; const char *refname; struct branch *branch = NULL; - + v->s_size = ATOM_VALUE_S_SIZE_INIT;
It looks like a blank line was removed as you added the above new line.
v->handler = append_atom;
v->atom = atom;