From: Junio C Hamano <gitster@pobox.com>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: git@vger.kernel.org, "René Scharfe" <l.s.r@web.de>,
"Johannes Schindelin" <Johannes.Schindelin@gmx.de>
Subject: [PATCH 3/2] replace die("BUG: ...") with BUG("...")
Date: Mon, 06 Dec 2021 16:24:01 -0800 [thread overview]
Message-ID: <xmqqsfv5b6u6.fsf@gitster.g> (raw)
In-Reply-To: <cover-0.2-00000000000-20211206T162442Z-avarab@gmail.com> ("Ævar Arnfjörð Bjarmason"'s message of "Mon, 6 Dec 2021 17:25:19 +0100")
Ævar Arnfjörð Bjarmason <avarab@gmail.com> 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 */
next prev parent reply other threads:[~2021-12-07 0:24 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-06 16:25 [PATCH 0/2] replace die("BUG: ...") with BUG("...") Ævar Arnfjörð Bjarmason
2021-12-06 16:25 ` [PATCH 1/2] pack-objects: use BUG(...) not die("BUG: ...") Ævar Arnfjörð Bjarmason
2021-12-06 16:25 ` [PATCH 2/2] strbuf.h: " Ævar Arnfjörð Bjarmason
2021-12-06 18:44 ` [PATCH 0/2] replace die("BUG: ...") with BUG("...") Junio C Hamano
2021-12-07 11:00 ` Ævar Arnfjörð Bjarmason
2021-12-07 0:24 ` Junio C Hamano [this message]
2021-12-07 11:05 ` [PATCH v2 0/4] " Ævar Arnfjörð Bjarmason
2021-12-07 11:05 ` [PATCH v2 1/4] pack-objects: use BUG(...) not die("BUG: ...") Ævar Arnfjörð Bjarmason
2021-12-07 11:05 ` [PATCH v2 2/4] strbuf.h: " Ævar Arnfjörð Bjarmason
2021-12-07 11:05 ` [PATCH v2 3/4] pathspec: use BUG(...) not die("BUG:%s:%d....", <file>, <line>) Ævar Arnfjörð Bjarmason
2021-12-07 11:05 ` [PATCH v2 4/4] object.h: use BUG(...) no die("BUG: ...") in lookup_object_by_type() Ævar Arnfjörð Bjarmason
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqsfv5b6u6.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=l.s.r@web.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.