diff options
author | Junio C Hamano <gitster@pobox.com> | 2022-06-11 00:04:15 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-06-11 00:04:15 +0200 |
commit | 4da14b574f2e52eb05e4fef7ed169a8f9e3a8b67 (patch) | |
tree | 134a132278b3ca34974f2812b24acb5fe9a47810 /cache-tree.c | |
parent | Merge branch 'jy/gitweb-xhtml5' (diff) | |
parent | cache-tree.c: use bug() and BUG_if_bug() (diff) | |
download | git-4da14b574f2e52eb05e4fef7ed169a8f9e3a8b67.tar.xz git-4da14b574f2e52eb05e4fef7ed169a8f9e3a8b67.zip |
Merge branch 'ab/bug-if-bug'
A new bug() and BUG_if_bug() API is introduced to make it easier to
uniformly log "detect multiple bugs and abort in the end" pattern.
* ab/bug-if-bug:
cache-tree.c: use bug() and BUG_if_bug()
receive-pack: use bug() and BUG_if_bug()
parse-options.c: use optbug() instead of BUG() "opts" check
parse-options.c: use new bug() API for optbug()
usage.c: add a non-fatal bug() function to go with BUG()
common-main.c: move non-trace2 exit() behavior out of trace2.c
Diffstat (limited to 'cache-tree.c')
-rw-r--r-- | cache-tree.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/cache-tree.c b/cache-tree.c index a92c23eec3..ff794d940f 100644 --- a/cache-tree.c +++ b/cache-tree.c @@ -722,14 +722,14 @@ struct tree* write_in_core_index_as_tree(struct repository *repo) { ret = write_index_as_tree_internal(&o, index_state, was_valid, 0, NULL); if (ret == WRITE_TREE_UNMERGED_INDEX) { int i; - fprintf(stderr, "BUG: There are unmerged index entries:\n"); + bug("there are unmerged index entries:"); for (i = 0; i < index_state->cache_nr; i++) { const struct cache_entry *ce = index_state->cache[i]; if (ce_stage(ce)) - fprintf(stderr, "BUG: %d %.*s\n", ce_stage(ce), - (int)ce_namelen(ce), ce->name); + bug("%d %.*s", ce_stage(ce), + (int)ce_namelen(ce), ce->name); } - BUG("unmerged index entries when writing inmemory index"); + BUG("unmerged index entries when writing in-core index"); } return lookup_tree(repo, &index_state->cache_tree->oid); |