pathspec: use BUG(...) not die("BUG:%s:%d....", <file>, <line>)

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> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ævar Arnfjörð Bjarmason committed Dec 7, 2021 at 12:05 UTC a78537a0f26615b69b680845cfbb765cc665c808
2 files changed +2 -4
pathspec.h
+1 -2
@@ -58,8 +58,7 @@ struct pathspec {
58 #define GUARD_PATHSPEC(ps, mask) \
59 do { \
60 if ((ps)->magic & ~(mask)) \
61 - die("BUG:%s:%d: unsupported magic %x", \
62 - __FILE__, __LINE__, (ps)->magic & ~(mask)); \
61 + BUG("unsupported magic %x", (ps)->magic & ~(mask)); \
62 } while (0)
63
64 /* parse_pathspec flags */
tree-diff.c
+1 -2
@@ -603,8 +603,7 @@ static void try_to_follow_renames(const struct object_id *old_oid,
603 * about dry-run mode and returns wildcard info.
604 */
605 if (opt->pathspec.has_wildcard)
606 - die("BUG:%s:%d: wildcards are not supported",
607 - __FILE__, __LINE__);
606 + BUG("wildcards are not supported");
607 #endif
608
609 /* Remove the file creation entry from the diff queue, and remember it */