Commit 033abf97 authored by Johannes Schindelin's avatar Johannes Schindelin Committed by Junio C Hamano

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

In d8193743 (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 588a538a
(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's avatarJohannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: 's avatarJunio C Hamano <gitster@pobox.com>
parent dde74d73
......@@ -2375,7 +2375,7 @@ static void update_pre_post_images(struct image *preimage,
if (postlen
? postlen < new_buf - postimage->buf
: postimage->len < new_buf - postimage->buf)
die("BUG: caller miscounted postlen: asked %d, orig = %d, used = %d",
BUG("caller miscounted postlen: asked %d, orig = %d, used = %d",
(int)postlen, (int) postimage->len, (int)(new_buf - postimage->buf));
/* Fix the length of the whole thing */
......@@ -3509,7 +3509,7 @@ static int load_current(struct apply_state *state,
unsigned mode = patch->new_mode;
if (!patch->is_new)
die("BUG: patch to %s is not a creation", patch->old_name);
BUG("patch to %s is not a creation", patch->old_name);
pos = cache_name_pos(name, strlen(name));
if (pos < 0)
......
......@@ -441,7 +441,7 @@ static int write_tar_filter_archive(const struct archiver *ar,
int r;
if (!ar->data)
die("BUG: tar-filter archiver called with no filter defined");
BUG("tar-filter archiver called with no filter defined");
strbuf_addstr(&cmd, ar->data);
if (args->compression_level >= 0)
......
......@@ -157,7 +157,7 @@ static void all_attrs_init(struct attr_hashmap *map, struct attr_check *check)
size = hashmap_get_size(&map->map);
if (size < check->all_attrs_nr)
die("BUG: interned attributes shouldn't be deleted");
BUG("interned attributes shouldn't be deleted");
/*
* If the number of attributes in the global dictionary has increased
......@@ -541,7 +541,7 @@ static void check_vector_remove(struct attr_check *check)
break;
if (i >= check_vector.nr)
die("BUG: no entry found");
BUG("no entry found");
/* shift entries over */
for (; i < check_vector.nr - 1; i++)
......@@ -599,11 +599,11 @@ struct attr_check *attr_check_initl(const char *one, ...)
const struct git_attr *attr;
param = va_arg(params, const char *);
if (!param)
die("BUG: counted %d != ended at %d",
BUG("counted %d != ended at %d",
check->nr, cnt);
attr = git_attr(param);
if (!attr)
die("BUG: %s: not a valid attribute name", param);
BUG("%s: not a valid attribute name", param);
check->items[cnt].attr = attr;
}
va_end(params);
......@@ -714,7 +714,7 @@ void git_attr_set_direction(enum git_attr_direction new_direction,
struct index_state *istate)
{
if (is_bare_repository() && new_direction != GIT_ATTR_INDEX)
die("BUG: non-INDEX attr direction in a bare repo");
BUG("non-INDEX attr direction in a bare repo");
if (new_direction != direction)
drop_all_attr_stacks();
......
......@@ -1806,7 +1806,7 @@ void setup_scoreboard(struct blame_scoreboard *sb, const char *path, struct blam
l->item = c;
if (add_decoration(&sb->revs->children,
&c->parents->item->object, l))
die("BUG: not unique item in first-parent chain");
BUG("not unique item in first-parent chain");
c = c->parents->item;
}
......
......@@ -403,11 +403,11 @@ static void am_load(struct am_state *state)
struct strbuf sb = STRBUF_INIT;
if (read_state_file(&sb, state, "next", 1) < 0)
die("BUG: state file 'next' does not exist");
BUG("state file 'next' does not exist");
state->cur = strtol(sb.buf, NULL, 10);
if (read_state_file(&sb, state, "last", 1) < 0)
die("BUG: state file 'last' does not exist");
BUG("state file 'last' does not exist");
state->last = strtol(sb.buf, NULL, 10);
if (read_author_script(state) < 0)
......@@ -986,7 +986,7 @@ static int split_mail(struct am_state *state, enum patch_format patch_format,
case PATCH_FORMAT_MBOXRD:
return split_mail_mbox(state, paths, keep_cr, 1);
default:
die("BUG: invalid patch_format");
BUG("invalid patch_format");
}
return -1;
}
......@@ -1041,7 +1041,7 @@ static void am_setup(struct am_state *state, enum patch_format patch_format,
str = "b";
break;
default:
die("BUG: invalid value for state->keep");
BUG("invalid value for state->keep");
}
write_state_text(state, "keep", str);
......@@ -1058,7 +1058,7 @@ static void am_setup(struct am_state *state, enum patch_format patch_format,
str = "t";
break;
default:
die("BUG: invalid value for state->scissors");
BUG("invalid value for state->scissors");
}
write_state_text(state, "scissors", str);
......@@ -1216,7 +1216,7 @@ static int parse_mail(struct am_state *state, const char *mail)
mi.keep_non_patch_brackets_in_subject = 1;
break;
default:
die("BUG: invalid value for state->keep");
BUG("invalid value for state->keep");
}
if (state->message_id)
......@@ -1232,7 +1232,7 @@ static int parse_mail(struct am_state *state, const char *mail)
mi.use_scissors = 1;
break;
default:
die("BUG: invalid value for state->scissors");
BUG("invalid value for state->scissors");
}
mi.input = xfopen(mail, "r");
......@@ -1463,7 +1463,7 @@ static int run_apply(const struct am_state *state, const char *index_file)
int options = 0;
if (init_apply_state(&apply_state, NULL))
die("BUG: init_apply_state() failed");
BUG("init_apply_state() failed");
argv_array_push(&apply_opts, "apply");
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)
apply_state.apply_verbosity = verbosity_silent;
if (check_apply_state(&apply_state, force_apply))
die("BUG: check_apply_state() failed");
BUG("check_apply_state() failed");
argv_array_push(&apply_paths, am_path(state, "patch"));
......@@ -2407,7 +2407,7 @@ int cmd_am(int argc, const char **argv, const char *prefix)
ret = show_patch(&state);
break;
default:
die("BUG: invalid resume value");
BUG("invalid resume value");
}
am_state_release(&state);
......
......@@ -497,7 +497,7 @@ static void copy_or_rename_branch(const char *oldname, const char *newname, int
if (!skip_prefix(oldref.buf, "refs/heads/", &interpreted_oldname) ||
!skip_prefix(newref.buf, "refs/heads/", &interpreted_newname)) {
die("BUG: expected prefix missing for refs");
BUG("expected prefix missing for refs");
}
if (copy)
......
......@@ -312,7 +312,7 @@ static void print_object_or_die(struct batch_options *opt, struct expand_data *d
die("could not convert '%s' %s",
oid_to_hex(oid), data->rest);
} else
die("BUG: invalid cmdmode: %c", opt->cmdmode);
BUG("invalid cmdmode: %c", opt->cmdmode);
batch_write(opt, contents, size);
free(contents);
} 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,
(uintmax_t)strlen(obj_name), obj_name);
break;
default:
die("BUG: unknown get_sha1_with_context result %d\n",
BUG("unknown get_sha1_with_context result %d\n",
result);
break;
}
......
......@@ -823,7 +823,7 @@ static void write_refspec_config(const char *src_ref_prefix,
} else if (remote_head_points_at) {
const char *head = remote_head_points_at->name;
if (!skip_prefix(head, "refs/heads/", &head))
die("BUG: remote HEAD points at non-head?");
BUG("remote HEAD points at non-head?");
strbuf_addf(&value, "+%s:%s%s", remote_head_points_at->name,
branch_top->buf, head);
......
......@@ -495,7 +495,7 @@ static int is_a_merge(const struct commit *current_head)
static void assert_split_ident(struct ident_split *id, const struct strbuf *buf)
{
if (split_ident_line(id, buf->buf, buf->len) || !id->date_begin)
die("BUG: unable to parse our own ident: %s", buf->buf);
BUG("unable to parse our own ident: %s", buf->buf);
}
static void export_one(const char *var, const char *s, const char *e, int hack)
......
......@@ -309,7 +309,7 @@ static char *normalize_value(const char *key, const char *value)
return xstrdup(v ? "true" : "false");
}
die("BUG: cannot normalize type %d", types);
BUG("cannot normalize type %d", types);
}
static int get_color_found;
......
......@@ -517,7 +517,7 @@ static void anonymize_ident_line(const char **beg, const char **end)
/* skip "committer", "author", "tagger", etc */
end_of_header = strchr(*beg, ' ');
if (!end_of_header)
die("BUG: malformed line fed to anonymize_ident_line: %.*s",
BUG("malformed line fed to anonymize_ident_line: %.*s",
(int)(*end - *beg), *beg);
end_of_header++;
strbuf_add(out, *beg, end_of_header - *beg);
......
......@@ -519,7 +519,7 @@ static struct object *parse_loose_object(const struct object_id *oid,
return NULL;
if (!contents && type != OBJ_BLOB)
die("BUG: read_loose_object streamed a non-blob");
BUG("read_loose_object streamed a non-blob");
obj = parse_object_buffer(oid, type, size, contents, &eaten);
......
......@@ -866,7 +866,7 @@ static void sha1_object(const void *data, struct object_entry *obj_entry,
if (obj->type == OBJ_COMMIT) {
struct commit *commit = (struct commit *) obj;
if (detach_commit_buffer(commit, NULL) != data)
die("BUG: parse_object_buffer transmogrified our buffer");
BUG("parse_object_buffer transmogrified our buffer");
}
obj->flags |= FLAG_CHECKED;
}
......@@ -1015,7 +1015,7 @@ static struct base_data *find_unresolved_deltas_1(struct base_data *base,
if (!compare_and_swap_type(&child->real_type, OBJ_REF_DELTA,
base->obj->real_type))
die("BUG: child->real_type != OBJ_REF_DELTA");
BUG("child->real_type != OBJ_REF_DELTA");
resolve_delta(child, base, result);
if (base->ref_first == base->ref_last && base->ofs_last == -1)
......
......@@ -391,7 +391,7 @@ int init_db(const char *git_dir, const char *real_git_dir,
else if (get_shared_repository() == PERM_EVERYBODY)
xsnprintf(buf, sizeof(buf), "%d", OLD_PERM_EVERYBODY);
else
die("BUG: invalid value for shared_repository");
BUG("invalid value for shared_repository");
git_config_set("core.sharedrepository", buf);
git_config_set("receive.denyNonFastforwards", "true");
}
......
......@@ -166,7 +166,7 @@ static void show_killed_files(const struct index_state *istate,
*/
pos = index_name_pos(istate, ent->name, ent->len);
if (0 <= pos)
die("BUG: killed-file %.*s not found",
BUG("killed-file %.*s not found",
ent->len, ent->name);
pos = -pos - 1;
while (pos < istate->cache_nr &&
......
......@@ -461,7 +461,7 @@ static int add(int argc, const char **argv, const char *prefix)
if (d.buf.len || allow_empty) {
write_note_data(&d, &new_note);
if (add_note(t, &object, &new_note, combine_notes_overwrite))
die("BUG: combine_notes_overwrite failed");
BUG("combine_notes_overwrite failed");
commit_notes(t, "Notes added by 'git notes add'");
} else {
fprintf(stderr, _("Removing note for object %s\n"),
......@@ -544,7 +544,7 @@ static int copy(int argc, const char **argv, const char *prefix)
}
if (add_note(t, &object, from_note, combine_notes_overwrite))
die("BUG: combine_notes_overwrite failed");
BUG("combine_notes_overwrite failed");
commit_notes(t, "Notes added by 'git notes copy'");
out:
free_notes(t);
......@@ -621,7 +621,7 @@ static int append_edit(int argc, const char **argv, const char *prefix)
if (d.buf.len || allow_empty) {
write_note_data(&d, &new_note);
if (add_note(t, &object, &new_note, combine_notes_overwrite))
die("BUG: combine_notes_overwrite failed");
BUG("combine_notes_overwrite failed");
logmsg = xstrfmt("Notes added by 'git notes %s'", argv[0]);
} else {
fprintf(stderr, _("Removing note for object %s\n"),
......@@ -831,7 +831,7 @@ static int merge(int argc, const char **argv, const char *prefix)
const char *short_ref = NULL;
if (!skip_prefix(o.local_ref, "refs/notes/", &short_ref))
die("BUG: local ref %s is outside of refs/notes/",
BUG("local ref %s is outside of refs/notes/",
o.local_ref);
strbuf_addf(&merge_key, "notes.%s.mergeStrategy", short_ref);
......
......@@ -1620,7 +1620,7 @@ static void break_delta_chains(struct object_entry *entry)
* is a bug.
*/
if (cur->dfs_state != DFS_NONE)
die("BUG: confusing delta dfs state in first pass: %d",
BUG("confusing delta dfs state in first pass: %d",
cur->dfs_state);
/*
......@@ -1677,7 +1677,7 @@ static void break_delta_chains(struct object_entry *entry)
if (cur->dfs_state == DFS_DONE)
break;
else if (cur->dfs_state != DFS_ACTIVE)
die("BUG: confusing delta dfs state in second pass: %d",
BUG("confusing delta dfs state in second pass: %d",
cur->dfs_state);
/*
......
......@@ -539,7 +539,7 @@ static int run_fetch(const char *repo, const char **refspecs)
argv_array_push(&args, repo);
argv_array_pushv(&args, refspecs);
} else if (*refspecs)
die("BUG: refspecs without repo?");
BUG("refspecs without repo?");
ret = run_command_v_opt(args.argv, RUN_GIT_CMD);
argv_array_clear(&args);
return ret;
......
......@@ -1378,7 +1378,7 @@ static void warn_if_skipped_connectivity_check(struct command *commands,
}
}
if (!checked_connectivity)
die("BUG: connectivity check skipped???");
BUG("connectivity check skipped???");
}
static void execute_commands_non_atomic(struct command *commands,
......
......@@ -501,6 +501,6 @@ int cmd_replace(int argc, const char **argv, const char *prefix)
return list_replace_refs(argv[0], format);
default:
die("BUG: invalid cmdmode %d", (int)cmdmode);
BUG("invalid cmdmode %d", (int)cmdmode);
}
}
......@@ -1164,7 +1164,7 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
report(_("Untracked cache enabled for '%s'"), get_git_work_tree());
break;
default:
die("BUG: bad untracked_cache value: %d", untracked_cache);
BUG("bad untracked_cache value: %d", untracked_cache);
}
if (fsmonitor > 0) {
......
......@@ -230,7 +230,7 @@ static int deflate_to_pack(struct bulk_checkin_state *state,
* pack, and write into it.
*/
if (!idx)
die("BUG: should not happen");
BUG("should not happen");
hashfile_truncate(state->f, &checkpoint);
state->offset = checkpoint.offset;
finish_bulk_checkin(state);
......
......@@ -174,7 +174,7 @@ static char *color_output(char *out, int len, const struct color *c, char type)
break;
case COLOR_ANSI:
if (len < 2)
die("BUG: color parsing ran out of space");
BUG("color parsing ran out of space");
*out++ = type;
*out++ = '0' + c->value;
break;
......@@ -256,7 +256,7 @@ int color_parse_mem(const char *value, int value_len, char *dst)
#undef OUT
#define OUT(x) do { \
if (dst == end) \
die("BUG: color parsing ran out of space"); \
BUG("color parsing ran out of space"); \
*dst++ = (x); \
} while(0)
......
......@@ -214,7 +214,7 @@ void print_columns(const struct string_list *list, unsigned int colopts,
display_table(list, colopts, &nopts);
break;
default:
die("BUG: invalid layout mode %d", COL_LAYOUT(colopts));
BUG("invalid layout mode %d", COL_LAYOUT(colopts));
}
}
......
......@@ -102,7 +102,7 @@ static int config_buf_ungetc(int c, struct config_source *conf)
if (conf->u.buf.pos > 0) {
conf->u.buf.pos--;
if (conf->u.buf.buf[conf->u.buf.pos] != c)
die("BUG: config_buf can only ungetc the same character");
BUG("config_buf can only ungetc the same character");
return c;
}
......@@ -189,7 +189,7 @@ static int prepare_include_condition_pattern(struct strbuf *pat)
strbuf_realpath(&path, cf->path, 1);
slash = find_last_dir_sep(path.buf);
if (!slash)
die("BUG: how is this possible?");
BUG("how is this possible?");
strbuf_splice(pat, 0, 1, path.buf, slash - path.buf);
prefix = slash - path.buf + 1 /* slash */;
} 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
l_item->value_index = e->value_list.nr - 1;
if (!cf)
die("BUG: configset_add_value has no source");
BUG("configset_add_value has no source");
if (cf->name) {
kv_info->filename = strintern(cf->name);
kv_info->linenr = cf->linenr;
......@@ -3006,7 +3006,7 @@ const char *current_config_origin_type(void)
else if(cf)
type = cf->origin_type;
else
die("BUG: current_config_origin_type called outside config callback");
BUG("current_config_origin_type called outside config callback");
switch (type) {
case CONFIG_ORIGIN_BLOB:
......@@ -3020,7 +3020,7 @@ const char *current_config_origin_type(void)
case CONFIG_ORIGIN_CMDLINE:
return "command line";
default:
die("BUG: unknown config origin type");
BUG("unknown config origin type");
}
}
......@@ -3032,7 +3032,7 @@ const char *current_config_name(void)
else if (cf)
name = cf->name;
else
die("BUG: current_config_name called outside config callback");
BUG("current_config_name called outside config callback");
return name ? name : "";
}
......
......@@ -185,7 +185,7 @@ struct date_mode *date_mode_from_type(enum date_mode_type type)
{
static struct date_mode mode;
if (type == DATE_STRFTIME)
die("BUG: cannot create anonymous strftime date_mode struct");
BUG("cannot create anonymous strftime date_mode struct");
mode.type = type;
mode.local = 0;
return &mode;
......
......@@ -1184,7 +1184,7 @@ static void emit_diff_symbol_from_struct(struct diff_options *o,
fputs(o->stat_sep, o->file);
break;
default:
die("BUG: unknown diff symbol");
BUG("unknown diff symbol");
}
strbuf_release(&sb);
}
......@@ -1343,7 +1343,7 @@ static struct diff_tempfile *claim_diff_tempfile(void) {
for (i = 0; i < ARRAY_SIZE(diff_temp); i++)
if (!diff_temp[i].name)
return diff_temp + i;
die("BUG: diff is failing to clean up its tempfiles");
BUG("diff is failing to clean up its tempfiles");
}
static void remove_tempfile(void)
......@@ -3840,7 +3840,7 @@ static const char *diff_abbrev_oid(const struct object_id *oid, int abbrev)
if (abbrev < 0)
abbrev = FALLBACK_DEFAULT_ABBREV;
if (abbrev > GIT_SHA1_HEXSZ)
die("BUG: oid abbreviation out of range: %d", abbrev);
BUG("oid abbreviation out of range: %d", abbrev);
if (abbrev)
hex[abbrev] = '\0';
return hex;
......@@ -4334,7 +4334,7 @@ static int stat_opt(struct diff_options *options, const char **av)
int argcount = 1;
if (!skip_prefix(arg, "--stat", &arg))
die("BUG: stat option does not begin with --stat: %s", arg);
BUG("stat option does not begin with --stat: %s", arg);
end = (char *)arg;
switch (*arg) {
......@@ -5519,7 +5519,7 @@ static void diff_flush_patch_all_file_pairs(struct diff_options *o)
struct diff_queue_struct *q = &diff_queued_diff;
if (WSEH_NEW & WS_RULE_MASK)
die("BUG: WS rules bit mask overlaps with diff symbol flags");
BUG("WS rules bit mask overlaps with diff symbol flags");
if (o->color_moved)
o->emitted_symbols = &esm;
......@@ -6053,7 +6053,7 @@ size_t fill_textconv(struct userdiff_driver *driver,
}
if (!driver->textconv)
die("BUG: fill_textconv called with non-textconv driver");
BUG("fill_textconv called with non-textconv driver");
if (driver->textconv_cache && df->oid_valid) {
*outbuf = notes_cache_get(driver->textconv_cache,
......
......@@ -188,7 +188,7 @@ struct dir_iterator *dir_iterator_begin(const char *path)
struct dir_iterator *dir_iterator = &iter->base;
if (!path || !*path)
die("BUG: empty path passed to dir_iterator_begin()");
BUG("empty path passed to dir_iterator_begin()");
strbuf_init(&iter->base.path, PATH_MAX);
strbuf_addstr(&iter->base.path, path);
......
......@@ -404,7 +404,7 @@ static void compile_pcre1_regexp(struct grep_pat *p, const struct grep_opt *opt)
die("Couldn't allocate PCRE JIT stack");
pcre_assign_jit_stack(p->pcre1_extra_info, NULL, p->pcre1_jit_stack);
} else if (p->pcre1_jit_on != 0) {
die("BUG: The pcre1_jit_on variable should be 0 or 1, not %d",
BUG("The pcre1_jit_on variable should be 0 or 1, not %d",
p->pcre1_jit_on);
}
#endif
......@@ -550,7 +550,7 @@ static void compile_pcre2_pattern(struct grep_pat *p, const struct grep_opt *opt
die("Couldn't allocate PCRE2 match context");
pcre2_jit_stack_assign(p->pcre2_match_context, NULL, p->pcre2_jit_stack);
} else if (p->pcre2_jit_on != 0) {
die("BUG: The pcre2_jit_on variable should be 0 or 1, not %d",
BUG("The pcre2_jit_on variable should be 0 or 1, not %d",
p->pcre1_jit_on);
}
}
......@@ -917,10 +917,10 @@ static struct grep_expr *prep_header_patterns(struct grep_opt *opt)
for (p = opt->header_list; p; p = p->next) {
if (p->token != GREP_PATTERN_HEAD)
die("BUG: a non-header pattern in grep header list.");
BUG("a non-header pattern in grep header list.");
if (p->field < GREP_HEADER_FIELD_MIN ||
GREP_HEADER_FIELD_MAX <= p->field)
die("BUG: unknown header field %d", p->field);
BUG("unknown header field %d", p->field);
compile_regexp(p, opt);
}
......@@ -933,7 +933,7 @@ static struct grep_expr *prep_header_patterns(struct grep_opt *opt)
h = compile_pattern_atom(&pp);
if (!h || pp != p->next)
die("BUG: malformed header expr");
BUG("malformed header expr");
if (!header_group[p->field]) {
header_group[p->field] = h;
continue;
......@@ -1652,7 +1652,7 @@ static int fill_textconv_grep(struct userdiff_driver *driver,
fill_filespec(df, &null_oid, 0, 0100644);
break;
default:
die("BUG: attempt to textconv something without a path?");
BUG("attempt to textconv something without a path?");
}
/*
......@@ -1748,7 +1748,7 @@ static int grep_source_1(struct grep_opt *opt, struct grep_source *gs, int colle
case GREP_BINARY_TEXT:
break;
default:
die("BUG: unknown binary handling mode");
BUG("unknown binary handling mode");
}
}
......@@ -2072,7 +2072,7 @@ static int grep_source_load(struct grep_source *gs)
case GREP_SOURCE_BUF:
return gs->buf ? 0 : -1;
}
die("BUG: invalid grep_source type to load");
BUG("invalid grep_source type to load");
}
void grep_source_load_driver(struct grep_source *gs)
......
......@@ -1855,7 +1855,7 @@ static int update_url_from_redirect(struct strbuf *base,
return 0;
if (!skip_prefix(asked, base->buf, &tail))
die("BUG: update_url_from_redirect: %s is not a superset of %s",
BUG("update_url_from_redirect: %s is not a superset of %s",
asked, base->buf);
new_len = got->len;
......@@ -1903,7 +1903,7 @@ static int http_request_reauth(const char *url,
strbuf_reset(result);
break;
default:
die("BUG: HTTP_KEEP_ERROR is only supported with strbufs");
BUG("HTTP_KEEP_ERROR is only supported with strbufs");
}
}
......@@ -2114,7 +2114,7 @@ int finish_http_pack_request(struct http_pack_request *preq)
*lst = (*lst)->next;
if (!strip_suffix(preq->tmpfile, ".pack.temp", &len))
die("BUG: pack tmpfile does not end in .pack.temp?");
BUG("pack tmpfile does not end in .pack.temp?");
tmp_idx = xstrfmt("%.*s.idx.temp", (int)len, preq->tmpfile);
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,
CURLcode c = curl_easy_getinfo(slot->curl, CURLINFO_HTTP_CODE,
&slot->http_code);
if (c != CURLE_OK)
die("BUG: curl_easy_getinfo for HTTP code failed: %s",
BUG("curl_easy_getinfo for HTTP code failed: %s",
curl_easy_strerror(c));
if (slot->http_code >= 300)
return size;
......
......@@ -511,7 +511,7 @@ static int nfsnprintf(char *buf, int blen, const char *fmt, ...)
va_start(va, fmt);
if (blen <= 0 || (unsigned)(ret = vsnprintf(buf, blen, fmt, va)) >= (unsigned)blen)
die("BUG: buffer too small. Please report a bug.");
BUG("buffer too small. Please report a bug.");
va_end(va);
return ret;
}
......
......@@ -193,7 +193,7 @@ char *get_locked_file_path(struct lock_file *lk)
strbuf_addstr(&ret, get_tempfile_path(lk->tempfile));
if (ret.len <= LOCK_SUFFIX_LEN ||
strcmp(ret.buf + ret.len - LOCK_SUFFIX_LEN, LOCK_SUFFIX))
die("BUG: get_locked_file_path() called for malformed lock object");
BUG("get_locked_file_path() called for malformed lock object");
/* remove ".lock": */
strbuf_setlen(&ret, ret.len - LOCK_SUFFIX_LEN);
return strbuf_detach(&ret, NULL);
......
......@@ -716,7 +716,7 @@ static void flush_inbody_header_accum(struct mailinfo *mi)
if (!mi->inbody_header_accum.len)
return;
if (!check_header(mi, &mi->inbody_header_accum, mi->s_hdr_data, 0))
die("BUG: inbody_header_accum, if not empty, must always contain a valid in-body header");
BUG("inbody_header_accum, if not empty, must always contain a valid in-body header");
strbuf_reset(&mi->inbody_header_accum);
}
......
......@@ -318,7 +318,7 @@ struct tree *write_tree_from_memory(struct merge_options *o)
fprintf(stderr, "BUG: %d %.*s\n", ce_stage(ce),
(int)ce_namelen(ce), ce->name);
}
die("BUG: unmerged index entries in merge-recursive.c");
BUG("unmerged index entries in merge-recursive.c");
}
if (!active_cache_tree)
......@@ -1060,7 +1060,7 @@ static int merge_file_1(struct merge_options *o,
break;
}
} else
die("BUG: unsupported object type in the tree");
BUG("unsupported object type in the tree");
}
return 0;
......@@ -1462,7 +1462,7 @@ static int process_renames(struct merge_options *o,
const char *ren2_dst = ren2->pair->two->path;
enum rename_type rename_type;
if (strcmp(ren1_src, ren2_src) != 0)
die("BUG: ren1_src != ren2_src");
BUG("ren1_src != ren2_src");
ren2->dst_entry->processed = 1;
ren2->processed = 1;
if (strcmp(ren1_dst, ren2_dst) != 0) {
......@@ -1496,7 +1496,7 @@ static int process_renames(struct merge_options *o,
ren2 = lookup->util;
ren2_dst = ren2->pair->two->path;
if (strcmp(ren1_dst, ren2_dst) != 0)
die("BUG: ren1_dst != ren2_dst");
BUG("ren1_dst != ren2_dst");
clean_merge = 0;
ren2->processed = 1;
......@@ -1962,7 +1962,7 @@ static int process_entry(struct merge_options *o,
*/
remove_file(o, 1, path, !a_mode);
} else
die("BUG: fatal merge failure, shouldn't happen.");
BUG("fatal merge failure, shouldn't happen.");
return clean_merge;
}
......@@ -2040,7 +2040,7 @@ int merge_trees(struct merge_options *o,
for (i = 0; i < entries->nr; i++) {
struct stage_data *e = entries->items[i].util;
if (!e->processed)
die("BUG: unprocessed path??? %s",
BUG("unprocessed path??? %s",
entries->items[i].string);
}
......
......@@ -442,7 +442,7 @@ static int merge_one_change(struct notes_merge_options *o,
printf("Using remote notes for %s\n",