From: Junio C Hamano Date: Wed, 30 May 2018 05:04:07 +0000 (+0900) Subject: Merge branch 'js/use-bug-macro' X-Git-Tag: v2.18.0-rc0~26 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/50f08db5941755b69012378bfc86f6b8ee98edf4 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 --- 50f08db5941755b69012378bfc86f6b8ee98edf4 diff --cc builtin/config.c index 69e7270356,c4f20332d7..1e31aa9f8d --- a/builtin/config.c +++ b/builtin/config.c @@@ -383,22 -308,8 +383,22 @@@ static char *normalize_value(const cha else return xstrdup(v ? "true" : "false"); } + if (type == TYPE_COLOR) { + char v[COLOR_MAXLEN]; + if (git_config_color(v, key, value)) + die("cannot parse color '%s'", value); + + /* + * The contents of `v` now contain an ANSI escape + * sequence, not suitable for including within a + * configuration file. Treat the above as a + * "sanity-check", and return the given value, which we + * know is representable as valid color code. + */ + return xstrdup(value); + } - die("BUG: cannot normalize type %d", type); - BUG("cannot normalize type %d", types); ++ BUG("cannot normalize type %d", type); } static int get_color_found; diff --cc merge-recursive.c index 8d96e94bd5,6409d0770f..e64b4b9d03 --- a/merge-recursive.c +++ b/merge-recursive.c @@@ -1166,12 -1060,9 +1166,12 @@@ static int merge_file_1(struct merge_op break; } } else - die("BUG: unsupported object type in the tree"); + BUG("unsupported object type in the tree"); } + if (result->merge) + output(o, 2, _("Auto-merging %s"), filename); + return 0; } diff --cc revision.c index 4e0e193e57,67f8e74cbb..dc756918e8 --- a/revision.c +++ b/revision.c @@@ -2174,10 -2173,10 +2174,10 @@@ static int handle_revision_pseudo_opt(c * supported right now, so stick to single worktree. */ if (!revs->single_worktree) - die("BUG: --single-worktree cannot be used together with submodule"); + BUG("--single-worktree cannot be used together with submodule"); refs = get_submodule_ref_store(submodule); } else - refs = get_main_ref_store(); + refs = get_main_ref_store(the_repository); /* * NOTE! diff --cc submodule.c index 8fd8e5d178,c282fa8fe5..eb08cf0782 --- a/submodule.c +++ b/submodule.c @@@ -1606,10 -1604,10 +1606,10 @@@ int submodule_move_head(const char *pat if (old_head && !is_submodule_populated_gently(path, error_code_ptr)) return 0; - sub = submodule_from_path(&null_oid, path); + sub = submodule_from_path(the_repository, &null_oid, path); if (!sub) - die("BUG: could not get submodule information for '%s'", path); + BUG("could not get submodule information for '%s'", path); if (old_head && !(flags & SUBMODULE_MOVE_HEAD_FORCE)) { /* Check if the submodule has a dirty index. */