RFC cat-file: reuse ref-filter logic
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v2 posting 2/217 patches 0 repliesNew
- v6 RFC Latest15 patches 7 repliesIn review
- v5 RFC15 patches 6 repliesSuperseded
Earlier versions · 4
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v4 RFC | 14 patches | 4 replies | Superseded | |
| v3 RFC | 10 patches | 2 replies | Superseded | |
| v2 RFC posting 1/2 | 9 patches | 8 replies | Superseded | |
| v1 RFC | 8 patches | 17 replies | Superseded |
Patches in v6 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/15 | ref-filter: add obj-type check in grab contentsref-filter.c | +15 | 0 replies | |
| 2/15 | ref-filter: add %(raw) atomDocumentation/ ref-filter.c t/ | +337 | 1 reply | |
| 3/15 | ref-filter: --format=%(raw) re-support --perlDocumentation/ quote.c quote.h +2 more | +47 | 0 replies | |
| 4/15 | ref-filter: use non-const ref_format in *_atom_parser()builtin/ ref-filter.c ref-filter.h | +25 | 0 replies | |
| 5/15 | ref-filter: add %(rest) atomref-filter.c ref-filter.h t/ +3 more | +41 | 0 replies | |
| 6/15 | ref-filter: pass get_object() return value to their callersref-filter.c | +11 | 0 replies | |
| 7/15 | ref-filter: introduce free_ref_array_item_value() functionref-filter.c ref-filter.h | +10 | 0 replies | |
| 8/15 | ref-filter: add cat_file_mode in struct ref_formatref-filter.c ref-filter.h | +10 | 0 replies | |
| 9/15 | ref-filter: modify the error message and value in get_objectref-filter.c t/ | +3 | 0 replies | |
| 10/15 | cat-file: add has_object_file() checkbuiltin/ | +7 | 0 replies | |
| 11/15 | cat-file: change batch_objects parameter namebuiltin/ | +11 | 0 replies | |
| 12/15 | cat-file: reuse ref-filter logicDocumentation/ builtin/ t/ | +305 | 2 replies | |
| 13/15 | cat-file: reuse err buf in batch_object_write()builtin/ | +14 | 0 replies | |
| 14/15 | cat-file: re-implement --textconv, --filters optionsbuiltin/ ref-filter.c ref-filter.h | +65 | 0 replies | |
| 15/15 | ref-filter: remove grab_oid() functionref-filter.c | +9 | 0 replies |
Reviews trailers per patch
None of the 15 patches has a Reviewed-by or Acked-by.
| Patch | Christian Couder | Hariom Verma | Bagas Sanjaya | Ævar Arnfjörð Bjarmason | Felipe Contreras | Phillip Wood | Junio C Hamano | Olga Telezhnaya |
|---|---|---|---|---|---|---|---|---|
| 1/15 | Mentored-by | Mentored-by | Helped-by | |||||
| 2/15 | Mentored-by | Mentored-by | Helped-by | Helped-by | Helped-by | Helped-by | Helped-by | Based-on-patch-by |
| 3/15 | Helped-by | |||||||
| 4/15 | Mentored-by | Mentored-by | ||||||
| 5/15 | Mentored-by | Mentored-by | ||||||
| 6/15 | Mentored-by | Mentored-by | Helped-by | |||||
| 7/15 | Mentored-by | Mentored-by | Helped-by | |||||
| 8/15 | Mentored-by | Mentored-by | ||||||
| 9/15 | Mentored-by | Mentored-by | ||||||
| 10/15 | Mentored-by | Mentored-by | ||||||
| 11/15 | Mentored-by | Mentored-by | ||||||
| 12/15 | Mentored-by | Mentored-by | ||||||
| 13/15 | Mentored-by | Mentored-by | ||||||
| 14/15 | Mentored-by | Mentored-by | ||||||
| 15/15 | Mentored-by | Mentored-by |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 8 reviewers.
Cover letter [PATCH v6 00/15] [GSOC][RFC] cat-file: reuse ref-filter logic
This patch series make cat-file reuse ref-filter logic.
Change from last version:
1. Amend part of the description of git for-each-ref.txt.
2. Modify the code style.
3. Do not assign the 0 to the variable ret during it's initialization.
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-v6
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-980/adlternative/cat-file-batch-refactor-v6
Pull-Request: https://github.com/gitgitgadget/git/pull/980
Range-diff vs v5:
1: f72ad9cc5e8 = 1: f72ad9cc5e8 [GSOC] ref-filter: add obj-type check in grab contents
2: 4e473838b9d ! 2: d9bc50c4ae6 [GSOC] ref-filter: add %(raw) atom
@@ Commit message
Mentored-by: Christian Couder <[email protected]>
Mentored-by: Hariom Verma <[email protected]>
+ Helped-by: Bagas Sanjaya <[email protected]>
Helped-by: Ævar Arnfjörð Bjarmason <[email protected]>
Helped-by: Felipe Contreras <[email protected]>
Helped-by: Phillip Wood <[email protected]>
@@ Documentation/git-for-each-ref.txt: and `date` to extract the named component.
+ 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.
++`--perl` because the such language may not support arbitrary binary data in their
++string variable type.
+
The message in a commit or a tag object is `contents`, from which
`contents:<part>` can be used to extract various parts out of:
@@ t/t6300-for-each-ref.sh: test_atom refs/myblobs/first contents:body ""
+ printf " " >blob7 &&
+ >blob8 &&
+ obj=$(git hash-object -w blob1) &&
-+ git update-ref refs/myblobs/blob1 "$obj" &&
++ git update-ref refs/myblobs/blob1 "$obj" &&
+ obj=$(git hash-object -w blob2) &&
-+ git update-ref refs/myblobs/blob2 "$obj" &&
++ git update-ref refs/myblobs/blob2 "$obj" &&
+ obj=$(git hash-object -w blob3) &&
-+ git update-ref refs/myblobs/blob3 "$obj" &&
++ git update-ref refs/myblobs/blob3 "$obj" &&
+ obj=$(git hash-object -w blob4) &&
-+ git update-ref refs/myblobs/blob4 "$obj" &&
++ git update-ref refs/myblobs/blob4 "$obj" &&
+ obj=$(git hash-object -w blob5) &&
-+ git update-ref refs/myblobs/blob5 "$obj" &&
++ git update-ref refs/myblobs/blob5 "$obj" &&
+ obj=$(git hash-object -w blob6) &&
-+ git update-ref refs/myblobs/blob6 "$obj" &&
++ git update-ref refs/myblobs/blob6 "$obj" &&
+ obj=$(git hash-object -w blob7) &&
-+ git update-ref refs/myblobs/blob7 "$obj" &&
++ git update-ref refs/myblobs/blob7 "$obj" &&
+ obj=$(git hash-object -w blob8) &&
-+ git update-ref refs/myblobs/blob8 "$obj"
++ git update-ref refs/myblobs/blob8 "$obj"
+'
+
+test_expect_success 'Verify sorts with raw' ' 3: 765cf08a108 ! 3: 47f868f63d9 [GSOC] ref-filter: --format=%(raw) re-support --perl
@@ Documentation/git-for-each-ref.txt: 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 -+because the host language may not support arbitrary binary data in the
- variables of its string type.
+---perl because the such language may not support arbitrary binary data in their ++because the such language may not support arbitrary binary data in their
+ string variable type.
The message in a commit or a tag object is contents, from which
4: d2aeafd0ef3 = 4: debca156470 [GSOC] ref-filter: use non-const ref_format in *_atom_parser()
5: 1ca3a42f041 = 5: cb0df2b8207 [GSOC] ref-filter: add %(rest) atom
6: 67f1a3cca9a ! 6: 9873354930a [GSOC] ref-filter: pass get_object() return value to their callers
@@ ref-filter.c: static int populate_value(struct ref_array_item *ref, struct strbu
{
struct object *obj;
int i;
-+ int ret = 0;
++ int ret;
struct object_info empty = OBJECT_INFO_INIT;
CALLOC_ARRAY(ref->value, used_atom_cnt);
@@ ref-filter.c: int format_ref_array_item(struct ref_array_item *info,
{
const char *cp, *sp, *ep;
struct ref_formatting_state state = REF_FORMATTING_STATE_INIT;
-+ int ret = 0;
++ int ret;
state.quote_style = format->quote_style;
push_stack_element(&state.stack);
7: 2a48a48e81c = 7: e592c21ea1d [GSOC] ref-filter: introduce free_ref_array_item_value() function
8: be55005be75 = 8: b6e7757de4c [GSOC] ref-filter: add cat_file_mode in struct ref_format
9: 937f88b7837 = 9: 85686187d49 [GSOC] ref-filter: modify the error message and value in get_object
10: 45657499c55 = 10: 6037295ee58 [GSOC] cat-file: add has_object_file() check
11: bf5c0a017ad = 11: 32e1ca56389 [GSOC] cat-file: change batch_objects parameter name
12: 370101ba65f ! 12: 9a1f0732940 [GSOC] cat-file: reuse ref-filter logic
@@ builtin/cat-file.c: static void batch_write(struct batch_options *opt, const voi
- fflush(stdout);
- return;
- }
-+ int ret = 0;
++ int ret;
+ struct strbuf err = STRBUF_INIT;
+ struct ref_array_item item = { data->oid, data->rest };
@@ builtin/cat-file.c: static void batch_write(struct batch_options *opt, const voi
- print_object_or_die(opt, data);
- batch_write(opt, "\n", 1);
+ ret = format_ref_array_item(&item, &opt->format, scratch, &err);
-+ if (ret < 0) {
++ if (ret < 0)
+ die("%s\n", err.buf);
-+ } if (ret) {
++ if (ret) {
+ /* ret > 0 means when the object corresponding to oid
+ * cannot be found in format_ref_array_item(), we only print
+ * the error message. 13: 69eef47065d ! 13: 3fb47584924 [GSOC] cat-file: reuse err buf in batch_object_write()
@@ builtin/cat-file.c: static void batch_write(struct batch_options *opt, const voi
struct batch_options *opt,
struct expand_data *data)
{
- int ret = 0;
+ int ret;
- struct strbuf err = STRBUF_INIT;
struct ref_array_item item = { data->oid, data->rest };
@@ builtin/cat-file.c: static void batch_write(struct batch_options *opt, const voi
- ret = format_ref_array_item(&item, &opt->format, scratch, &err);
+ ret = format_ref_array_item(&item, &opt->format, scratch, err);
- if (ret < 0) {
+ if (ret < 0)
- die("%s\n", err.buf);
+ die("%s\n", err->buf);
- } if (ret) {
+ if (ret) {
/* ret > 0 means when the object corresponding to oid
* cannot be found in format_ref_array_item(), we only print
* the error message.
14: a7ac037a946 = 14: e0b1a05e711 [GSOC] cat-file: re-implement --textconv, --filters options 15: 843de8864a9 = 15: 891d62fd93f [GSOC] ref-filter: remove grab_oid() function
Signature · 1 line
gitgitgadget