size_t i;
/* If we want the whole block untouched, we can take the fast path. */
- if (!opts->only_trailers && !opts->unfold) {
+ if (!opts->only_trailers && !opts->unfold && !opts->filter) {
strbuf_add(out, info->trailer_start,
info->trailer_end - info->trailer_start);
return;
struct strbuf val = STRBUF_INIT;
parse_trailer(&tok, &val, NULL, trailer, separator_pos);
- if (opts->unfold)
- unfold_value(&val);
+ if (!opts->filter || opts->filter(&tok, opts->filter_data)) {
+ if (opts->unfold)
+ unfold_value(&val);
- strbuf_addf(out, "%s: %s\n", tok.buf, val.buf);
+ strbuf_addf(out, "%s: %s\n", tok.buf, val.buf);
+ }
strbuf_release(&tok);
strbuf_release(&val);