git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>,
	"René Scharfe" <l.s.r@web.de>,
	"Johannes Schindelin" <Johannes.Schindelin@gmx.de>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: [PATCH v2 3/4] pathspec: use BUG(...) not die("BUG:%s:%d....", <file>, <line>)
Date: Tue,  7 Dec 2021 12:05:53 +0100	[thread overview]
Message-ID: <patch-v2-3.4-81e354fa3be-20211207T110440Z-avarab@gmail.com> (raw)
In-Reply-To: <cover-v2-0.4-00000000000-20211207T110440Z-avarab@gmail.com>

Change code that was added in 8f4f8f4579f (guard against new pathspec
magic in pathspec matching code, 2013-07-14) to use the BUG() macro
instead of emitting a "fatal" message with the "__FILE__"-name and
"__LINE__"-numbers.

The original code predated the existence of the BUG() function, which
was added in d8193743e08 (usage.c: add BUG() function, 2017-05-12).

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 pathspec.h  | 3 +--
 tree-diff.c | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/pathspec.h b/pathspec.h
index 2341dc99010..402ebb80808 100644
--- a/pathspec.h
+++ b/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 a/tree-diff.c b/tree-diff.c
index 437c98a70e4..69031d7cbae 100644
--- a/tree-diff.c
+++ b/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 */
-- 
2.34.1.898.g5a552c2e5f0


  parent reply	other threads:[~2021-12-07 11:06 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 ` [PATCH 3/2] " Junio C Hamano
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   ` Ævar Arnfjörð Bjarmason [this message]
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=patch-v2-3.4-81e354fa3be-20211207T110440Z-avarab@gmail.com \
    --to=avarab@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).