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

Change code that was added in 8f4f8f4579 (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 d8193743e0 (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>
This commit is contained in:
Ævar Arnfjörð Bjarmason 2021-12-07 12:05:53 +01:00 committed by Junio C Hamano
parent 46d699f492
commit a78537a0f2
2 changed files with 2 additions and 4 deletions

View File

@ -58,8 +58,7 @@ struct pathspec {
#define GUARD_PATHSPEC(ps, mask) \ #define GUARD_PATHSPEC(ps, mask) \
do { \ do { \
if ((ps)->magic & ~(mask)) \ if ((ps)->magic & ~(mask)) \
die("BUG:%s:%d: unsupported magic %x", \ BUG("unsupported magic %x", (ps)->magic & ~(mask)); \
__FILE__, __LINE__, (ps)->magic & ~(mask)); \
} while (0) } while (0)
/* parse_pathspec flags */ /* parse_pathspec flags */

View File

@ -603,8 +603,7 @@ static void try_to_follow_renames(const struct object_id *old_oid,
* about dry-run mode and returns wildcard info. * about dry-run mode and returns wildcard info.
*/ */
if (opt->pathspec.has_wildcard) if (opt->pathspec.has_wildcard)
die("BUG:%s:%d: wildcards are not supported", BUG("wildcards are not supported");
__FILE__, __LINE__);
#endif #endif
/* Remove the file creation entry from the diff queue, and remember it */ /* Remove the file creation entry from the diff queue, and remember it */