Replace all die("BUG: ...") calls by BUG() ones

In d8193743e0 (usage.c: add BUG() function, 2017-05-12), a new macro
was introduced to use for reporting bugs instead of die(). It was then
subsequently used to convert one single caller in 588a538ae5
(setup_git_env: convert die("BUG") to BUG(), 2017-05-12).

The cover letter of the patch series containing this patch
(cf 20170513032414.mfrwabt4hovujde2@sigill.intra.peff.net) is not
terribly clear why only one call site was converted, or what the plan
is for other, similar calls to die() to report bugs.

Let's just convert all remaining ones in one fell swoop.

This trick was performed by this invocation:

	sed -i 's/die("BUG: /BUG("/g' $(git grep -l 'die("BUG' \*.c)

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Johannes Schindelin
2018-05-02 11:38:39 +02:00
committed by Junio C Hamano
parent dde74d732f
commit 033abf97fc
67 changed files with 190 additions and 190 deletions

View File

@ -125,7 +125,7 @@ static void files_assert_main_repository(struct files_ref_store *refs,
if (refs->store_flags & REF_STORE_MAIN)
return;
die("BUG: operation %s only allowed for main ref store", caller);
BUG("operation %s only allowed for main ref store", caller);
}
/*
@ -141,13 +141,13 @@ static struct files_ref_store *files_downcast(struct ref_store *ref_store,
struct files_ref_store *refs;
if (ref_store->be != &refs_be_files)
die("BUG: ref_store is type \"%s\" not \"files\" in %s",
BUG("ref_store is type \"%s\" not \"files\" in %s",
ref_store->be->name, caller);
refs = (struct files_ref_store *)ref_store;
if ((refs->store_flags & required_flags) != required_flags)
die("BUG: operation %s requires abilities 0x%x, but only have 0x%x",
BUG("operation %s requires abilities 0x%x, but only have 0x%x",
caller, required_flags, refs->store_flags);
return refs;
@ -166,7 +166,7 @@ static void files_reflog_path(struct files_ref_store *refs,
strbuf_addf(sb, "%s/logs/%s", refs->gitcommondir, refname);
break;
default:
die("BUG: unknown ref type %d of ref %s",
BUG("unknown ref type %d of ref %s",
ref_type(refname), refname);
}
}
@ -184,7 +184,7 @@ static void files_ref_path(struct files_ref_store *refs,
strbuf_addf(sb, "%s/%s", refs->gitcommondir, refname);
break;
default:
die("BUG: unknown ref type %d of ref %s",
BUG("unknown ref type %d of ref %s",
ref_type(refname), refname);
}
}
@ -2010,7 +2010,7 @@ static int files_for_each_reflog_ent_reverse(struct ref_store *ref_store,
}
if (!ret && sb.len)
die("BUG: reverse reflog parser had leftover data");
BUG("reverse reflog parser had leftover data");
fclose(logfp);
strbuf_release(&sb);
@ -2088,7 +2088,7 @@ static int files_reflog_iterator_advance(struct ref_iterator *ref_iterator)
static int files_reflog_iterator_peel(struct ref_iterator *ref_iterator,
struct object_id *peeled)
{
die("BUG: ref_iterator_peel() called for reflog_iterator");
BUG("ref_iterator_peel() called for reflog_iterator");
}
static int files_reflog_iterator_abort(struct ref_iterator *ref_iterator)
@ -2873,7 +2873,7 @@ static int files_initial_transaction_commit(struct ref_store *ref_store,
assert(err);
if (transaction->state != REF_TRANSACTION_OPEN)
die("BUG: commit called for transaction that is not open");
BUG("commit called for transaction that is not open");
/* Fail if a refname appears more than once in the transaction: */
for (i = 0; i < transaction->nr; i++)
@ -2899,7 +2899,7 @@ static int files_initial_transaction_commit(struct ref_store *ref_store,
*/
if (refs_for_each_rawref(&refs->base, ref_present,
&affected_refnames))
die("BUG: initial ref transaction called with existing refs");
BUG("initial ref transaction called with existing refs");
packed_transaction = ref_store_transaction_begin(refs->packed_ref_store, err);
if (!packed_transaction) {
@ -2912,7 +2912,7 @@ static int files_initial_transaction_commit(struct ref_store *ref_store,
if ((update->flags & REF_HAVE_OLD) &&
!is_null_oid(&update->old_oid))
die("BUG: initial ref transaction with old_sha1 set");
BUG("initial ref transaction with old_sha1 set");
if (refs_verify_refname_available(&refs->base, update->refname,
&affected_refnames, NULL,
err)) {