Re: [PATCH v3 3/5] [GSOC] ref-filter: --format=%(raw) re-support --perl
From: ZheNing Hu <hidden>
Date: 2021-07-25 13:17:41
Jacob Keller [off-list ref] 于2021年7月25日周日 下午4:27写道:
On Sat, Jul 24, 2021 at 7:14 AM ZheNing Hu via GitGitGadget [off-list ref] wrote:quoted
From: ZheNing Hu <redacted> 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 [off-list ref] Signed-off-by: ZheNing Hu <redacted> ---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 [off-list ref]quoted
@@ -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