This goes on top of [1] and is part of a split-up [2] into more digestable pieces. As in [2] we reduce duplication of "object %s is a %s not a %s" in various places by moving those messages/errors/dies to using a utility function. For the more meaty "don't misreport objects" change I'm planning to submit on top of this I'm then refactoring object_as_type() to not take a "quiet" argument. This wasn't strictly needed, but makes things simpler. As it turned out we had various parts of the codebase (ab)using object_as_type() just to check if something was of a given type, anything that deals with parsed objects can/should just use obj->type == OBJ_{COMMIT,TREE,BLOB,TAG} instead. This leaves object_as_type() as a low-level function for use in the object API itself. 1. http://lore.kernel.org/git/cover-0.6-0000000000-20210409T082935Z-avarab@xxxxxxxxx 2. https://lore.kernel.org/git/cover-00.11-00000000000-20210328T021238Z-avarab@xxxxxxxxx/ Ævar Arnfjörð Bjarmason (7): tree.c: fix misindentation in parse_tree_gently() object.c: add a utility function for "expected type X, got Y" object.c: add and use oid_is_type_or_die_msg() function commit-graph: use obj->type, not object_as_type() commit.c: don't use deref_tag() -> object_as_type() object.c: normalize brace style in object_as_type() object.c: remove "quiet" parameter from object_as_type() blob.c | 2 +- builtin/commit-graph.c | 2 +- builtin/fsck.c | 2 +- builtin/index-pack.c | 9 +++----- combine-diff.c | 3 +-- commit.c | 28 ++++++++++++++--------- merge-recursive.c | 5 ++++- object.c | 51 ++++++++++++++++++++++++++++++++++-------- object.h | 10 ++++++++- refs.c | 2 +- t/helper/test-reach.c | 2 +- tag.c | 2 +- tree.c | 15 +++++++------ 13 files changed, 90 insertions(+), 43 deletions(-) -- 2.31.1.592.gdf54ba9003