From patchwork Tue Dec 7 00:24:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Junio C Hamano X-Patchwork-Id: 12660615 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 DEE21C433F5 for ; Tue, 7 Dec 2021 00:24:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378260AbhLGA1e (ORCPT ); Mon, 6 Dec 2021 19:27:34 -0500 Received: from pb-smtp2.pobox.com ([64.147.108.71]:64345 "EHLO pb-smtp2.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232085AbhLGA1e (ORCPT ); Mon, 6 Dec 2021 19:27:34 -0500 Received: from pb-smtp2.pobox.com (unknown [127.0.0.1]) by pb-smtp2.pobox.com (Postfix) with ESMTP id 3598F10AD89; Mon, 6 Dec 2021 19:24:04 -0500 (EST) (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=F8zqaB3XEff8 SfKVMRpELkQQyTCLe6LBqmX0zUi1T1I=; b=vRgdjfFuEuVvGSBnJ+wxNuRbiRLB 7/0eu3xc1LAwIt1Klv9n/BnW0ypTtugcxpMhPTAXqiKun/KMOmtzyLVooyVA/E30 cSHE8eJsp4OdwhPJyAe5jg9LjeoE+BMgpFRXN/Q6VUoG9AIN9VtEaNvMu44c7hQu qZXDm/9kqvIxm8E= Received: from pb-smtp2.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp2.pobox.com (Postfix) with ESMTP id D2A7410AD88; Mon, 6 Dec 2021 19:24:03 -0500 (EST) (envelope-from junio@pobox.com) Received: from pobox.com (unknown [104.133.2.91]) (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 E86FC10AD87; Mon, 6 Dec 2021 19:24:02 -0500 (EST) (envelope-from junio@pobox.com) From: Junio C Hamano To: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsA==?= Bjarmason Cc: git@vger.kernel.org, =?utf-8?b?UmVuw6k=?= Scharfe , Johannes Schindelin Subject: [PATCH 3/2] replace die("BUG: ...") with BUG("...") References: Date: Mon, 06 Dec 2021 16:24:01 -0800 In-Reply-To: ( =?utf-8?b?IsOGdmFyCUFybmZqw7Zyw7A=?= Bjarmason"'s message of "Mon, 6 Dec 2021 17:25:19 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Pobox-Relay-ID: FAFF354C-56F3-11EC-AF83-C48D900A682E-77302942!pb-smtp2.pobox.com Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Ævar Arnfjörð Bjarmason writes: > A trivial clean-up to change a couple of die() uses to BUG() where > appropriate. This is split off from an earlier RFC series I sent > in[1], as the range-diff to the relevant patches there shown there are > no changes since then. > > 1. https://lore.kernel.org/git/RFC-patch-07.21-3f897bf6b0e-20211115T220831Z-avarab@gmail.com/ > > Ævar Arnfjörð Bjarmason (2): > pack-objects: use BUG(...) not die("BUG: ...") > strbuf.h: use BUG(...) not die("BUG: ...") > > builtin/pack-objects.c | 2 +- > strbuf.h | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > Range-diff: > 1: 2507ea71700 = 1: 2a17ed9f135 pack-objects: use BUG(...) not die("BUG: ...") > 2: 5dedcee3fb0 = 2: ab89fec50c3 strbuf.h: use BUG(...) not die("BUG: ...") There are a bit more that you didn't include and I am having a hard time guessing why. object.c | 2 +- pathspec.h | 3 +-- tree-diff.c | 3 +-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git c/object.c w/object.c index 23a24e678a..4be82c1e7b 100644 --- c/object.c +++ w/object.c @@ -199,7 +199,7 @@ struct object *lookup_object_by_type(struct repository *r, case OBJ_BLOB: return (struct object *)lookup_blob(r, oid); default: - die("BUG: unknown object type %d", type); + BUG("unknown object type %d", type); } } diff --git c/pathspec.h w/pathspec.h index 2341dc9901..402ebb8080 100644 --- c/pathspec.h +++ w/pathspec.h @@ -58,8 +58,7 @@ struct pathspec { #define GUARD_PATHSPEC(ps, mask) \ do { \ if ((ps)->magic & ~(mask)) \ - die("BUG:%s:%d: unsupported magic %x", \ - __FILE__, __LINE__, (ps)->magic & ~(mask)); \ + BUG("unsupported magic %x", (ps)->magic & ~(mask)); \ } while (0) /* parse_pathspec flags */ diff --git c/tree-diff.c w/tree-diff.c index 437c98a70e..69031d7cba 100644 --- c/tree-diff.c +++ w/tree-diff.c @@ -603,8 +603,7 @@ static void try_to_follow_renames(const struct object_id *old_oid, * about dry-run mode and returns wildcard info. */ if (opt->pathspec.has_wildcard) - die("BUG:%s:%d: wildcards are not supported", - __FILE__, __LINE__); + BUG("wildcards are not supported"); #endif /* Remove the file creation entry from the diff queue, and remember it */