Re: [PATCH 02/15] [GSOC] ref-filter: add %(raw) atom
- From
ZheNing Hu <adlternative@gmail.com>
- Date
- Jul 3, 2021, 05:14 UTC
- Message-ID
- <CAOLTT8QjGekriRWFp_HM0Cqiz4TYB_=cN7bBxhCSdZqzg4BG0w@mail.gmail.com>
- In-Reply-To
- <87im1salrd.fsf@evledraar.gmail.com>
Ævar Arnfjörð Bjarmason <avarab@gmail.com> 于2021年7月2日周五 下午9:27写道:
Show 27 quoted lines
>
>
> On Thu, Jul 01 2021, ZheNing Hu via GitGitGadget wrote:
>
> > @@ -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.
>
> > 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.
Show 12 quoted lines
> > 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