Jacob Keller <jacob.keller@xxxxxxxxx> 于2021年7月25日周日 下午4:27写道: > > On Sat, Jul 24, 2021 at 7:14 AM ZheNing Hu via GitGitGadget > <gitgitgadget@xxxxxxxxx> wrote: > > > > From: ZheNing Hu <adlternative@xxxxxxxxx> > > > > 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@xxxxxxxxx> > > Signed-off-by: ZheNing Hu <adlternative@xxxxxxxxx> > > --- > > 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. > Makes sense. Reviewed-by: Jacob Keller <jacob.keller@xxxxxxxxx> > > > @@ -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