This patch series make cat-file reuse ref-filter logic. Change from last version: 1. At the suggestion of Bagas Sanjaya, modified the expression of submitted information. 2. Remove grab_oid() function in ref-filter to reduce repeated checks. ZheNing Hu (15): [GSOC] ref-filter: add obj-type check in grab contents [GSOC] ref-filter: add %(raw) atom [GSOC] ref-filter: --format=%(raw) re-support --perl [GSOC] ref-filter: use non-const ref_format in *_atom_parser() [GSOC] ref-filter: add %(rest) atom [GSOC] ref-filter: pass get_object() return value to their callers [GSOC] ref-filter: introduce free_ref_array_item_value() function [GSOC] ref-filter: add cat_file_mode in struct ref_format [GSOC] ref-filter: modify the error message and value in get_object [GSOC] cat-file: add has_object_file() check [GSOC] cat-file: change batch_objects parameter name [GSOC] cat-file: reuse ref-filter logic [GSOC] cat-file: reuse err buf in batch_object_write() [GSOC] cat-file: re-implement --textconv, --filters options [GSOC] ref-filter: remove grab_oid() function Documentation/git-cat-file.txt | 6 + Documentation/git-for-each-ref.txt | 9 + builtin/cat-file.c | 277 ++++++---------------- builtin/tag.c | 2 +- quote.c | 17 ++ quote.h | 1 + ref-filter.c | 357 ++++++++++++++++++++++------- ref-filter.h | 14 +- t/t1006-cat-file.sh | 252 ++++++++++++++++++++ t/t3203-branch-output.sh | 4 + t/t6300-for-each-ref.sh | 235 +++++++++++++++++++ t/t6301-for-each-ref-errors.sh | 2 +- t/t7004-tag.sh | 4 + t/t7030-verify-tag.sh | 4 + 14 files changed, 888 insertions(+), 296 deletions(-) base-commit: 1197f1a46360d3ae96bd9c15908a3a6f8e562207 Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-980%2Fadlternative%2Fcat-file-batch-refactor-v5 Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-980/adlternative/cat-file-batch-refactor-v5 Pull-Request: https://github.com/gitgitgadget/git/pull/980 Range-diff vs v4: 1: f72ad9cc5e8 = 1: f72ad9cc5e8 [GSOC] ref-filter: add obj-type check in grab contents 2: ab497d66c11 ! 2: 4e473838b9d [GSOC] ref-filter: add %(raw) atom @@ Commit message can help us add raw object data to the buffer or compare two buffers which contain raw object data. - Beyond, `--format=%(raw)` cannot be used with `--python`, `--shell`, - `--tcl`, `--perl` because if our binary raw data is passed to a - variable in the host language, the host language may not support - arbitrary binary data in the variables of its string type. + Note that `--format=%(raw)` cannot be used with `--python`, `--shell`, + `--tcl`, and `--perl` because if the binary raw data is passed to a + variable in such languages, these may not support arbitrary binary data + in their string variable type. Mentored-by: Christian Couder <christian.couder@xxxxxxxxx> Mentored-by: Hariom Verma <hariom18599@xxxxxxxxx> 3: b54dbc431e0 = 3: 765cf08a108 [GSOC] ref-filter: --format=%(raw) re-support --perl 4: 9fbbb3c492f = 4: d2aeafd0ef3 [GSOC] ref-filter: use non-const ref_format in *_atom_parser() 5: 08aa44e5e57 = 5: 1ca3a42f041 [GSOC] ref-filter: add %(rest) atom 6: 05682bccf9f ! 6: 67f1a3cca9a [GSOC] ref-filter: pass get_object() return value to their callers @@ Metadata ## Commit message ## [GSOC] ref-filter: pass get_object() return value to their callers - Since in the refactor of `git cat-file --batch` later, + Because in the refactor of `git cat-file --batch` later, oid_object_info_extended() in get_object() will be used to obtain the info of an object with it's oid. When the object cannot be obtained in the git repository, `cat-file --batch` expects to output 7: 06db6cd6f1f = 7: 2a48a48e81c [GSOC] ref-filter: introduce free_ref_array_item_value() function 8: b0d9e139935 = 8: be55005be75 [GSOC] ref-filter: add cat_file_mode in struct ref_format 9: db7dd8b042c = 9: 937f88b7837 [GSOC] ref-filter: modify the error message and value in get_object 10: 6b577969734 = 10: 45657499c55 [GSOC] cat-file: add has_object_file() check 11: 069aa203666 ! 11: bf5c0a017ad [GSOC] cat-file: change batch_objects parameter name @@ Metadata ## Commit message ## [GSOC] cat-file: change batch_objects parameter name - Since cat-file reuses ref-filter logic later will add the - formal parameter "const struct option *options" to - batch_objects(), the two synonymous parameters of "opt" - and "options" may confuse readers, so change batch_options - parameter of batch_objects() from "opt" to "batch". + Because later cat-file reuses ref-filter logic that will add + parameter "const struct option *options" to batch_objects(), + the two synonymous parameters of "opt" and "options" may + confuse readers, so change batch_options parameter of + batch_objects() from "opt" to "batch". Mentored-by: Christian Couder <christian.couder@xxxxxxxxx> Mentored-by: Hariom Verma <hariom18599@xxxxxxxxx> 12: 258ec0a46c5 = 12: 370101ba65f [GSOC] cat-file: reuse ref-filter logic 13: bda6aae9a6c = 13: 69eef47065d [GSOC] cat-file: reuse err buf in batch_object_write() 14: d1114a2bd74 = 14: a7ac037a946 [GSOC] cat-file: re-implement --textconv, --filters options -: ----------- > 15: 843de8864a9 [GSOC] ref-filter: remove grab_oid() function -- gitgitgadget