From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 72428C433EF for ; Thu, 2 Jun 2022 19:55:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237499AbiFBTzM (ORCPT ); Thu, 2 Jun 2022 15:55:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239156AbiFBTy6 (ORCPT ); Thu, 2 Jun 2022 15:54:58 -0400 Received: from pb-smtp2.pobox.com (pb-smtp2.pobox.com [64.147.108.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADD472AE04 for ; Thu, 2 Jun 2022 12:54:56 -0700 (PDT) Received: from pb-smtp2.pobox.com (unknown [127.0.0.1]) by pb-smtp2.pobox.com (Postfix) with ESMTP id DD35F1249D2; Thu, 2 Jun 2022 15:54:55 -0400 (EDT) (envelope-from junio@pobox.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type:content-transfer-encoding; s=sasl; bh=2DaTCh7qQkc/ YFSsV0sUI9Zb/vzB5ZSPZPUaIWAFwSU=; b=Yz6XO6Aduc+7viBbYxWa5Z8ySfoM 5XT1iOleAuqftU+r4m7U84ZBuv+yd+A2TA1cgTUkTVZWq37ys0ZH7RfTJk171hNA Lw1HoBqJGCNT/VLynoaCwFl0G4BP6KNvP/BYIJvjR3kVehCvWde2LF7il4wUa8lt DKwWQh/SrxwEHq8= Received: from pb-smtp2.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp2.pobox.com (Postfix) with ESMTP id D3B311249D1; Thu, 2 Jun 2022 15:54:55 -0400 (EDT) (envelope-from junio@pobox.com) Received: from pobox.com (unknown [34.83.92.57]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp2.pobox.com (Postfix) with ESMTPSA id 455051249D0; Thu, 2 Jun 2022 15:54:55 -0400 (EDT) (envelope-from junio@pobox.com) From: Junio C Hamano To: =?utf-8?B?w4Z2YXIgQXJuZmrDtnLDsA==?= Bjarmason Cc: git@vger.kernel.org, Bagas Sanjaya , Abhradeep Chakraborty , Josh Steadmon , Glen Choo , Andrei Rybak , Emily Shaffer Subject: Re: [PATCH v3 6/6] cache-tree.c: use bug() and BUG_if_bug() References: Date: Thu, 02 Jun 2022 12:54:53 -0700 In-Reply-To: (=?utf-8?B?IsOGdmFyIEFybmZqw7Zyw7A=?= Bjarmason"'s message of "Thu, 2 Jun 2022 14:25:37 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 X-Pobox-Relay-ID: DFC442E0-E2AD-11EC-B0EE-CB998F0A682E-77302942!pb-smtp2.pobox.com Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org =C3=86var Arnfj=C3=B6r=C3=B0 Bjarmason writes: > Change "BUG" output originally added in a97e4075a16 (Keep > rename/rename conflicts of intermediate merges while doing recursive > merge, 2007-03-31), and later made to say it was a "BUG" in > 19c6a4f8369 (merge-recursive: do not return NULL only to cause > segfault, 2010-01-21) to use the new bug() function. > > This gets the same job done with slightly less code, as we won't need > to prefix lines with "BUG: ". More importantly we'll now log the full > set of messages via trace2, before this we'd only log the one BUG() > invocation. > > We don't replace the last "BUG()" invocation with "BUG_if_bug()", as > in this case we're sure that we called bug() earlier, so there's no > need to make it a conditional. > > While we're at it let's replace "There" with "there" in the message, > i.e. not start a message with a capital letter, per the > CodingGuidelines. > > Signed-off-by: =C3=86var Arnfj=C3=B6r=C3=B0 Bjarmason > --- > cache-tree.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/cache-tree.c b/cache-tree.c > index 6752f69d515..63953bf7772 100644 > --- a/cache-tree.c > +++ b/cache-tree.c > @@ -692,12 +692,12 @@ struct tree* write_in_core_index_as_tree(struct r= epository *repo) { > ret =3D write_index_as_tree_internal(&o, index_state, was_valid, 0, N= ULL); > if (ret =3D=3D WRITE_TREE_UNMERGED_INDEX) { > int i; > - fprintf(stderr, "BUG: There are unmerged index entries:\n"); > + bug("there are unmerged index entries:"); > for (i =3D 0; i < index_state->cache_nr; i++) { > const struct cache_entry *ce =3D index_state->cache[i]; > if (ce_stage(ce)) > - fprintf(stderr, "BUG: %d %.*s\n", ce_stage(ce), > - (int)ce_namelen(ce), ce->name); > + bug("%d %.*s", ce_stage(ce), > + (int)ce_namelen(ce), ce->name); > } > BUG("unmerged index entries when writing inmemory index"); "git grep inmemory" shows no hits on the non-word. We say "in-core" often, and it is even in the name of the function this new messages is added ;-) Will tweak as this is a new message. Thanks.