From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-4.9 required=3.0 tests=AWL,BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, MALFORMED_FREEMAIL,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by dcvr.yhbt.net (Postfix) with ESMTP id 13DED1F71B for ; Mon, 1 Aug 2016 09:19:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751559AbcHAJTJ (ORCPT ); Mon, 1 Aug 2016 05:19:09 -0400 Received: from mout.gmx.net ([212.227.15.18]:59692 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751132AbcHAJTG (ORCPT ); Mon, 1 Aug 2016 05:19:06 -0400 Received: from virtualbox ([37.24.142.100]) by mail.gmx.com (mrgmx002) with ESMTPSA (Nemesis) id 0MX1hk-1bp8eY0Y7w-00VxM4; Mon, 01 Aug 2016 11:18:54 +0200 Date: Mon, 1 Aug 2016 11:18:52 +0200 (CEST) From: Johannes Schindelin X-X-Sender: virtualbox@virtualbox To: Junio C Hamano cc: git@vger.kernel.org, Eric Sunshine , Jeff King , Johannes Sixt , Duy Nguyen , =?UTF-8?Q?Jakub_Nar=C4=99bski?= Subject: Re: [PATCH v5 12/16] merge-recursive: flush output buffer before printing error messages In-Reply-To: Message-ID: References: <349bdfacfffa11d06241655c9e0b62506e58758b.1469547160.git.johannes.schindelin@gmx.de> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Provags-ID: V03:K0:94BUuNuK+hFzNgrReEK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RH Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Hi Junio, On Wed, 27 Jul 2016, Junio C Hamano wrote: > Johannes Schindelin writes: > > > The data structure passed to the recursive merge machinery has a feature > > where the caller can ask for the output to be buffered into a strbuf, by > > setting the field 'buffer_output'. > > > > Previously, we simply swallowed the buffered output when showing error > > messages. With this patch, we show the output first, and only then print > > the error message. > > I didn't quite understand this paragraph until I realized that you > meant "when showing die message". We died without flushing, losing > accumulated output. I rephrased it, using your explanation. > > +static int err(struct merge_options *o, const char *err, ...) > > +{ > > + va_list params; > > + > > + va_start(params, err); > > + flush_output(o); > > I would have written the above two swapped; va_start() logically > is about what happens in the next four lines. For some reason, I thought that `va_start()` must be the first statement of the function. Fixed. > > + strbuf_vaddf(&o->obuf, err, params); > > + error("%s", o->obuf.buf); > > + strbuf_reset(&o->obuf); > > Sneaky ;-) Thanks ;-) Dscho