Re: [PATCH v5 05/15] pkt-line: add packet_write_gently_fmt()

2016-08-10 Thread Lars Schneider
> On 10 Aug 2016, at 15:43, Jeff King wrote: > > On Wed, Aug 10, 2016 at 03:04:01PM +0200, larsxschnei...@gmail.com wrote: > >> +int packet_write_gently_fmt(int fd, const char *fmt, ...) >> +{ >> +static struct strbuf buf = STRBUF_INIT; >> +va_list args; >> + >> +

Re: [PATCH v5 05/15] pkt-line: add packet_write_gently_fmt()

2016-08-10 Thread Junio C Hamano
Jeff King writes: > On Wed, Aug 10, 2016 at 03:04:01PM +0200, larsxschnei...@gmail.com wrote: > >> +int packet_write_gently_fmt(int fd, const char *fmt, ...) >> +{ >> +static struct strbuf buf = STRBUF_INIT; >> +va_list args; >> + >> +strbuf_reset(); >> +

Re: [PATCH v5 05/15] pkt-line: add packet_write_gently_fmt()

2016-08-10 Thread Jeff King
On Wed, Aug 10, 2016 at 04:10:02PM +0200, Lars Schneider wrote: > > > On 10 Aug 2016, at 15:43, Jeff King wrote: > > > > On Wed, Aug 10, 2016 at 03:04:01PM +0200, larsxschnei...@gmail.com wrote: > > > >> +int packet_write_gently_fmt(int fd, const char *fmt, ...) > >> +{ > >> +

Re: [PATCH v5 05/15] pkt-line: add packet_write_gently_fmt()

2016-08-10 Thread Jeff King
On Wed, Aug 10, 2016 at 03:04:01PM +0200, larsxschnei...@gmail.com wrote: > +int packet_write_gently_fmt(int fd, const char *fmt, ...) > +{ > + static struct strbuf buf = STRBUF_INIT; > + va_list args; > + > + strbuf_reset(); > + va_start(args, fmt); > + format_packet(1, ,

[PATCH v5 05/15] pkt-line: add packet_write_gently_fmt()

2016-08-10 Thread larsxschneider
From: Lars Schneider packet_write() would die in case of a write error even though for some callers an error would be acceptable. Add packet_write_gently_fmt() which writes a formatted pkt-line and returns `0` for success and `-1` for an error. Signed-off-by: Lars

Re: [PATCH v5 05/15] pkt-line: add packet_write_gently_fmt()

2016-08-10 Thread Junio C Hamano
Lars Schneider writes: >>> Similarly, I'd think this could share code with the non-gentle form >>> (which should be able to just call this and die() if returns an error). >>> Though sometimes the va_list transformation makes that awkward. >> >> Yes. > > Peff just

Re: [PATCH v5 05/15] pkt-line: add packet_write_gently_fmt()

2016-08-10 Thread Lars Schneider
> On 10 Aug 2016, at 19:18, Junio C Hamano wrote: > > Jeff King writes: > >> On Wed, Aug 10, 2016 at 03:04:01PM +0200, larsxschnei...@gmail.com wrote: >> >>> +int packet_write_gently_fmt(int fd, const char *fmt, ...) >>> +{ >>> + static struct strbuf buf =