-
Notifications
You must be signed in to change notification settings - Fork 133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[GSOC][RFC] ref-filter: add %(rest) atom #976
[GSOC][RFC] ref-filter: add %(rest) atom #976
Conversation
ce1c28a
to
5e95292
Compare
/submit |
Submitted as pull.976.git.1623163082.gitgitgadget@gmail.com To fetch this version into
To fetch this version to local tag
|
This branch is now known as |
This patch series was integrated into seen via git@c281d03. |
On the Git mailing list, Junio C Hamano wrote (reply to this):
|
On the Git mailing list, ZheNing Hu wrote (reply to this):
|
On the Git mailing list, Junio C Hamano wrote (reply to this):
|
5e95292
to
5a5b5f7
Compare
/submit |
Submitted as pull.976.v2.git.1623255121.gitgitgadget@gmail.com To fetch this version into
To fetch this version to local tag
|
There was a status update in the "Cooking" section about the branch Prepare the "ref-filter" machinery that drives the "--format" option of "git for-each-ref" and its friends to be used in "git cat-file --batch". |
This patch series was integrated into seen via git@59a0f86. |
This patch series was integrated into seen via git@881fcbd. |
This patch series was integrated into seen via git@f6bbc11. |
This patch series was integrated into seen via git@c5de0bc. |
There was a status update in the "Cooking" section about the branch Prepare the "ref-filter" machinery that drives the "--format" option of "git for-each-ref" and its friends to be used in "git cat-file --batch". |
This patch series was integrated into seen via git@97d0d54. |
There was a status update in the "Cooking" section about the branch Prepare the "ref-filter" machinery that drives the "--format" option of "git for-each-ref" and its friends to be used in "git cat-file --batch". This conflicts with the other topic on "cat-file --batch" by the same author. |
Only tag and commit objects use `grab_sub_body_contents()` to grab object contents in the current codebase. We want to teach the function to also handle blobs and trees to get their raw data, without parsing a blob (whose contents looks like a commit or a tag) incorrectly as a commit or a tag. Skip the block of code that is specific to handling commits and tags early when the given object is of a wrong type to help later addition to handle other types of objects in this function. Mentored-by: Christian Couder <christian.couder@gmail.com> Mentored-by: Hariom Verma <hariom18599@gmail.com> Helped-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: ZheNing Hu <adlternative@gmail.com>
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` depends on the output of the atom being text (specifically, no embedded NULs in it). E.g. `quote_formatting()` use `strbuf_addstr()` or `*._quote_buf()` add the data to the buffer. The raw data of a tree object is `100644 one\0...`, only the `100644 one` will be added to the buffer, which is incorrect. Therefore, we need to find a way to record the length of the atom_value's member `s`. Although strbuf can already record the string and its length, if we want to replace the type of atom_value's member `s` with strbuf, many places in ref-filter that are filled with dynamically allocated mermory in `v->s` are not easy to replace. At the same time, we need to check if `v->s == NULL` in populate_value(), and strbuf cannot easily distinguish NULL and empty strings, but c-style "const char *" can do it. So add a new member in `struct atom_value`: `s_size`, which can record raw object size, it 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. Mentored-by: Christian Couder <christian.couder@gmail.com> Mentored-by: Hariom Verma <hariom18599@gmail.com> Helped-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Helped-by: Felipe Contreras <felipe.contreras@gmail.com> Helped-by: Phillip Wood <phillip.wood@dunelm.org.uk> Helped-by: Junio C Hamano <gitster@pobox.com> Based-on-patch-by: Olga Telezhnaya <olyatelezhnaya@gmail.com> Signed-off-by: ZheNing Hu <adlternative@gmail.com>
Because the perl language can handle binary data correctly, add the function perl_quote_buf_with_len(), which can specify the length of the data and prevent the data from being truncated at '\0' to help `--format="%(raw)"` re-support `--perl`. Helped-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: ZheNing Hu <adlternative@gmail.com>
Use non-const ref_format in *_atom_parser(), which can help us modify the members of ref_format in *_atom_parser(). Mentored-by: Christian Couder <christian.couder@gmail.com> Mentored-by: Hariom Verma <hariom18599@gmail.com> Signed-off-by: ZheNing Hu <adlternative@gmail.com>
In order to let "cat-file --batch=%(rest)" use the ref-filter interface, add %(rest) atom for ref-filter. "git for-each-ref", "git branch", "git tag" and "git verify-tag" will reject %(rest) by default. Mentored-by: Christian Couder <christian.couder@gmail.com> Mentored-by: Hariom Verma <hariom18599@gmail.com> Signed-off-by: ZheNing Hu <adlternative@gmail.com>
5a5b5f7
to
39a0d93
Compare
There was a status update in the "Cooking" section about the branch Prepare the "ref-filter" machinery that drives the "--format" option of "git for-each-ref" and its friends to be used in "git cat-file --batch". This conflicts with the other topic on "cat-file --batch" by the same author. |
This patch series was integrated into seen via git@3c525b5. |
This patch series was integrated into seen via git@ce080dd. |
This patch series was integrated into seen via git@c8db213. |
This patch series was integrated into seen via git@01d69c2. |
This patch series was integrated into seen via git@e8a6112. |
This patch series was integrated into next via git@4c4529d. |
This patch series was integrated into seen via git@72ee1a2. |
This patch series was integrated into seen via git@30b8edb. |
This patch series was integrated into seen via git@0588156. |
There was a status update in the "Cooking" section about the branch Prepare the "ref-filter" machinery that drives the "--format" option of "git for-each-ref" and its friends to be used in "git cat-file --batch". Will cook in 'next'. |
This patch series was integrated into seen via git@3cd6276. |
This patch series was integrated into seen via git@076856e. |
There was a status update in the "Cooking" section about the branch Prepare the "ref-filter" machinery that drives the "--format" option of "git for-each-ref" and its friends to be used in "git cat-file --batch". Will cook in 'next'. |
This patch series was integrated into seen via git@d342a15. |
This patch series was integrated into seen via git@18426b1. |
There was a status update in the "Cooking" section about the branch Prepare the "ref-filter" machinery that drives the "--format" option of "git for-each-ref" and its friends to be used in "git cat-file --batch". Will cook in 'next'. |
This patch series was integrated into seen via git@4c4529d. |
This patch series was integrated into seen via git@aa00842. |
This patch series was integrated into seen via git@884fcb3. |
There was a status update in the "Cooking" section about the branch Prepare the "ref-filter" machinery that drives the "--format" option of "git for-each-ref" and its friends to be used in "git cat-file --batch". Will cook in 'next'. |
This patch series was integrated into seen via git@1bd338f. |
This patch series was integrated into seen via git@50faa16. |
There was a status update in the "Cooking" section about the branch Prepare the "ref-filter" machinery that drives the "--format" option of "git for-each-ref" and its friends to be used in "git cat-file --batch". Will cook in 'next'. |
This patch series was integrated into seen via git@1b66e8e. |
This patch series was integrated into next via git@5c06fb4. |
There was a status update in the "Cooking" section about the branch Originally merged to 'next' on 2021-08-04 Prepare the "ref-filter" machinery that drives the "--format" option of "git for-each-ref" and its friends to be used in "git cat-file --batch". Will merge to 'master'. |
This patch series was integrated into seen via git@bda891e. |
This patch series was integrated into next via git@bda891e. |
This patch series was integrated into master via git@bda891e. |
Closed via bda891e. |
In order to let git cat-file --batch reuse ref-filter logic,
the atom %(rest) and %(raw) are added to ref-filter.
Change from last version:
--format=%(raw)
re-support--perl
.to replace atom_value's member
s
in thecommit message.
cc: Ævar Arnfjörð Bjarmason avarab@gmail.com
cc: Junio C Hamano gitster@pobox.com
cc: Christian Couder christian.couder@gmail.com
cc: Hariom Verma hariom18599@gmail.com
cc: Bagas Sanjaya bagasdotme@gmail.com