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

In d8193743e08 (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 588a538ae55 (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>

Johannes Schindelin committed May 2, 2018 at 11:38 UTC 033abf97fcbc247eabf915780181d947cfb66205
67 files changed +190 -190
apply.c
+2 -2
@@ -2375,7 +2375,7 @@ static void update_pre_post_images(struct image *preimage,
2375 if (postlen
2376 ? postlen < new_buf - postimage->buf
2377 : postimage->len < new_buf - postimage->buf)
2378 - die("BUG: caller miscounted postlen: asked %d, orig = %d, used = %d",
2378 + BUG("caller miscounted postlen: asked %d, orig = %d, used = %d",
2379 (int)postlen, (int) postimage->len, (int)(new_buf - postimage->buf));
2380
2381 /* Fix the length of the whole thing */
@@ -3509,7 +3509,7 @@ static int load_current(struct apply_state *state,
3509 unsigned mode = patch->new_mode;
3510
3511 if (!patch->is_new)
3512 - die("BUG: patch to %s is not a creation", patch->old_name);
3512 + BUG("patch to %s is not a creation", patch->old_name);
3513
3514 pos = cache_name_pos(name, strlen(name));
3515 if (pos < 0)
archive-tar.c
+1 -1
@@ -441,7 +441,7 @@ static int write_tar_filter_archive(const struct archiver *ar,
441 int r;
442
443 if (!ar->data)
444 - die("BUG: tar-filter archiver called with no filter defined");
444 + BUG("tar-filter archiver called with no filter defined");
445
446 strbuf_addstr(&cmd, ar->data);
447 if (args->compression_level >= 0)
attr.c
+5 -5
@@ -157,7 +157,7 @@ static void all_attrs_init(struct attr_hashmap *map, struct attr_check *check)
157
158 size = hashmap_get_size(&map->map);
159 if (size < check->all_attrs_nr)
160 - die("BUG: interned attributes shouldn't be deleted");
160 + BUG("interned attributes shouldn't be deleted");
161
162 /*
163 * If the number of attributes in the global dictionary has increased
@@ -541,7 +541,7 @@ static void check_vector_remove(struct attr_check *check)
541 break;
542
543 if (i >= check_vector.nr)
544 - die("BUG: no entry found");
544 + BUG("no entry found");
545
546 /* shift entries over */
547 for (; i < check_vector.nr - 1; i++)
@@ -599,11 +599,11 @@ struct attr_check *attr_check_initl(const char *one, ...)
599 const struct git_attr *attr;
600 param = va_arg(params, const char *);
601 if (!param)
602 - die("BUG: counted %d != ended at %d",
602 + BUG("counted %d != ended at %d",
603 check->nr, cnt);
604 attr = git_attr(param);
605 if (!attr)
606 - die("BUG: %s: not a valid attribute name", param);
606 + BUG("%s: not a valid attribute name", param);
607 check->items[cnt].attr = attr;
608 }
609 va_end(params);
@@ -714,7 +714,7 @@ void git_attr_set_direction(enum git_attr_direction new_direction,
714 struct index_state *istate)
715 {
716 if (is_bare_repository() && new_direction != GIT_ATTR_INDEX)
717 - die("BUG: non-INDEX attr direction in a bare repo");
717 + BUG("non-INDEX attr direction in a bare repo");
718
719 if (new_direction != direction)
720 drop_all_attr_stacks();
blame.c
+1 -1
@@ -1806,7 +1806,7 @@ void setup_scoreboard(struct blame_scoreboard *sb, const char *path, struct blam
1806 l->item = c;
1807 if (add_decoration(&sb->revs->children,
1808 &c->parents->item->object, l))
1809 - die("BUG: not unique item in first-parent chain");
1809 + BUG("not unique item in first-parent chain");
1810 c = c->parents->item;
1811 }
1812
builtin/am.c
+10 -10
@@ -403,11 +403,11 @@ static void am_load(struct am_state *state)
403 struct strbuf sb = STRBUF_INIT;
404
405 if (read_state_file(&sb, state, "next", 1) < 0)
406 - die("BUG: state file 'next' does not exist");
406 + BUG("state file 'next' does not exist");
407 state->cur = strtol(sb.buf, NULL, 10);
408
409 if (read_state_file(&sb, state, "last", 1) < 0)
410 - die("BUG: state file 'last' does not exist");
410 + BUG("state file 'last' does not exist");
411 state->last = strtol(sb.buf, NULL, 10);
412
413 if (read_author_script(state) < 0)
@@ -986,7 +986,7 @@ static int split_mail(struct am_state *state, enum patch_format patch_format,
986 case PATCH_FORMAT_MBOXRD:
987 return split_mail_mbox(state, paths, keep_cr, 1);
988 default:
989 - die("BUG: invalid patch_format");
989 + BUG("invalid patch_format");
990 }
991 return -1;
992 }
@@ -1041,7 +1041,7 @@ static void am_setup(struct am_state *state, enum patch_format patch_format,
1041 str = "b";
1042 break;
1043 default:
1044 - die("BUG: invalid value for state->keep");
1044 + BUG("invalid value for state->keep");
1045 }
1046
1047 write_state_text(state, "keep", str);
@@ -1058,7 +1058,7 @@ static void am_setup(struct am_state *state, enum patch_format patch_format,
1058 str = "t";
1059 break;
1060 default:
1061 - die("BUG: invalid value for state->scissors");
1061 + BUG("invalid value for state->scissors");
1062 }
1063 write_state_text(state, "scissors", str);
1064
@@ -1216,7 +1216,7 @@ static int parse_mail(struct am_state *state, const char *mail)
1216 mi.keep_non_patch_brackets_in_subject = 1;
1217 break;
1218 default:
1219 - die("BUG: invalid value for state->keep");
1219 + BUG("invalid value for state->keep");
1220 }
1221
1222 if (state->message_id)
@@ -1232,7 +1232,7 @@ static int parse_mail(struct am_state *state, const char *mail)
1232 mi.use_scissors = 1;
1233 break;
1234 default:
1235 - die("BUG: invalid value for state->scissors");
1235 + BUG("invalid value for state->scissors");
1236 }
1237
1238 mi.input = xfopen(mail, "r");
@@ -1463,7 +1463,7 @@ static int run_apply(const struct am_state *state, const char *index_file)
1463 int options = 0;
1464
1465 if (init_apply_state(&apply_state, NULL))
1466 - die("BUG: init_apply_state() failed");
1466 + BUG("init_apply_state() failed");
1467
1468 argv_array_push(&apply_opts, "apply");
1469 argv_array_pushv(&apply_opts, state->git_apply_opts.argv);
@@ -1489,7 +1489,7 @@ static int run_apply(const struct am_state *state, const char *index_file)
1489 apply_state.apply_verbosity = verbosity_silent;
1490
1491 if (check_apply_state(&apply_state, force_apply))
1492 - die("BUG: check_apply_state() failed");
1492 + BUG("check_apply_state() failed");
1493
1494 argv_array_push(&apply_paths, am_path(state, "patch"));
1495
@@ -2407,7 +2407,7 @@ int cmd_am(int argc, const char **argv, const char *prefix)
2407 ret = show_patch(&state);
2408 break;
2409 default:
2410 - die("BUG: invalid resume value");
2410 + BUG("invalid resume value");
2411 }
2412
2413 am_state_release(&state);
builtin/branch.c
+1 -1
@@ -497,7 +497,7 @@ static void copy_or_rename_branch(const char *oldname, const char *newname, int
497
498 if (!skip_prefix(oldref.buf, "refs/heads/", &interpreted_oldname) ||
499 !skip_prefix(newref.buf, "refs/heads/", &interpreted_newname)) {
500 - die("BUG: expected prefix missing for refs");
500 + BUG("expected prefix missing for refs");
501 }
502
503 if (copy)
builtin/cat-file.c
+2 -2
@@ -312,7 +312,7 @@ static void print_object_or_die(struct batch_options *opt, struct expand_data *d
312 die("could not convert '%s' %s",
313 oid_to_hex(oid), data->rest);
314 } else
315 - die("BUG: invalid cmdmode: %c", opt->cmdmode);
315 + BUG("invalid cmdmode: %c", opt->cmdmode);
316 batch_write(opt, contents, size);
317 free(contents);
318 } else if (stream_blob_to_fd(1, oid, NULL, 0) < 0)
@@ -387,7 +387,7 @@ static void batch_one_object(const char *obj_name, struct batch_options *opt,
387 (uintmax_t)strlen(obj_name), obj_name);
388 break;
389 default:
390 - die("BUG: unknown get_sha1_with_context result %d\n",
390 + BUG("unknown get_sha1_with_context result %d\n",
391 result);
392 break;
393 }
builtin/clone.c
+1 -1
@@ -823,7 +823,7 @@ static void write_refspec_config(const char *src_ref_prefix,
823 } else if (remote_head_points_at) {
824 const char *head = remote_head_points_at->name;
825 if (!skip_prefix(head, "refs/heads/", &head))
826 - die("BUG: remote HEAD points at non-head?");
826 + BUG("remote HEAD points at non-head?");
827
828 strbuf_addf(&value, "+%s:%s%s", remote_head_points_at->name,
829 branch_top->buf, head);
builtin/commit.c
+1 -1
@@ -495,7 +495,7 @@ static int is_a_merge(const struct commit *current_head)
495 static void assert_split_ident(struct ident_split *id, const struct strbuf *buf)
496 {
497 if (split_ident_line(id, buf->buf, buf->len) || !id->date_begin)
498 - die("BUG: unable to parse our own ident: %s", buf->buf);
498 + BUG("unable to parse our own ident: %s", buf->buf);
499 }
500
501 static void export_one(const char *var, const char *s, const char *e, int hack)
builtin/config.c
+1 -1
@@ -309,7 +309,7 @@ static char *normalize_value(const char *key, const char *value)
309 return xstrdup(v ? "true" : "false");
310 }
311
312 - die("BUG: cannot normalize type %d", types);
312 + BUG("cannot normalize type %d", types);
313 }
314
315 static int get_color_found;
builtin/fast-export.c
+1 -1
@@ -517,7 +517,7 @@ static void anonymize_ident_line(const char **beg, const char **end)
517 /* skip "committer", "author", "tagger", etc */
518 end_of_header = strchr(*beg, ' ');
519 if (!end_of_header)
520 - die("BUG: malformed line fed to anonymize_ident_line: %.*s",
520 + BUG("malformed line fed to anonymize_ident_line: %.*s",
521 (int)(*end - *beg), *beg);
522 end_of_header++;
523 strbuf_add(out, *beg, end_of_header - *beg);
builtin/fsck.c
+1 -1
@@ -519,7 +519,7 @@ static struct object *parse_loose_object(const struct object_id *oid,
519 return NULL;
520
521 if (!contents && type != OBJ_BLOB)
522 - die("BUG: read_loose_object streamed a non-blob");
522 + BUG("read_loose_object streamed a non-blob");
523
524 obj = parse_object_buffer(oid, type, size, contents, &eaten);
525
builtin/index-pack.c
+2 -2
@@ -866,7 +866,7 @@ static void sha1_object(const void *data, struct object_entry *obj_entry,
866 if (obj->type == OBJ_COMMIT) {
867 struct commit *commit = (struct commit *) obj;
868 if (detach_commit_buffer(commit, NULL) != data)
869 - die("BUG: parse_object_buffer transmogrified our buffer");
869 + BUG("parse_object_buffer transmogrified our buffer");
870 }
871 obj->flags |= FLAG_CHECKED;
872 }
@@ -1015,7 +1015,7 @@ static struct base_data *find_unresolved_deltas_1(struct base_data *base,
1015
1016 if (!compare_and_swap_type(&child->real_type, OBJ_REF_DELTA,
1017 base->obj->real_type))
1018 - die("BUG: child->real_type != OBJ_REF_DELTA");
1018 + BUG("child->real_type != OBJ_REF_DELTA");
1019
1020 resolve_delta(child, base, result);
1021 if (base->ref_first == base->ref_last && base->ofs_last == -1)
builtin/init-db.c
+1 -1
@@ -391,7 +391,7 @@ int init_db(const char *git_dir, const char *real_git_dir,
391 else if (get_shared_repository() == PERM_EVERYBODY)
392 xsnprintf(buf, sizeof(buf), "%d", OLD_PERM_EVERYBODY);
393 else
394 - die("BUG: invalid value for shared_repository");
394 + BUG("invalid value for shared_repository");
395 git_config_set("core.sharedrepository", buf);
396 git_config_set("receive.denyNonFastforwards", "true");
397 }
builtin/ls-files.c
+1 -1
@@ -166,7 +166,7 @@ static void show_killed_files(const struct index_state *istate,
166 */
167 pos = index_name_pos(istate, ent->name, ent->len);
168 if (0 <= pos)
169 - die("BUG: killed-file %.*s not found",
169 + BUG("killed-file %.*s not found",
170 ent->len, ent->name);
171 pos = -pos - 1;
172 while (pos < istate->cache_nr &&
builtin/notes.c
+4 -4
@@ -461,7 +461,7 @@ static int add(int argc, const char **argv, const char *prefix)
461 if (d.buf.len || allow_empty) {
462 write_note_data(&d, &new_note);
463 if (add_note(t, &object, &new_note, combine_notes_overwrite))
464 - die("BUG: combine_notes_overwrite failed");
464 + BUG("combine_notes_overwrite failed");
465 commit_notes(t, "Notes added by 'git notes add'");
466 } else {
467 fprintf(stderr, _("Removing note for object %s\n"),
@@ -544,7 +544,7 @@ static int copy(int argc, const char **argv, const char *prefix)
544 }
545
546 if (add_note(t, &object, from_note, combine_notes_overwrite))
547 - die("BUG: combine_notes_overwrite failed");
547 + BUG("combine_notes_overwrite failed");
548 commit_notes(t, "Notes added by 'git notes copy'");
549 out:
550 free_notes(t);
@@ -621,7 +621,7 @@ static int append_edit(int argc, const char **argv, const char *prefix)
621 if (d.buf.len || allow_empty) {
622 write_note_data(&d, &new_note);
623 if (add_note(t, &object, &new_note, combine_notes_overwrite))
624 - die("BUG: combine_notes_overwrite failed");
624 + BUG("combine_notes_overwrite failed");
625 logmsg = xstrfmt("Notes added by 'git notes %s'", argv[0]);
626 } else {
627 fprintf(stderr, _("Removing note for object %s\n"),
@@ -831,7 +831,7 @@ static int merge(int argc, const char **argv, const char *prefix)
831 const char *short_ref = NULL;
832
833 if (!skip_prefix(o.local_ref, "refs/notes/", &short_ref))
834 - die("BUG: local ref %s is outside of refs/notes/",
834 + BUG("local ref %s is outside of refs/notes/",
835 o.local_ref);
836
837 strbuf_addf(&merge_key, "notes.%s.mergeStrategy", short_ref);
builtin/pack-objects.c
+2 -2
@@ -1620,7 +1620,7 @@ static void break_delta_chains(struct object_entry *entry)
1620 * is a bug.
1621 */
1622 if (cur->dfs_state != DFS_NONE)
1623 - die("BUG: confusing delta dfs state in first pass: %d",
1623 + BUG("confusing delta dfs state in first pass: %d",
1624 cur->dfs_state);
1625
1626 /*
@@ -1677,7 +1677,7 @@ static void break_delta_chains(struct object_entry *entry)
1677 if (cur->dfs_state == DFS_DONE)
1678 break;
1679 else if (cur->dfs_state != DFS_ACTIVE)
1680 - die("BUG: confusing delta dfs state in second pass: %d",
1680 + BUG("confusing delta dfs state in second pass: %d",
1681 cur->dfs_state);
1682
1683 /*
builtin/pull.c
+1 -1
@@ -539,7 +539,7 @@ static int run_fetch(const char *repo, const char **refspecs)
539 argv_array_push(&args, repo);
540 argv_array_pushv(&args, refspecs);
541 } else if (*refspecs)
542 - die("BUG: refspecs without repo?");
542 + BUG("refspecs without repo?");
543 ret = run_command_v_opt(args.argv, RUN_GIT_CMD);
544 argv_array_clear(&args);
545 return ret;
builtin/receive-pack.c
+1 -1
@@ -1378,7 +1378,7 @@ static void warn_if_skipped_connectivity_check(struct command *commands,
1378 }
1379 }
1380 if (!checked_connectivity)
1381 - die("BUG: connectivity check skipped???");
1381 + BUG("connectivity check skipped???");
1382 }
1383
1384 static void execute_commands_non_atomic(struct command *commands,
builtin/replace.c
+1 -1
@@ -501,6 +501,6 @@ int cmd_replace(int argc, const char **argv, const char *prefix)
501 return list_replace_refs(argv[0], format);
502
503 default:
504 - die("BUG: invalid cmdmode %d", (int)cmdmode);
504 + BUG("invalid cmdmode %d", (int)cmdmode);
505 }
506 }
builtin/update-index.c
+1 -1
@@ -1164,7 +1164,7 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
1164 report(_("Untracked cache enabled for '%s'"), get_git_work_tree());
1165 break;
1166 default:
1167 - die("BUG: bad untracked_cache value: %d", untracked_cache);
1167 + BUG("bad untracked_cache value: %d", untracked_cache);
1168 }
1169
1170 if (fsmonitor > 0) {
bulk-checkin.c
+1 -1
@@ -230,7 +230,7 @@ static int deflate_to_pack(struct bulk_checkin_state *state,
230 * pack, and write into it.
231 */
232 if (!idx)
233 - die("BUG: should not happen");
233 + BUG("should not happen");
234 hashfile_truncate(state->f, &checkpoint);
235 state->offset = checkpoint.offset;
236 finish_bulk_checkin(state);
color.c
+2 -2
@@ -174,7 +174,7 @@ static char *color_output(char *out, int len, const struct color *c, char type)
174 break;
175 case COLOR_ANSI:
176 if (len < 2)
177 - die("BUG: color parsing ran out of space");
177 + BUG("color parsing ran out of space");
178 *out++ = type;
179 *out++ = '0' + c->value;
180 break;
@@ -256,7 +256,7 @@ int color_parse_mem(const char *value, int value_len, char *dst)
256 #undef OUT
257 #define OUT(x) do { \
258 if (dst == end) \
259 - die("BUG: color parsing ran out of space"); \
259 + BUG("color parsing ran out of space"); \
260 *dst++ = (x); \
261 } while(0)
262
column.c
+1 -1
@@ -214,7 +214,7 @@ void print_columns(const struct string_list *list, unsigned int colopts,
214 display_table(list, colopts, &nopts);
215 break;
216 default:
217 - die("BUG: invalid layout mode %d", COL_LAYOUT(colopts));
217 + BUG("invalid layout mode %d", COL_LAYOUT(colopts));
218 }
219 }
220
config.c
+6 -6
@@ -102,7 +102,7 @@ static int config_buf_ungetc(int c, struct config_source *conf)
102 if (conf->u.buf.pos > 0) {
103 conf->u.buf.pos--;
104 if (conf->u.buf.buf[conf->u.buf.pos] != c)
105 - die("BUG: config_buf can only ungetc the same character");
105 + BUG("config_buf can only ungetc the same character");
106 return c;
107 }
108
@@ -189,7 +189,7 @@ static int prepare_include_condition_pattern(struct strbuf *pat)
189 strbuf_realpath(&path, cf->path, 1);
190 slash = find_last_dir_sep(path.buf);
191 if (!slash)
192 - die("BUG: how is this possible?");
192 + BUG("how is this possible?");
193 strbuf_splice(pat, 0, 1, path.buf, slash - path.buf);
194 prefix = slash - path.buf + 1 /* slash */;
195 } else if (!is_absolute_path(pat->buf))
@@ -1717,7 +1717,7 @@ static int configset_add_value(struct config_set *cs, const char *key, const cha
1717 l_item->value_index = e->value_list.nr - 1;
1718
1719 if (!cf)
1720 - die("BUG: configset_add_value has no source");
1720 + BUG("configset_add_value has no source");
1721 if (cf->name) {
1722 kv_info->filename = strintern(cf->name);
1723 kv_info->linenr = cf->linenr;
@@ -3006,7 +3006,7 @@ const char *current_config_origin_type(void)
3006 else if(cf)
3007 type = cf->origin_type;
3008 else
3009 - die("BUG: current_config_origin_type called outside config callback");
3009 + BUG("current_config_origin_type called outside config callback");
3010
3011 switch (type) {
3012 case CONFIG_ORIGIN_BLOB:
@@ -3020,7 +3020,7 @@ const char *current_config_origin_type(void)
3020 case CONFIG_ORIGIN_CMDLINE:
3021 return "command line";
3022 default:
3023 - die("BUG: unknown config origin type");
3023 + BUG("unknown config origin type");
3024 }
3025 }
3026
@@ -3032,7 +3032,7 @@ const char *current_config_name(void)
3032 else if (cf)
3033 name = cf->name;
3034 else
3035 - die("BUG: current_config_name called outside config callback");
3035 + BUG("current_config_name called outside config callback");
3036 return name ? name : "";
3037 }
3038
date.c
+1 -1
@@ -185,7 +185,7 @@ struct date_mode *date_mode_from_type(enum date_mode_type type)
185 {
186 static struct date_mode mode;
187 if (type == DATE_STRFTIME)
188 - die("BUG: cannot create anonymous strftime date_mode struct");
188 + BUG("cannot create anonymous strftime date_mode struct");
189 mode.type = type;
190 mode.local = 0;
191 return &mode;
diff.c
+6 -6
@@ -1184,7 +1184,7 @@ static void emit_diff_symbol_from_struct(struct diff_options *o,
1184 fputs(o->stat_sep, o->file);
1185 break;
1186 default:
1187 - die("BUG: unknown diff symbol");
1187 + BUG("unknown diff symbol");
1188 }
1189 strbuf_release(&sb);
1190 }
@@ -1343,7 +1343,7 @@ static struct diff_tempfile *claim_diff_tempfile(void) {
1343 for (i = 0; i < ARRAY_SIZE(diff_temp); i++)
1344 if (!diff_temp[i].name)
1345 return diff_temp + i;
1346 - die("BUG: diff is failing to clean up its tempfiles");
1346 + BUG("diff is failing to clean up its tempfiles");
1347 }
1348
1349 static void remove_tempfile(void)
@@ -3840,7 +3840,7 @@ static const char *diff_abbrev_oid(const struct object_id *oid, int abbrev)
3840 if (abbrev < 0)
3841 abbrev = FALLBACK_DEFAULT_ABBREV;
3842 if (abbrev > GIT_SHA1_HEXSZ)
3843 - die("BUG: oid abbreviation out of range: %d", abbrev);
3843 + BUG("oid abbreviation out of range: %d", abbrev);
3844 if (abbrev)
3845 hex[abbrev] = '\0';
3846 return hex;
@@ -4334,7 +4334,7 @@ static int stat_opt(struct diff_options *options, const char **av)
4334 int argcount = 1;
4335
4336 if (!skip_prefix(arg, "--stat", &arg))
4337 - die("BUG: stat option does not begin with --stat: %s", arg);
4337 + BUG("stat option does not begin with --stat: %s", arg);
4338 end = (char *)arg;
4339
4340 switch (*arg) {
@@ -5519,7 +5519,7 @@ static void diff_flush_patch_all_file_pairs(struct diff_options *o)
5519 struct diff_queue_struct *q = &diff_queued_diff;
5520
5521 if (WSEH_NEW & WS_RULE_MASK)
5522 - die("BUG: WS rules bit mask overlaps with diff symbol flags");
5522 + BUG("WS rules bit mask overlaps with diff symbol flags");
5523
5524 if (o->color_moved)
5525 o->emitted_symbols = &esm;
@@ -6053,7 +6053,7 @@ size_t fill_textconv(struct userdiff_driver *driver,
6053 }
6054
6055 if (!driver->textconv)
6056 - die("BUG: fill_textconv called with non-textconv driver");
6056 + BUG("fill_textconv called with non-textconv driver");
6057
6058 if (driver->textconv_cache && df->oid_valid) {
6059 *outbuf = notes_cache_get(driver->textconv_cache,
dir-iterator.c
+1 -1
@@ -188,7 +188,7 @@ struct dir_iterator *dir_iterator_begin(const char *path)
188 struct dir_iterator *dir_iterator = &iter->base;
189
190 if (!path || !*path)
191 - die("BUG: empty path passed to dir_iterator_begin()");
191 + BUG("empty path passed to dir_iterator_begin()");
192
193 strbuf_init(&iter->base.path, PATH_MAX);
194 strbuf_addstr(&iter->base.path, path);
grep.c
+8 -8
@@ -404,7 +404,7 @@ static void compile_pcre1_regexp(struct grep_pat *p, const struct grep_opt *opt)
404 die("Couldn't allocate PCRE JIT stack");
405 pcre_assign_jit_stack(p->pcre1_extra_info, NULL, p->pcre1_jit_stack);
406 } else if (p->pcre1_jit_on != 0) {
407 - die("BUG: The pcre1_jit_on variable should be 0 or 1, not %d",
407 + BUG("The pcre1_jit_on variable should be 0 or 1, not %d",
408 p->pcre1_jit_on);
409 }
410 #endif
@@ -550,7 +550,7 @@ static void compile_pcre2_pattern(struct grep_pat *p, const struct grep_opt *opt
550 die("Couldn't allocate PCRE2 match context");
551 pcre2_jit_stack_assign(p->pcre2_match_context, NULL, p->pcre2_jit_stack);
552 } else if (p->pcre2_jit_on != 0) {
553 - die("BUG: The pcre2_jit_on variable should be 0 or 1, not %d",
553 + BUG("The pcre2_jit_on variable should be 0 or 1, not %d",
554 p->pcre1_jit_on);
555 }
556 }
@@ -917,10 +917,10 @@ static struct grep_expr *prep_header_patterns(struct grep_opt *opt)
917
918 for (p = opt->header_list; p; p = p->next) {
919 if (p->token != GREP_PATTERN_HEAD)
920 - die("BUG: a non-header pattern in grep header list.");
920 + BUG("a non-header pattern in grep header list.");
921 if (p->field < GREP_HEADER_FIELD_MIN ||
922 GREP_HEADER_FIELD_MAX <= p->field)
923 - die("BUG: unknown header field %d", p->field);
923 + BUG("unknown header field %d", p->field);
924 compile_regexp(p, opt);
925 }
926
@@ -933,7 +933,7 @@ static struct grep_expr *prep_header_patterns(struct grep_opt *opt)
933
934 h = compile_pattern_atom(&pp);
935 if (!h || pp != p->next)
936 - die("BUG: malformed header expr");
936 + BUG("malformed header expr");
937 if (!header_group[p->field]) {
938 header_group[p->field] = h;
939 continue;
@@ -1652,7 +1652,7 @@ static int fill_textconv_grep(struct userdiff_driver *driver,
1652 fill_filespec(df, &null_oid, 0, 0100644);
1653 break;
1654 default:
1655 - die("BUG: attempt to textconv something without a path?");
1655 + BUG("attempt to textconv something without a path?");
1656 }
1657
1658 /*
@@ -1748,7 +1748,7 @@ static int grep_source_1(struct grep_opt *opt, struct grep_source *gs, int colle
1748 case GREP_BINARY_TEXT:
1749 break;
1750 default:
1751 - die("BUG: unknown binary handling mode");
1751 + BUG("unknown binary handling mode");
1752 }
1753 }
1754
@@ -2072,7 +2072,7 @@ static int grep_source_load(struct grep_source *gs)
2072 case GREP_SOURCE_BUF:
2073 return gs->buf ? 0 : -1;
2074 }
2075 - die("BUG: invalid grep_source type to load");
2075 + BUG("invalid grep_source type to load");
2076 }
2077
2078 void grep_source_load_driver(struct grep_source *gs)
http.c
+4 -4
@@ -1855,7 +1855,7 @@ static int update_url_from_redirect(struct strbuf *base,
1855 return 0;
1856
1857 if (!skip_prefix(asked, base->buf, &tail))
1858 - die("BUG: update_url_from_redirect: %s is not a superset of %s",
1858 + BUG("update_url_from_redirect: %s is not a superset of %s",
1859 asked, base->buf);
1860
1861 new_len = got->len;
@@ -1903,7 +1903,7 @@ static int http_request_reauth(const char *url,
1903 strbuf_reset(result);
1904 break;
1905 default:
1906 - die("BUG: HTTP_KEEP_ERROR is only supported with strbufs");
1906 + BUG("HTTP_KEEP_ERROR is only supported with strbufs");
1907 }
1908 }
1909
@@ -2114,7 +2114,7 @@ int finish_http_pack_request(struct http_pack_request *preq)
2114 *lst = (*lst)->next;
2115
2116 if (!strip_suffix(preq->tmpfile, ".pack.temp", &len))
2117 - die("BUG: pack tmpfile does not end in .pack.temp?");
2117 + BUG("pack tmpfile does not end in .pack.temp?");
2118 tmp_idx = xstrfmt("%.*s.idx.temp", (int)len, preq->tmpfile);
2119
2120 argv_array_push(&ip.args, "index-pack");
@@ -2210,7 +2210,7 @@ static size_t fwrite_sha1_file(char *ptr, size_t eltsize, size_t nmemb,
2210 CURLcode c = curl_easy_getinfo(slot->curl, CURLINFO_HTTP_CODE,
2211 &slot->http_code);
2212 if (c != CURLE_OK)
2213 - die("BUG: curl_easy_getinfo for HTTP code failed: %s",
2213 + BUG("curl_easy_getinfo for HTTP code failed: %s",
2214 curl_easy_strerror(c));
2215 if (slot->http_code >= 300)
2216 return size;
imap-send.c
+1 -1
@@ -511,7 +511,7 @@ static int nfsnprintf(char *buf, int blen, const char *fmt, ...)
511
512 va_start(va, fmt);
513 if (blen <= 0 || (unsigned)(ret = vsnprintf(buf, blen, fmt, va)) >= (unsigned)blen)
514 - die("BUG: buffer too small. Please report a bug.");
514 + BUG("buffer too small. Please report a bug.");
515 va_end(va);
516 return ret;
517 }
lockfile.c
+1 -1
@@ -193,7 +193,7 @@ char *get_locked_file_path(struct lock_file *lk)
193 strbuf_addstr(&ret, get_tempfile_path(lk->tempfile));
194 if (ret.len <= LOCK_SUFFIX_LEN ||
195 strcmp(ret.buf + ret.len - LOCK_SUFFIX_LEN, LOCK_SUFFIX))
196 - die("BUG: get_locked_file_path() called for malformed lock object");
196 + BUG("get_locked_file_path() called for malformed lock object");
197 /* remove ".lock": */
198 strbuf_setlen(&ret, ret.len - LOCK_SUFFIX_LEN);
199 return strbuf_detach(&ret, NULL);
mailinfo.c
+1 -1
@@ -716,7 +716,7 @@ static void flush_inbody_header_accum(struct mailinfo *mi)
716 if (!mi->inbody_header_accum.len)
717 return;
718 if (!check_header(mi, &mi->inbody_header_accum, mi->s_hdr_data, 0))
719 - die("BUG: inbody_header_accum, if not empty, must always contain a valid in-body header");
719 + BUG("inbody_header_accum, if not empty, must always contain a valid in-body header");
720 strbuf_reset(&mi->inbody_header_accum);
721 }
722
merge-recursive.c
+6 -6
@@ -318,7 +318,7 @@ struct tree *write_tree_from_memory(struct merge_options *o)
318 fprintf(stderr, "BUG: %d %.*s\n", ce_stage(ce),
319 (int)ce_namelen(ce), ce->name);
320 }
321 - die("BUG: unmerged index entries in merge-recursive.c");
321 + BUG("unmerged index entries in merge-recursive.c");
322 }
323
324 if (!active_cache_tree)
@@ -1060,7 +1060,7 @@ static int merge_file_1(struct merge_options *o,
1060 break;
1061 }
1062 } else
1063 - die("BUG: unsupported object type in the tree");
1063 + BUG("unsupported object type in the tree");
1064 }
1065
1066 return 0;
@@ -1462,7 +1462,7 @@ static int process_renames(struct merge_options *o,
1462 const char *ren2_dst = ren2->pair->two->path;
1463 enum rename_type rename_type;
1464 if (strcmp(ren1_src, ren2_src) != 0)
1465 - die("BUG: ren1_src != ren2_src");
1465 + BUG("ren1_src != ren2_src");
1466 ren2->dst_entry->processed = 1;
1467 ren2->processed = 1;
1468 if (strcmp(ren1_dst, ren2_dst) != 0) {
@@ -1496,7 +1496,7 @@ static int process_renames(struct merge_options *o,
1496 ren2 = lookup->util;
1497 ren2_dst = ren2->pair->two->path;
1498 if (strcmp(ren1_dst, ren2_dst) != 0)
1499 - die("BUG: ren1_dst != ren2_dst");
1499 + BUG("ren1_dst != ren2_dst");
1500
1501 clean_merge = 0;
1502 ren2->processed = 1;
@@ -1962,7 +1962,7 @@ static int process_entry(struct merge_options *o,
1962 */
1963 remove_file(o, 1, path, !a_mode);
1964 } else
1965 - die("BUG: fatal merge failure, shouldn't happen.");
1965 + BUG("fatal merge failure, shouldn't happen.");
1966
1967 return clean_merge;
1968 }
@@ -2040,7 +2040,7 @@ int merge_trees(struct merge_options *o,
2040 for (i = 0; i < entries->nr; i++) {
2041 struct stage_data *e = entries->items[i].util;
2042 if (!e->processed)
2043 - die("BUG: unprocessed path??? %s",
2043 + BUG("unprocessed path??? %s",
2044 entries->items[i].string);
2045 }
2046
notes-merge.c
+2 -2
@@ -442,7 +442,7 @@ static int merge_one_change(struct notes_merge_options *o,
442 printf("Using remote notes for %s\n",
443 oid_to_hex(&p->obj));
444 if (add_note(t, &p->obj, &p->remote, combine_notes_overwrite))
445 - die("BUG: combine_notes_overwrite failed");
445 + BUG("combine_notes_overwrite failed");
446 return 0;
447 case NOTES_MERGE_RESOLVE_UNION:
448 if (o->verbosity >= 2)
@@ -490,7 +490,7 @@ static int merge_changes(struct notes_merge_options *o,
490 trace_printf("\t\t\tno local change, adopted remote\n");
491 if (add_note(t, &p->obj, &p->remote,
492 combine_notes_overwrite))
493 - die("BUG: combine_notes_overwrite failed");
493 + BUG("combine_notes_overwrite failed");
494 } else {
495 /* need file-level merge between local and remote */
496 trace_printf("\t\t\tneed content-level merge\n");
pack-bitmap-write.c
+1 -1
@@ -474,7 +474,7 @@ static void write_selected_commits_v1(struct hashfile *f,
474 sha1_pos(stored->commit->object.oid.hash, index, index_nr, sha1_access);
475
476 if (commit_pos < 0)
477 - die("BUG: trying to write commit not in index");
477 + BUG("trying to write commit not in index");
478
479 hashwrite_be32(f, commit_pos);
480 hashwrite_u8(f, stored->xor_offset);
pack-bitmap.c
+3 -3
@@ -255,7 +255,7 @@ static char *pack_bitmap_filename(struct packed_git *p)
255 size_t len;
256
257 if (!strip_suffix(p->pack_name, ".pack", &len))
258 - die("BUG: pack_name does not end in .pack");
258 + BUG("pack_name does not end in .pack");
259 return xstrfmt("%.*s.bitmap", (int)len, p->pack_name);
260 }
261
@@ -723,13 +723,13 @@ int prepare_bitmap_walk(struct rev_info *revs)
723 revs->ignore_missing_links = 0;
724
725 if (haves_bitmap == NULL)
726 - die("BUG: failed to perform bitmap walk");
726 + BUG("failed to perform bitmap walk");
727 }
728
729 wants_bitmap = find_objects(revs, wants, haves_bitmap);
730
731 if (!wants_bitmap)
732 - die("BUG: failed to perform bitmap walk");
732 + BUG("failed to perform bitmap walk");
733
734 if (haves_bitmap)
735 bitmap_and_not(wants_bitmap, haves_bitmap);
pack-objects.c
+1 -1
@@ -58,7 +58,7 @@ static void rehash_objects(struct packing_data *pdata)
58 &found);
59
60 if (found)
61 - die("BUG: Duplicate object in hash");
61 + BUG("Duplicate object in hash");
62
63 pdata->index[ix] = i + 1;
64 entry++;
packfile.c
+3 -3
@@ -188,7 +188,7 @@ int open_pack_index(struct packed_git *p)
188 return 0;
189
190 if (!strip_suffix(p->pack_name, ".pack", &len))
191 - die("BUG: pack_name does not end in .pack");
191 + BUG("pack_name does not end in .pack");
192 idx_name = xstrfmt("%.*s.idx", (int)len, p->pack_name);
193 ret = check_packed_git_idx(idx_name, p);
194 free(idx_name);
@@ -317,7 +317,7 @@ void close_all_packs(struct raw_object_store *o)
317
318 for (p = o->packed_git; p; p = p->next)
319 if (p->do_not_close)
320 - die("BUG: want to close pack marked 'do-not-close'");
320 + BUG("want to close pack marked 'do-not-close'");
321 else
322 close_pack(p);
323 }
@@ -1561,7 +1561,7 @@ void *unpack_entry(struct packed_git *p, off_t obj_offset,
1561 case OBJ_OFS_DELTA:
1562 case OBJ_REF_DELTA:
1563 if (data)
1564 - die("BUG: unpack_entry: left loop at a valid delta");
1564 + BUG("unpack_entry: left loop at a valid delta");
1565 break;
1566 case OBJ_COMMIT:
1567 case OBJ_TREE:
pathspec.c
+5 -5
@@ -198,7 +198,7 @@ static void parse_pathspec_attr_match(struct pathspec_item *item, const char *va
198 }
199
200 if (item->attr_check->nr != item->attr_match_nr)
201 - die("BUG: should have same number of entries");
201 + BUG("should have same number of entries");
202
203 string_list_clear(&list, 0);
204 }
@@ -422,7 +422,7 @@ static void init_pathspec_item(struct pathspec_item *item, unsigned flags,
422
423 if (pathspec_prefix >= 0 &&
424 (prefixlen || (prefix && *prefix)))
425 - die("BUG: 'prefix' magic is supposed to be used at worktree's root");
425 + BUG("'prefix' magic is supposed to be used at worktree's root");
426
427 if ((magic & PATHSPEC_LITERAL) && (magic & PATHSPEC_GLOB))
428 die(_("%s: 'literal' and 'glob' are incompatible"), elt);
@@ -545,7 +545,7 @@ void parse_pathspec(struct pathspec *pathspec,
545
546 if ((flags & PATHSPEC_PREFER_CWD) &&
547 (flags & PATHSPEC_PREFER_FULL))
548 - die("BUG: PATHSPEC_PREFER_CWD and PATHSPEC_PREFER_FULL are incompatible");
548 + BUG("PATHSPEC_PREFER_CWD and PATHSPEC_PREFER_FULL are incompatible");
549
550 /* No arguments with prefix -> prefix pathspec */
551 if (!entry) {
@@ -553,7 +553,7 @@ void parse_pathspec(struct pathspec *pathspec,
553 return;
554
555 if (!(flags & PATHSPEC_PREFER_CWD))
556 - die("BUG: PATHSPEC_PREFER_CWD requires arguments");
556 + BUG("PATHSPEC_PREFER_CWD requires arguments");
557
558 pathspec->items = item = xcalloc(1, sizeof(*item));
559 item->match = xstrdup(prefix);
@@ -609,7 +609,7 @@ void parse_pathspec(struct pathspec *pathspec,
609
610 if (pathspec->magic & PATHSPEC_MAXDEPTH) {
611 if (flags & PATHSPEC_KEEP_ORDER)
612 - die("BUG: PATHSPEC_MAXDEPTH_VALID and PATHSPEC_KEEP_ORDER are incompatible");
612 + BUG("PATHSPEC_MAXDEPTH_VALID and PATHSPEC_KEEP_ORDER are incompatible");
613 QSORT(pathspec->items, pathspec->nr, pathspec_item_cmp);
614 }
615 }
pkt-line.c
+1 -1
@@ -249,7 +249,7 @@ static int get_packet_data(int fd, char **src_buf, size_t *src_size,
249 ssize_t ret;
250
251 if (fd >= 0 && src_buf && *src_buf)
252 - die("BUG: multiple sources given to packet_read");
252 + BUG("multiple sources given to packet_read");
253
254 /* Read up to "size" bytes from our source, whatever it is. */
255 if (src_buf && *src_buf) {
prio-queue.c
+1 -1
@@ -20,7 +20,7 @@ void prio_queue_reverse(struct prio_queue *queue)
20 int i, j;
21
22 if (queue->compare != NULL)
23 - die("BUG: prio_queue_reverse() on non-LIFO queue");
23 + BUG("prio_queue_reverse() on non-LIFO queue");
24 for (i = 0; i < (j = (queue->nr - 1) - i); i++)
25 swap(queue, i, j);
26 }
ref-filter.c
+2 -2
@@ -751,7 +751,7 @@ static int grab_objectname(const char *name, const struct object_id *oid,
751 v->s = xstrdup(find_unique_abbrev(oid, atom->u.objectname.length));
752 return 1;
753 } else
754 - die("BUG: unknown %%(objectname) option");
754 + BUG("unknown %%(objectname) option");
755 }
756 return 0;
757 }
@@ -1299,7 +1299,7 @@ static void fill_remote_ref_details(struct used_atom *atom, const char *refname,
1299 else
1300 *s = "";
1301 } else
1302 - die("BUG: unhandled RR_* enum");
1302 + BUG("unhandled RR_* enum");
1303 }
1304
1305 char *get_head_description(void)
refs.c
+17 -17
@@ -944,10 +944,10 @@ void ref_transaction_free(struct ref_transaction *transaction)
944 /* OK */
945 break;
946 case REF_TRANSACTION_PREPARED:
947 - die("BUG: free called on a prepared reference transaction");
947 + BUG("free called on a prepared reference transaction");
948 break;
949 default:
950 - die("BUG: unexpected reference transaction state");
950 + BUG("unexpected reference transaction state");
951 break;
952 }
953
@@ -969,7 +969,7 @@ struct ref_update *ref_transaction_add_update(
969 struct ref_update *update;
970
971 if (transaction->state != REF_TRANSACTION_OPEN)
972 - die("BUG: update called for transaction that is not open");
972 + BUG("update called for transaction that is not open");
973
974 FLEX_ALLOC_STR(update, refname, refname);
975 ALLOC_GROW(transaction->updates, transaction->nr + 1, transaction->alloc);
@@ -1019,7 +1019,7 @@ int ref_transaction_create(struct ref_transaction *transaction,
1019 struct strbuf *err)
1020 {
1021 if (!new_oid || is_null_oid(new_oid))
1022 - die("BUG: create called without valid new_oid");
1022 + BUG("create called without valid new_oid");
1023 return ref_transaction_update(transaction, refname, new_oid,
1024 &null_oid, flags, msg, err);
1025 }
@@ -1031,7 +1031,7 @@ int ref_transaction_delete(struct ref_transaction *transaction,
1031 struct strbuf *err)
1032 {
1033 if (old_oid && is_null_oid(old_oid))
1034 - die("BUG: delete called with old_oid set to zeros");
1034 + BUG("delete called with old_oid set to zeros");
1035 return ref_transaction_update(transaction, refname,
1036 &null_oid, old_oid,
1037 flags, msg, err);
@@ -1044,7 +1044,7 @@ int ref_transaction_verify(struct ref_transaction *transaction,
1044 struct strbuf *err)
1045 {
1046 if (!old_oid)
1047 - die("BUG: verify called with old_oid set to NULL");
1047 + BUG("verify called with old_oid set to NULL");
1048 return ref_transaction_update(transaction, refname,
1049 NULL, old_oid,
1050 flags, NULL, err);
@@ -1645,7 +1645,7 @@ static struct ref_store *ref_store_init(const char *gitdir,
1645 struct ref_store *refs;
1646
1647 if (!be)
1648 - die("BUG: reference backend %s is unknown", be_name);
1648 + BUG("reference backend %s is unknown", be_name);
1649
1650 refs = be->init(gitdir, flags);
1651 return refs;
@@ -1673,7 +1673,7 @@ static void register_ref_store_map(struct hashmap *map,
1673 hashmap_init(map, ref_store_hash_cmp, NULL, 0);
1674
1675 if (hashmap_put(map, alloc_ref_store_hash_entry(name, refs)))
1676 - die("BUG: %s ref_store '%s' initialized twice", type, name);
1676 + BUG("%s ref_store '%s' initialized twice", type, name);
1677 }
1678
1679 struct ref_store *get_submodule_ref_store(const char *submodule)
@@ -1819,7 +1819,7 @@ int ref_update_reject_duplicates(struct string_list *refnames,
1819 refnames->items[i].string);
1820 return 1;
1821 } else if (cmp > 0) {
1822 - die("BUG: ref_update_reject_duplicates() received unsorted list");
1822 + BUG("ref_update_reject_duplicates() received unsorted list");
1823 }
1824 }
1825 return 0;
@@ -1835,13 +1835,13 @@ int ref_transaction_prepare(struct ref_transaction *transaction,
1835 /* Good. */
1836 break;
1837 case REF_TRANSACTION_PREPARED:
1838 - die("BUG: prepare called twice on reference transaction");
1838 + BUG("prepare called twice on reference transaction");
1839 break;
1840 case REF_TRANSACTION_CLOSED:
1841 - die("BUG: prepare called on a closed reference transaction");
1841 + BUG("prepare called on a closed reference transaction");
1842 break;
1843 default:
1844 - die("BUG: unexpected reference transaction state");
1844 + BUG("unexpected reference transaction state");
1845 break;
1846 }
1847
@@ -1868,10 +1868,10 @@ int ref_transaction_abort(struct ref_transaction *transaction,
1868 ret = refs->be->transaction_abort(refs, transaction, err);
1869 break;
1870 case REF_TRANSACTION_CLOSED:
1871 - die("BUG: abort called on a closed reference transaction");
1871 + BUG("abort called on a closed reference transaction");
1872 break;
1873 default:
1874 - die("BUG: unexpected reference transaction state");
1874 + BUG("unexpected reference transaction state");
1875 break;
1876 }
1877
@@ -1896,10 +1896,10 @@ int ref_transaction_commit(struct ref_transaction *transaction,
1896 /* Fall through to finish. */
1897 break;
1898 case REF_TRANSACTION_CLOSED:
1899 - die("BUG: commit called on a closed reference transaction");
1899 + BUG("commit called on a closed reference transaction");
1900 break;
1901 default:
1902 - die("BUG: unexpected reference transaction state");
1902 + BUG("unexpected reference transaction state");
1903 break;
1904 }
1905
@@ -1980,7 +1980,7 @@ int refs_verify_refname_available(struct ref_store *refs,
1980 }
1981
1982 if (ok != ITER_DONE)
1983 - die("BUG: error while iterating over references");
1983 + BUG("error while iterating over references");
1984
1985 extra_refname = find_descendant_ref(dirname.buf, extras, skip);
1986 if (extra_refname)
refs/files-backend.c
+10 -10
@@ -125,7 +125,7 @@ static void files_assert_main_repository(struct files_ref_store *refs,
125 if (refs->store_flags & REF_STORE_MAIN)
126 return;
127
128 - die("BUG: operation %s only allowed for main ref store", caller);
128 + BUG("operation %s only allowed for main ref store", caller);
129 }
130
131 /*
@@ -141,13 +141,13 @@ static struct files_ref_store *files_downcast(struct ref_store *ref_store,
141 struct files_ref_store *refs;
142
143 if (ref_store->be != &refs_be_files)
144 - die("BUG: ref_store is type \"%s\" not \"files\" in %s",
144 + BUG("ref_store is type \"%s\" not \"files\" in %s",
145 ref_store->be->name, caller);
146
147 refs = (struct files_ref_store *)ref_store;
148
149 if ((refs->store_flags & required_flags) != required_flags)
150 - die("BUG: operation %s requires abilities 0x%x, but only have 0x%x",
150 + BUG("operation %s requires abilities 0x%x, but only have 0x%x",
151 caller, required_flags, refs->store_flags);
152
153 return refs;
@@ -166,7 +166,7 @@ static void files_reflog_path(struct files_ref_store *refs,
166 strbuf_addf(sb, "%s/logs/%s", refs->gitcommondir, refname);
167 break;
168 default:
169 - die("BUG: unknown ref type %d of ref %s",
169 + BUG("unknown ref type %d of ref %s",
170 ref_type(refname), refname);
171 }
172 }
@@ -184,7 +184,7 @@ static void files_ref_path(struct files_ref_store *refs,
184 strbuf_addf(sb, "%s/%s", refs->gitcommondir, refname);
185 break;
186 default:
187 - die("BUG: unknown ref type %d of ref %s",
187 + BUG("unknown ref type %d of ref %s",
188 ref_type(refname), refname);
189 }
190 }
@@ -2010,7 +2010,7 @@ static int files_for_each_reflog_ent_reverse(struct ref_store *ref_store,
2010
2011 }
2012 if (!ret && sb.len)
2013 - die("BUG: reverse reflog parser had leftover data");
2013 + BUG("reverse reflog parser had leftover data");
2014
2015 fclose(logfp);
2016 strbuf_release(&sb);
@@ -2088,7 +2088,7 @@ static int files_reflog_iterator_advance(struct ref_iterator *ref_iterator)
2088 static int files_reflog_iterator_peel(struct ref_iterator *ref_iterator,
2089 struct object_id *peeled)
2090 {
2091 - die("BUG: ref_iterator_peel() called for reflog_iterator");
2091 + BUG("ref_iterator_peel() called for reflog_iterator");
2092 }
2093
2094 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,
2873 assert(err);
2874
2875 if (transaction->state != REF_TRANSACTION_OPEN)
2876 - die("BUG: commit called for transaction that is not open");
2876 + BUG("commit called for transaction that is not open");
2877
2878 /* Fail if a refname appears more than once in the transaction: */
2879 for (i = 0; i < transaction->nr; i++)
@@ -2899,7 +2899,7 @@ static int files_initial_transaction_commit(struct ref_store *ref_store,
2899 */
2900 if (refs_for_each_rawref(&refs->base, ref_present,
2901 &affected_refnames))
2902 - die("BUG: initial ref transaction called with existing refs");
2902 + BUG("initial ref transaction called with existing refs");
2903
2904 packed_transaction = ref_store_transaction_begin(refs->packed_ref_store, err);
2905 if (!packed_transaction) {
@@ -2912,7 +2912,7 @@ static int files_initial_transaction_commit(struct ref_store *ref_store,
2912
2913 if ((update->flags & REF_HAVE_OLD) &&
2914 !is_null_oid(&update->old_oid))
2915 - die("BUG: initial ref transaction with old_sha1 set");
2915 + BUG("initial ref transaction with old_sha1 set");
2916 if (refs_verify_refname_available(&refs->base, update->refname,
2917 &affected_refnames, NULL,
2918 err)) {
refs/iterator.c
+3 -3
@@ -54,7 +54,7 @@ static int empty_ref_iterator_advance(struct ref_iterator *ref_iterator)
54 static int empty_ref_iterator_peel(struct ref_iterator *ref_iterator,
55 struct object_id *peeled)
56 {
57 - die("BUG: peel called for empty iterator");
57 + BUG("peel called for empty iterator");
58 }
59
60 static int empty_ref_iterator_abort(struct ref_iterator *ref_iterator)
@@ -177,7 +177,7 @@ static int merge_ref_iterator_peel(struct ref_iterator *ref_iterator,
177 (struct merge_ref_iterator *)ref_iterator;
178
179 if (!iter->current) {
180 - die("BUG: peel called before advance for merge iterator");
180 + BUG("peel called before advance for merge iterator");
181 }
182 return ref_iterator_peel(*iter->current, peeled);
183 }
@@ -338,7 +338,7 @@ static int prefix_ref_iterator_advance(struct ref_iterator *ref_iterator)
338 * trimming, report it as a bug:
339 */
340 if (strlen(iter->iter0->refname) <= iter->trim)
341 - die("BUG: attempt to trim too many characters");
341 + BUG("attempt to trim too many characters");
342 iter->base.refname = iter->iter0->refname + iter->trim;
343 } else {
344 iter->base.refname = iter->iter0->refname;
refs/packed-backend.c
+8 -8
@@ -221,13 +221,13 @@ static struct packed_ref_store *packed_downcast(struct ref_store *ref_store,
221 struct packed_ref_store *refs;
222
223 if (ref_store->be != &refs_be_packed)
224 - die("BUG: ref_store is type \"%s\" not \"packed\" in %s",
224 + BUG("ref_store is type \"%s\" not \"packed\" in %s",
225 ref_store->be->name, caller);
226
227 refs = (struct packed_ref_store *)ref_store;
228
229 if ((refs->store_flags & required_flags) != required_flags)
230 - die("BUG: unallowed operation (%s), requires %x, has %x\n",
230 + BUG("unallowed operation (%s), requires %x, has %x\n",
231 caller, required_flags, refs->store_flags);
232
233 return refs;
@@ -1036,7 +1036,7 @@ void packed_refs_unlock(struct ref_store *ref_store)
1036 "packed_refs_unlock");
1037
1038 if (!is_lock_file_locked(&refs->lock))
1039 - die("BUG: packed_refs_unlock() called when not locked");
1039 + BUG("packed_refs_unlock() called when not locked");
1040 rollback_lock_file(&refs->lock);
1041 }
1042
@@ -1089,7 +1089,7 @@ static int write_with_updates(struct packed_ref_store *refs,
1089 char *packed_refs_path;
1090
1091 if (!is_lock_file_locked(&refs->lock))
1092 - die("BUG: write_with_updates() called while unlocked");
1092 + BUG("write_with_updates() called while unlocked");
1093
1094 /*
1095 * If packed-refs is a symlink, we want to overwrite the
@@ -1563,21 +1563,21 @@ static int packed_create_symref(struct ref_store *ref_store,
1563 const char *refname, const char *target,
1564 const char *logmsg)
1565 {
1566 - die("BUG: packed reference store does not support symrefs");
1566 + BUG("packed reference store does not support symrefs");
1567 }
1568
1569 static int packed_rename_ref(struct ref_store *ref_store,
1570 const char *oldrefname, const char *newrefname,
1571 const char *logmsg)
1572 {
1573 - die("BUG: packed reference store does not support renaming references");
1573 + BUG("packed reference store does not support renaming references");
1574 }
1575
1576 static int packed_copy_ref(struct ref_store *ref_store,
1577 const char *oldrefname, const char *newrefname,
1578 const char *logmsg)
1579 {
1580 - die("BUG: packed reference store does not support copying references");
1580 + BUG("packed reference store does not support copying references");
1581 }
1582
1583 static struct ref_iterator *packed_reflog_iterator_begin(struct ref_store *ref_store)
@@ -1610,7 +1610,7 @@ static int packed_create_reflog(struct ref_store *ref_store,
1610 const char *refname, int force_create,
1611 struct strbuf *err)
1612 {
1613 - die("BUG: packed reference store does not support reflogs");
1613 + BUG("packed reference store does not support reflogs");
1614 }
1615
1616 static int packed_delete_reflog(struct ref_store *ref_store,
refs/ref-cache.c
+1 -1
@@ -23,7 +23,7 @@ struct ref_dir *get_ref_dir(struct ref_entry *entry)
23 dir = &entry->u.subdir;
24 if (entry->flag & REF_INCOMPLETE) {
25 if (!dir->cache->fill_ref_dir)
26 - die("BUG: incomplete ref_store without fill_ref_dir function");
26 + BUG("incomplete ref_store without fill_ref_dir function");
27
28 dir->cache->fill_ref_dir(dir->cache->ref_store, dir, entry->name);
29 entry->flag &= ~REF_INCOMPLETE;
remote.c
+1 -1
@@ -1819,7 +1819,7 @@ static const char *branch_get_push_1(struct branch *branch, struct strbuf *err)
1819 }
1820 }
1821
1822 - die("BUG: unhandled push situation");
1822 + BUG("unhandled push situation");
1823 }
1824
1825 const char *branch_get_push(struct branch *branch, struct strbuf *err)
revision.c
+2 -2
@@ -2107,7 +2107,7 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
2107 revs->ignore_missing = 1;
2108 } else if (!strcmp(arg, "--exclude-promisor-objects")) {
2109 if (fetch_if_missing)
2110 - die("BUG: exclude_promisor_objects can only be used when fetch_if_missing is 0");
2110 + BUG("exclude_promisor_objects can only be used when fetch_if_missing is 0");
2111 revs->exclude_promisor_objects = 1;
2112 } else {
2113 int opts = diff_opt_parse(&revs->diffopt, argv, argc, revs->prefix);
@@ -2173,7 +2173,7 @@ static int handle_revision_pseudo_opt(const char *submodule,
2173 * supported right now, so stick to single worktree.
2174 */
2175 if (!revs->single_worktree)
2176 - die("BUG: --single-worktree cannot be used together with submodule");
2176 + BUG("--single-worktree cannot be used together with submodule");
2177 refs = get_submodule_ref_store(submodule);
2178 } else
2179 refs = get_main_ref_store();
run-command.c
+5 -5
@@ -245,7 +245,7 @@ int sane_execvp(const char *file, char * const argv[])
245 static const char **prepare_shell_cmd(struct argv_array *out, const char **argv)
246 {
247 if (!argv[0])
248 - die("BUG: shell command is empty");
248 + BUG("shell command is empty");
249
250 if (strcspn(argv[0], "|&;<>()$`\\\"' \t\n*?[#~=%") != strlen(argv[0])) {
251 #ifndef GIT_WINDOWS_NATIVE
@@ -383,7 +383,7 @@ static void child_err_spew(struct child_process *cmd, struct child_err *cerr)
383 static void prepare_cmd(struct argv_array *out, const struct child_process *cmd)
384 {
385 if (!cmd->argv[0])
386 - die("BUG: command is empty");
386 + BUG("command is empty");
387
388 /*
389 * Add SHELL_PATH so in the event exec fails with ENOEXEC we can
@@ -964,7 +964,7 @@ int run_command(struct child_process *cmd)
964 int code;
965
966 if (cmd->out < 0 || cmd->err < 0)
967 - die("BUG: run_command with a pipe can cause deadlock");
967 + BUG("run_command with a pipe can cause deadlock");
968
969 code = start_command(cmd);
970 if (code)
@@ -1554,7 +1554,7 @@ static void pp_init(struct parallel_processes *pp,
1554
1555 pp->data = data;
1556 if (!get_next_task)
1557 - die("BUG: you need to specify a get_next_task function");
1557 + BUG("you need to specify a get_next_task function");
1558 pp->get_next_task = get_next_task;
1559
1560 pp->start_failure = start_failure ? start_failure : default_start_failure;
@@ -1616,7 +1616,7 @@ static int pp_start_one(struct parallel_processes *pp)
1616 if (pp->children[i].state == GIT_CP_FREE)
1617 break;
1618 if (i == pp->max_processes)
1619 - die("BUG: bookkeeping is hard");
1619 + BUG("bookkeeping is hard");
1620
1621 code = pp->get_next_task(&pp->children[i].process,
1622 &pp->children[i].err,
setup.c
+2 -2
@@ -539,7 +539,7 @@ void read_gitfile_error_die(int error_code, const char *path, const char *dir)
539 case READ_GITFILE_ERR_NOT_A_REPO:
540 die(_("not a git repository: %s"), dir);
541 default:
542 - die("BUG: unknown error code");
542 + BUG("unknown error code");
543 }
544 }
545
@@ -1086,7 +1086,7 @@ const char *setup_git_directory_gently(int *nongit_ok)
1086 "Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set)."),
1087 dir.buf);
1088 default:
1089 - die("BUG: unhandled setup_git_directory_1() result");
1089 + BUG("unhandled setup_git_directory_1() result");
1090 }
1091
1092 if (prefix)
sha1-lookup.c
+1 -1
@@ -81,7 +81,7 @@ int sha1_pos(const unsigned char *sha1, void *table, size_t nr,
81 mi = (nr - 1) * (miv - lov) / (hiv - lov);
82 if (lo <= mi && mi < hi)
83 break;
84 - die("BUG: assertion failed in binary search");
84 + BUG("assertion failed in binary search");
85 }
86 }
87 }
sha1-name.c
+2 -2
@@ -384,7 +384,7 @@ static int get_short_oid(const char *name, int len, struct object_id *oid,
384 return -1;
385
386 if (HAS_MULTI_BITS(flags & GET_OID_DISAMBIGUATORS))
387 - die("BUG: multiple get_short_oid disambiguator flags");
387 + BUG("multiple get_short_oid disambiguator flags");
388
389 if (flags & GET_OID_COMMIT)
390 ds.fn = disambiguate_commit_only;
@@ -1729,6 +1729,6 @@ void maybe_die_on_misspelt_object_name(const char *name, const char *prefix)
1729 int get_oid_with_context(const char *str, unsigned flags, struct object_id *oid, struct object_context *oc)
1730 {
1731 if (flags & GET_OID_FOLLOW_SYMLINKS && flags & GET_OID_ONLY_TO_DIE)
1732 - die("BUG: incompatible flags for get_sha1_with_context");
1732 + BUG("incompatible flags for get_sha1_with_context");
1733 return get_oid_with_context_1(str, flags, NULL, oid, oc);
1734 }
shallow.c
+3 -3
@@ -20,7 +20,7 @@ static char *alternate_shallow_file;
20 void set_alternate_shallow_file(const char *path, int override)
21 {
22 if (is_shallow != -1)
23 - die("BUG: is_repository_shallow must not be called before set_alternate_shallow_file");
23 + BUG("is_repository_shallow must not be called before set_alternate_shallow_file");
24 if (alternate_shallow_file && !override)
25 return;
26 free(alternate_shallow_file);
@@ -218,7 +218,7 @@ struct commit_list *get_shallow_commits_by_rev_list(int ac, const char **av,
218 static void check_shallow_file_for_update(void)
219 {
220 if (is_shallow == -1)
221 - die("BUG: shallow must be initialized by now");
221 + BUG("shallow must be initialized by now");
222
223 if (!stat_validity_check(&shallow_stat, git_path_shallow()))
224 die("shallow file has changed since we read it");
@@ -446,7 +446,7 @@ static uint32_t *paint_alloc(struct paint_info *info)
446 void *p;
447 if (!info->pool_count || size > info->end - info->free) {
448 if (size > POOL_SIZE)
449 - die("BUG: pool size too small for %d in paint_alloc()",
449 + BUG("pool size too small for %d in paint_alloc()",
450 size);
451 info->pool_count++;
452 REALLOC_ARRAY(info->pools, info->pool_count);
sigchain.c
+1 -1
@@ -13,7 +13,7 @@ static struct sigchain_signal signals[SIGCHAIN_MAX_SIGNALS];
13 static void check_signum(int sig)
14 {
15 if (sig < 1 || sig >= SIGCHAIN_MAX_SIGNALS)
16 - die("BUG: signal out of range: %d", sig);
16 + BUG("signal out of range: %d", sig);
17 }
18
19 int sigchain_push(int sig, sigchain_fun f)
strbuf.c
+2 -2
@@ -309,12 +309,12 @@ void strbuf_vaddf(struct strbuf *sb, const char *fmt, va_list ap)
309 len = vsnprintf(sb->buf + sb->len, sb->alloc - sb->len, fmt, cp);
310 va_end(cp);
311 if (len < 0)
312 - die("BUG: your vsnprintf is broken (returned %d)", len);
312 + BUG("your vsnprintf is broken (returned %d)", len);
313 if (len > strbuf_avail(sb)) {
314 strbuf_grow(sb, len);
315 len = vsnprintf(sb->buf + sb->len, sb->alloc - sb->len, fmt, ap);
316 if (len > strbuf_avail(sb))
317 - die("BUG: your vsnprintf is broken (insatiable)");
317 + BUG("your vsnprintf is broken (insatiable)");
318 }
319 strbuf_setlen(sb, sb->len + len);
320 }
submodule.c
+3 -3
@@ -1398,7 +1398,7 @@ unsigned is_submodule_modified(const char *path, int ignore_untracked)
1398 buf.buf[0] == '2') {
1399 /* T = line type, XY = status, SSSS = submodule state */
1400 if (buf.len < strlen("T XY SSSS"))
1401 - die("BUG: invalid status --porcelain=2 line %s",
1401 + BUG("invalid status --porcelain=2 line %s",
1402 buf.buf);
1403
1404 if (buf.buf[5] == 'S' && buf.buf[8] == 'U')
@@ -1607,7 +1607,7 @@ int submodule_move_head(const char *path,
1607 sub = submodule_from_path(&null_oid, path);
1608
1609 if (!sub)
1610 - die("BUG: could not get submodule information for '%s'", path);
1610 + BUG("could not get submodule information for '%s'", path);
1611
1612 if (old_head && !(flags & SUBMODULE_MOVE_HEAD_FORCE)) {
1613 /* Check if the submodule has a dirty index. */
@@ -1965,7 +1965,7 @@ void absorb_git_dir_into_superproject(const char *prefix,
1965 struct strbuf sb = STRBUF_INIT;
1966
1967 if (flags & ~ABSORB_GITDIR_RECURSE_SUBMODULES)
1968 - die("BUG: we don't know how to pass the flags down?");
1968 + BUG("we don't know how to pass the flags down?");
1969
1970 strbuf_addstr(&sb, get_super_prefix_or_empty());
1971 strbuf_addstr(&sb, path);
t/helper/test-example-decorate.c
+8 -8
@@ -30,10 +30,10 @@ int cmd__example_decorate(int argc, const char **argv)
30 two = lookup_unknown_object(two_oid.hash);
31 ret = add_decoration(&n, one, &decoration_a);
32 if (ret)
33 - die("BUG: when adding a brand-new object, NULL should be returned");
33 + BUG("when adding a brand-new object, NULL should be returned");
34 ret = add_decoration(&n, two, NULL);
35 if (ret)
36 - die("BUG: when adding a brand-new object, NULL should be returned");
36 + BUG("when adding a brand-new object, NULL should be returned");
37
38 /*
39 * When re-adding an already existing object, the old decoration is
@@ -41,10 +41,10 @@ int cmd__example_decorate(int argc, const char **argv)
41 */
42 ret = add_decoration(&n, one, NULL);
43 if (ret != &decoration_a)
44 - die("BUG: when readding an already existing object, existing decoration should be returned");
44 + BUG("when readding an already existing object, existing decoration should be returned");
45 ret = add_decoration(&n, two, &decoration_b);
46 if (ret)
47 - die("BUG: when readding an already existing object, existing decoration should be returned");
47 + BUG("when readding an already existing object, existing decoration should be returned");
48
49 /*
50 * Lookup returns the added declarations, or NULL if the object was
@@ -52,14 +52,14 @@ int cmd__example_decorate(int argc, const char **argv)
52 */
53 ret = lookup_decoration(&n, one);
54 if (ret)
55 - die("BUG: lookup should return added declaration");
55 + BUG("lookup should return added declaration");
56 ret = lookup_decoration(&n, two);
57 if (ret != &decoration_b)
58 - die("BUG: lookup should return added declaration");
58 + BUG("lookup should return added declaration");
59 three = lookup_unknown_object(three_oid.hash);
60 ret = lookup_decoration(&n, three);
61 if (ret)
62 - die("BUG: lookup for unknown object should return NULL");
62 + BUG("lookup for unknown object should return NULL");
63
64 /*
65 * The user can also loop through all entries.
@@ -69,7 +69,7 @@ int cmd__example_decorate(int argc, const char **argv)
69 objects_noticed++;
70 }
71 if (objects_noticed != 2)
72 - die("BUG: should have 2 objects");
72 + BUG("should have 2 objects");
73
74 return 0;
75 }
tmp-objdir.c
+1 -1
@@ -127,7 +127,7 @@ struct tmp_objdir *tmp_objdir_create(void)
127 struct tmp_objdir *t;
128
129 if (the_tmp_objdir)
130 - die("BUG: only one tmp_objdir can be used at a time");
130 + BUG("only one tmp_objdir can be used at a time");
131
132 t = xmalloc(sizeof(*t));
133 strbuf_init(&t->path, 0);
trailer.c
+3 -3
@@ -298,7 +298,7 @@ static void apply_arg_if_exists(struct trailer_item *in_tok,
298 free_arg_item(arg_tok);
299 break;
300 default:
301 - die("BUG: trailer.c: unhandled value %d",
301 + BUG("trailer.c: unhandled value %d",
302 arg_tok->conf.if_exists);
303 }
304 }
@@ -323,7 +323,7 @@ static void apply_arg_if_missing(struct list_head *head,
323 list_add(&to_add->list, head);
324 break;
325 default:
326 - die("BUG: trailer.c: unhandled value %d",
326 + BUG("trailer.c: unhandled value %d",
327 arg_tok->conf.if_missing);
328 }
329 }
@@ -557,7 +557,7 @@ static int git_trailer_config(const char *conf_key, const char *value, void *cb)
557 warning(_("unknown value '%s' for key '%s'"), value, conf_key);
558 break;
559 default:
560 - die("BUG: trailer.c: unhandled type %d", type);
560 + BUG("trailer.c: unhandled type %d", type);
561 }
562 return 0;
563 }
transport.c
+2 -2
@@ -636,7 +636,7 @@ void transport_take_over(struct transport *transport,
636 struct git_transport_data *data;
637
638 if (!transport->smart_options)
639 - die("BUG: taking over transport requires non-NULL "
639 + BUG("taking over transport requires non-NULL "
640 "smart_options field.");
641
642 data = xcalloc(1, sizeof(*data));
@@ -761,7 +761,7 @@ int is_transport_allowed(const char *type, int from_user)
761 return from_user;
762 }
763
764 - die("BUG: invalid protocol_allow_config type");
764 + BUG("invalid protocol_allow_config type");
765 }
766
767 void transport_check_allowed(const char *type)
unpack-trees.c
+1 -1
@@ -398,7 +398,7 @@ static int check_updates(struct unpack_trees_options *o)
398
399 if (ce->ce_flags & CE_UPDATE) {
400 if (ce->ce_flags & CE_WT_REMOVE)
401 - die("BUG: both update and delete flags are set on %s",
401 + BUG("both update and delete flags are set on %s",
402 ce->name);
403 display_progress(progress, ++cnt);
404 ce->ce_flags &= ~CE_UPDATE;
worktree.c
+1 -1
@@ -338,7 +338,7 @@ void update_worktree_location(struct worktree *wt, const char *path_)
338 struct strbuf path = STRBUF_INIT;
339
340 if (is_main_worktree(wt))
341 - die("BUG: can't relocate main worktree");
341 + BUG("can't relocate main worktree");
342
343 strbuf_realpath(&path, path_, 1);
344 if (fspathcmp(wt->path, path.buf)) {
wrapper.c
+2 -2
@@ -643,9 +643,9 @@ int xsnprintf(char *dst, size_t max, const char *fmt, ...)
643 va_end(ap);
644
645 if (len < 0)
646 - die("BUG: your snprintf is broken");
646 + BUG("your snprintf is broken");
647 if (len >= max)
648 - die("BUG: attempt to snprintf into too-small buffer");
648 + BUG("attempt to snprintf into too-small buffer");
649 return len;
650 }
651
wt-status.c
+10 -10
@@ -264,7 +264,7 @@ static const char *wt_status_unmerged_status_string(int stagemask)
264 case 7:
265 return _("both modified:");
266 default:
267 - die("BUG: unhandled unmerged status %x", stagemask);
267 + BUG("unhandled unmerged status %x", stagemask);
268 }
269 }
270
@@ -377,7 +377,7 @@ static void wt_longstatus_print_change_data(struct wt_status *s,
377 status = d->worktree_status;
378 break;
379 default:
380 - die("BUG: unhandled change_type %d in wt_longstatus_print_change_data",
380 + BUG("unhandled change_type %d in wt_longstatus_print_change_data",
381 change_type);
382 }
383
@@ -395,7 +395,7 @@ static void wt_longstatus_print_change_data(struct wt_status *s,
395 status_printf(s, color(WT_STATUS_HEADER, s), "\t");
396 what = wt_status_diff_status_string(status);
397 if (!what)
398 - die("BUG: unhandled diff status %c", status);
398 + BUG("unhandled diff status %c", status);
399 len = label_width - utf8_strwidth(what);
400 assert(len >= 0);
401 if (one_name != two_name)
@@ -470,7 +470,7 @@ static void wt_status_collect_changed_cb(struct diff_queue_struct *q,
470 case DIFF_STATUS_COPIED:
471 case DIFF_STATUS_RENAMED:
472 if (d->rename_status)
473 - die("BUG: multiple renames on the same target? how?");
473 + BUG("multiple renames on the same target? how?");
474 d->rename_source = xstrdup(p->one->path);
475 d->rename_score = p->score * 100 / MAX_SCORE;
476 d->rename_status = p->status;
@@ -484,7 +484,7 @@ static void wt_status_collect_changed_cb(struct diff_queue_struct *q,
484 break;
485
486 default:
487 - die("BUG: unhandled diff-files status '%c'", p->status);
487 + BUG("unhandled diff-files status '%c'", p->status);
488 break;
489 }
490
@@ -547,7 +547,7 @@ static void wt_status_collect_updated_cb(struct diff_queue_struct *q,
547 case DIFF_STATUS_COPIED:
548 case DIFF_STATUS_RENAMED:
549 if (d->rename_status)
550 - die("BUG: multiple renames on the same target? how?");
550 + BUG("multiple renames on the same target? how?");
551 d->rename_source = xstrdup(p->one->path);
552 d->rename_score = p->score * 100 / MAX_SCORE;
553 d->rename_status = p->status;
@@ -569,7 +569,7 @@ static void wt_status_collect_updated_cb(struct diff_queue_struct *q,
569 break;
570
571 default:
572 - die("BUG: unhandled diff-index status '%c'", p->status);
572 + BUG("unhandled diff-index status '%c'", p->status);
573 break;
574 }
575 }
@@ -2158,7 +2158,7 @@ static void wt_porcelain_v2_print_unmerged_entry(
2158 case 6: key = "AA"; break; /* both added */
2159 case 7: key = "UU"; break; /* both modified */
2160 default:
2161 - die("BUG: unhandled unmerged status %x", d->stagemask);
2161 + BUG("unhandled unmerged status %x", d->stagemask);
2162 }
2163
2164 /*
@@ -2185,7 +2185,7 @@ static void wt_porcelain_v2_print_unmerged_entry(
2185 sum |= (1 << (stage - 1));
2186 }
2187 if (sum != d->stagemask)
2188 - die("BUG: observed stagemask 0x%x != expected stagemask 0x%x", sum, d->stagemask);
2188 + BUG("observed stagemask 0x%x != expected stagemask 0x%x", sum, d->stagemask);
2189
2190 if (s->null_termination)
2191 path_index = it->string;
@@ -2289,7 +2289,7 @@ void wt_status_print(struct wt_status *s)
2289 wt_porcelain_v2_print(s);
2290 break;
2291 case STATUS_FORMAT_UNSPECIFIED:
2292 - die("BUG: finalize_deferred_config() should have been called");
2292 + BUG("finalize_deferred_config() should have been called");
2293 break;
2294 case STATUS_FORMAT_NONE:
2295 case STATUS_FORMAT_LONG:
zlib.c
+2 -2
@@ -52,9 +52,9 @@ static void zlib_post_call(git_zstream *s)
52 bytes_consumed = s->z.next_in - s->next_in;
53 bytes_produced = s->z.next_out - s->next_out;
54 if (s->z.total_out != s->total_out + bytes_produced)
55 - die("BUG: total_out mismatch");
55 + BUG("total_out mismatch");
56 if (s->z.total_in != s->total_in + bytes_consumed)
57 - die("BUG: total_in mismatch");
57 + BUG("total_in mismatch");
58
59 s->total_out = s->z.total_out;
60 s->total_in = s->z.total_in;