Re: [PATCH v2 5/5] pretty: add support for separator option in %(trailers)

2018-11-05 Thread Junio C Hamano
Anders Waldenborg writes: > AFAICU strbuf_expand doesn't suffer from the worst things that printf(3) > suffers from wrt untrusted format string (i.e no printf style %n which > can write to memory, and no vaargs on stack which allows leaking random > stuff). > > The separator option is part of

Re: [PATCH v2 5/5] pretty: add support for separator option in %(trailers)

2018-11-05 Thread Anders Waldenborg
Junio C Hamano writes: > Anders Waldenborg writes: > >> @@ -1352,6 +1353,17 @@ static size_t format_commit_one(struct strbuf *sb, /* >> in UTF-8 */ >> arg++; >> >> opts.only_trailers = 1; >> +

Re: [PATCH v2 5/5] pretty: add support for separator option in %(trailers)

2018-11-04 Thread Junio C Hamano
Anders Waldenborg writes: > + if (opts->separator && first_printed) > + strbuf_addbuf(out, opts->separator); > if (opts->no_key) > - strbuf_addf(out, "%s\n",

Re: [PATCH v2 5/5] pretty: add support for separator option in %(trailers)

2018-11-04 Thread Junio C Hamano
Anders Waldenborg writes: > @@ -1352,6 +1353,17 @@ static size_t format_commit_one(struct strbuf *sb, /* > in UTF-8 */ > arg++; > > opts.only_trailers = 1; > + } else if

[PATCH v2 5/5] pretty: add support for separator option in %(trailers)

2018-11-04 Thread Anders Waldenborg
By default trailer lines are terminated by linebreaks ('\n'). By specifying the new 'separator' option they will instead be separated by user provided string and have separator semantics rather than terminator semantics. The separator string can contain the fundamental formatting codes %n and %xNN