diff options
author | Junio C Hamano <gitster@pobox.com> | 2018-05-30 14:04:07 +0900 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-05-30 14:04:07 +0900 |
commit | 50f08db5941755b69012378bfc86f6b8ee98edf4 (patch) | |
tree | d403a1dbf522fdaab4cf6b9b508a08b3965828e2 /builtin | |
parent | Merge branch 'rs/no-null-ptr-arith-in-fast-export' (diff) | |
parent | BUG_exit_code: fix sparse "symbol not declared" warning (diff) | |
download | tgif-50f08db5941755b69012378bfc86f6b8ee98edf4.tar.xz |
Merge branch 'js/use-bug-macro'
Developer support update, by using BUG() macro instead of die() to
mark codepaths that should not happen more clearly.
* js/use-bug-macro:
BUG_exit_code: fix sparse "symbol not declared" warning
Convert remaining die*(BUG) messages
Replace all die("BUG: ...") calls by BUG() ones
run-command: use BUG() to report bugs, not die()
test-tool: help verifying BUG() code paths
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/am.c | 20 | ||||
-rw-r--r-- | builtin/branch.c | 2 | ||||
-rw-r--r-- | builtin/cat-file.c | 4 | ||||
-rw-r--r-- | builtin/clone.c | 2 | ||||
-rw-r--r-- | builtin/commit.c | 2 | ||||
-rw-r--r-- | builtin/config.c | 2 | ||||
-rw-r--r-- | builtin/fast-export.c | 2 | ||||
-rw-r--r-- | builtin/index-pack.c | 4 | ||||
-rw-r--r-- | builtin/init-db.c | 2 | ||||
-rw-r--r-- | builtin/ls-files.c | 2 | ||||
-rw-r--r-- | builtin/notes.c | 8 | ||||
-rw-r--r-- | builtin/pack-objects.c | 4 | ||||
-rw-r--r-- | builtin/pull.c | 2 | ||||
-rw-r--r-- | builtin/receive-pack.c | 2 | ||||
-rw-r--r-- | builtin/update-index.c | 2 |
15 files changed, 30 insertions, 30 deletions
diff --git a/builtin/am.c b/builtin/am.c index d834f9e62b..3dc2ef4259 100644 --- a/builtin/am.c +++ b/builtin/am.c @@ -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); diff --git a/builtin/branch.c b/builtin/branch.c index efc9ac1922..5bb5123e72 100644 --- a/builtin/branch.c +++ b/builtin/branch.c @@ -500,7 +500,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) diff --git a/builtin/cat-file.c b/builtin/cat-file.c index b8ecbea98e..665b581949 100644 --- a/builtin/cat-file.c +++ b/builtin/cat-file.c @@ -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; } diff --git a/builtin/clone.c b/builtin/clone.c index 84f1473d19..ecd8495dab 100644 --- a/builtin/clone.c +++ b/builtin/clone.c @@ -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); diff --git a/builtin/commit.c b/builtin/commit.c index 5240f11225..5205d3a408 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -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) diff --git a/builtin/config.c b/builtin/config.c index 69e7270356..1e31aa9f8d 100644 --- a/builtin/config.c +++ b/builtin/config.c @@ -398,7 +398,7 @@ static char *normalize_value(const char *key, const char *value) return xstrdup(value); } - die("BUG: cannot normalize type %d", type); + BUG("cannot normalize type %d", type); } static int get_color_found; diff --git a/builtin/fast-export.c b/builtin/fast-export.c index 07d20f446f..f9568ddba0 100644 --- a/builtin/fast-export.c +++ b/builtin/fast-export.c @@ -516,7 +516,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); diff --git a/builtin/index-pack.c b/builtin/index-pack.c index 59130e8ecb..b3a5abcf2b 100644 --- a/builtin/index-pack.c +++ b/builtin/index-pack.c @@ -869,7 +869,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; } @@ -1018,7 +1018,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) diff --git a/builtin/init-db.c b/builtin/init-db.c index 2542c5244e..5a5844c153 100644 --- a/builtin/init-db.c +++ b/builtin/init-db.c @@ -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"); } diff --git a/builtin/ls-files.c b/builtin/ls-files.c index a71f6bd088..967b2b3380 100644 --- a/builtin/ls-files.c +++ b/builtin/ls-files.c @@ -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 && diff --git a/builtin/notes.c b/builtin/notes.c index e5bf80eef1..da279cdd34 100644 --- a/builtin/notes.c +++ b/builtin/notes.c @@ -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); diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c index 3df0bf0f6f..53a0fb6ef2 100644 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@ -1668,7 +1668,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); /* @@ -1725,7 +1725,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); /* diff --git a/builtin/pull.c b/builtin/pull.c index c719a4f9d7..25f7db5b3a 100644 --- a/builtin/pull.c +++ b/builtin/pull.c @@ -543,7 +543,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; diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c index 132a5339a3..d5f15cd4f6 100644 --- a/builtin/receive-pack.c +++ b/builtin/receive-pack.c @@ -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, diff --git a/builtin/update-index.c b/builtin/update-index.c index 6598bc06ad..a8709a26ec 100644 --- a/builtin/update-index.c +++ b/builtin/update-index.c @@ -1174,7 +1174,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) { |