Re: [PATCH v6 03/13] pkt-line: add packet_write_fmt_gently()

2016-08-26 Thread Jeff King
On Fri, Aug 26, 2016 at 10:10:50AM -0700, Junio C Hamano wrote: > Lars Schneider writes: > > > I agree with your criticism of the code duplication. > > > > However, I thought it would be OK, as Peff already > > tried to refactor it... > > http://public-inbox.org/git/20160810150139.lpxyrqkr53s5

Re: [PATCH v6 03/13] pkt-line: add packet_write_fmt_gently()

2016-08-26 Thread Junio C Hamano
Lars Schneider writes: > I agree with your criticism of the code duplication. > > However, I thought it would be OK, as Peff already > tried to refactor it... > http://public-inbox.org/git/20160810150139.lpxyrqkr53s5f...@sigill.intra.peff.net/ > > ... and I got the impression you agreed with Pe

Re: [PATCH v6 03/13] pkt-line: add packet_write_fmt_gently()

2016-08-26 Thread Lars Schneider
> On 25 Aug 2016, at 23:41, Junio C Hamano wrote: > > larsxschnei...@gmail.com writes: > >> From: Lars Schneider >> >> packet_write_fmt() would die in case of a write error even though for >> some callers an error would be acceptable. Add packet_write_fmt_gently() >> which writes a formatted

Re: [PATCH v6 03/13] pkt-line: add packet_write_fmt_gently()

2016-08-25 Thread Junio C Hamano
larsxschnei...@gmail.com writes: > From: Lars Schneider > > packet_write_fmt() would die in case of a write error even though for > some callers an error would be acceptable. Add packet_write_fmt_gently() > which writes a formatted pkt-line and returns `0` for success and `-1` > for an error. > >

Re: [PATCH v6 03/13] pkt-line: add packet_write_fmt_gently()

2016-08-25 Thread Lars Schneider
On 25 Aug 2016, at 20:12, Stefan Beller wrote: >> +int packet_write_fmt_gently(int fd, const char *fmt, ...) >> +{ >> + static struct strbuf buf = STRBUF_INIT; >> + va_list args; >> + >> + strbuf_reset(&buf); >> + va_start(args, fmt); >> + format_packet(&buf, fmt, ar

Re: [PATCH v6 03/13] pkt-line: add packet_write_fmt_gently()

2016-08-25 Thread Stefan Beller
> +int packet_write_fmt_gently(int fd, const char *fmt, ...) > +{ > + static struct strbuf buf = STRBUF_INIT; > + va_list args; > + > + strbuf_reset(&buf); > + va_start(args, fmt); > + format_packet(&buf, fmt, args); format_packet also takes care of tracing the conten