Re: [PATCH v3 3/5] [GSOC] ref-filter: --format=%(raw) re-support --perl
- From
ZheNing Hu <adlternative@gmail.com>
- Date
- Jul 25, 2021, 13:18 UTC
- Message-ID
- <CAOLTT8TR-nYePc65=gJ8DtbuXtOgLs+p52k80iGqLKH6rkMarQ@mail.gmail.com>
- In-Reply-To
- <CA+P7+xqYMt1TvDY-GO--Aw5n9L7_06e-TExszcsS5oWWtFUxsA@mail.gmail.com>
Jacob Keller <jacob.keller@gmail.com> 于2021年7月25日周日 下午4:27写道:
Show 21 quoted lines
> > On Sat, Jul 24, 2021 at 7:14 AM ZheNing Hu via GitGitGadget > <gitgitgadget@gmail.com> wrote: > > > > From: 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> > > --- > > I presume that we used to support raw with perl before in cat-file? It > did read a bit weird to see "Re-support" in the title, because the > previous patch which introduced the raw atom when in ref-filter code > never supported perl. Still, I think it's fairly clear either way and > that change wouldn't deserve a reroll on its own. >
No, we haven't support it. It can be said that this commit is only split from the previous commit. Therefore, "re-support" is indeed wrong. I will modify it.
Show 26 quoted lines
> Makes sense. Reviewed-by: Jacob Keller <jacob.keller@gmail.com>
>
> > @@ -1010,10 +1013,14 @@ int verify_ref_format(struct ref_format *format)
> > at = parse_ref_filter_atom(format, sp + 2, ep, &err);
> > if (at < 0)
> > die("%s", err.buf);
> > - if (format->quote_style && used_atom[at].atom_type == ATOM_RAW &&
> > - used_atom[at].u.raw_data.option == RAW_BARE)
> > +
> > + if ((format->quote_style == QUOTE_PYTHON ||
> > + format->quote_style == QUOTE_SHELL ||
> > + format->quote_style == QUOTE_TCL) &&
> > + used_atom[at].atom_type == ATOM_RAW &&
> > + used_atom[at].u.raw_data.option == RAW_BARE)
> > die(_("--format=%.*s cannot be used with"
> > - "--python, --shell, --tcl, --perl"), (int)(ep - sp - 2), sp + 2);
> > + "--python, --shell, --tcl"), (int)(ep - sp - 2), sp + 2);
> > cp = ep + 1;
> >
>
> Right, so now we have to check all of the format quote styles instead
> of just checking that its set to any of them, since we want to
> continue in the case of perl.
>
> Ok.
>Thanks. -- ZheNing Hu