Re: [PATCH 02/15] [GSOC] ref-filter: add %(raw) atom
From: ZheNing Hu <hidden>
Date: 2021-07-03 05:14:21
Ævar Arnfjörð Bjarmason [off-list ref] 于2021年7月2日周五 下午9:27写道:
On Thu, Jul 01 2021, ZheNing Hu via GitGitGadget wrote:quoted
@@ -1362,17 +1398,29 @@ static void grab_sub_body_contents(struct atom_value *val, int deref, struct exp const char *subpos = NULL, *bodypos = NULL, *sigpos = NULL; size_t sublen = 0, bodylen = 0, nonsiglen = 0, siglen = 0; void *buf = data->content; + unsigned long buf_size = data->size;Let's declare this.quoted
for (i = 0; i < used_atom_cnt; i++) { struct used_atom *atom = &used_atom[i]; const char *name = atom->name; struct atom_value *v = &val[i]; + enum atom_type atom_type = atom->atom_type; if (!!deref != (*name == '*')) continue; if (deref) name++; + if (atom_type == ATOM_RAW) {Here, where it's going to be used.
Yeah, buf_size is only used here.
quoted
diff --git a/t/t6300-for-each-ref.sh b/t/t6300-for-each-ref.sh index 9e0214076b4..18554f62d94 100755 --- a/t/t6300-for-each-ref.sh +++ b/t/t6300-for-each-ref.sh@@ -130,6 +130,8 @@ test_atom head parent:short=10 '' test_atom head numparent 0 test_atom head object '' test_atom head type '' +test_atom head raw "$(git cat-file commit refs/heads/main) +"Extra stay line here, is the \n intentional?
I think so. `\n` is necessary.
In cmd_for_each_ref(), there have a extern "putchar('\n');"
In cat_one_file(), write_or_die() output origin data of the object.
Thanks.
--
ZheNing Hu